<<<< Read Previous Part
Previous part of this tutorial is given in last page. Text to be displayed in the 8*8 LED matrix is written using '1's in the 'text_to_display' 2D array. This 2D array has 22 columns. But, only 8 consecutive columns can be displayed at a time in the LED matrix. We have seen, a 'cathode_decimal' array in previous program. In the program given in this blog, 'cathode_decimal' array is declared as an empty array. From the 'text_to_display' 2D array, we have to make decimals for complement of each columns of 'text_to_display' 2D array as given in 'cathode_decimal' array of previous program.
Complementing the columns is important since the generated decimal is shifted out to the cathode pins of LED matrix. Complementing is not required, if the generated decimal is shifted out to the anode pins of LED matrix. A part of program inside 'setup' function converts complement of each columns of 'text_to_display' 2D array to decimal. While creating the decimal for each columns, bit at the top of each column is considered as LSB and bit at the bottom of each column is considered as MSB. This decimal should be shifted out to the cathode pins of 8*8 LED matrix. After generating decimals for each columns, cathode decimal array will be as shown below.
cathode_decimal[]={0, 0, 231, 231, 0 , 0, 255, 0, 0, 204, 204, 0, 0, 255, 0, 0, 255, 127, 255, 127, 255, 255}
If you want to add more columns to the 'text_to_display' 2D array. Simply add it carefully without making any mistakes in syntax. After adding more columns, some more modifications also have to be made in the program. Modifications are given below.
Modification 1: Change the number of columns of 'text_to_display' 2D array (declared in the portion encircled by a red line in the following image) from '22' to the new number of columns.
Modification 2: Change the number of columns of 'cathode_decimal' array (declared in the portion encircled by a red line in the following image) from '22' to the new number of columns. Length of 'cathode_decimal' array should be same as that of number of columns of 'text_to_display' 2D array.
Modification 3: Change the value of 'length_of_two_d' integer variable (declared in the portion encircled by a red line in the following image) from '22' to new value. Value of 'length_of_two_d' integer variable should be same as that of number of columns of 'text_to_display' 2D array.
After making all these modifications, upload the new program to your arduino board. New text will start displaying in 8*8 LED matrix.
Complementing the columns is important since the generated decimal is shifted out to the cathode pins of LED matrix. Complementing is not required, if the generated decimal is shifted out to the anode pins of LED matrix. A part of program inside 'setup' function converts complement of each columns of 'text_to_display' 2D array to decimal. While creating the decimal for each columns, bit at the top of each column is considered as LSB and bit at the bottom of each column is considered as MSB. This decimal should be shifted out to the cathode pins of 8*8 LED matrix. After generating decimals for each columns, cathode decimal array will be as shown below.
cathode_decimal[]={0, 0, 231, 231, 0 , 0, 255, 0, 0, 204, 204, 0, 0, 255, 0, 0, 255, 127, 255, 127, 255, 255}
If you want to add more columns to the 'text_to_display' 2D array. Simply add it carefully without making any mistakes in syntax. After adding more columns, some more modifications also have to be made in the program. Modifications are given below.
Modification 1: Change the number of columns of 'text_to_display' 2D array (declared in the portion encircled by a red line in the following image) from '22' to the new number of columns.
Modification 2: Change the number of columns of 'cathode_decimal' array (declared in the portion encircled by a red line in the following image) from '22' to the new number of columns. Length of 'cathode_decimal' array should be same as that of number of columns of 'text_to_display' 2D array.
Modification 3: Change the value of 'length_of_two_d' integer variable (declared in the portion encircled by a red line in the following image) from '22' to new value. Value of 'length_of_two_d' integer variable should be same as that of number of columns of 'text_to_display' 2D array.
After making all these modifications, upload the new program to your arduino board. New text will start displaying in 8*8 LED matrix.
Next: Connect Current Limiting Resistors to LED Matrix |
0 comments: