It is very simple to program the micro-controller to display any text or symbol of your choice.
Download the following spreadsheet:
In the spreadsheet you'll see that there are alphabets. At the bottom of each column of each alphabet, there is a number (For example, row 13). This is the decimal equivalent for the L.E.D.s to glow so as to display the first column. Now all you have to do is to convert this decimal code to hexadecimal and then use it in the program to display whatever you want.
We've made functions of each alphabet so that we don't have to write the codes again and again for the repetitive alphabets.
To understand it more clearly have a look at the code. Concentrate on the code of "A":
void a()
{
PORTD=0X1F;
_delay_ms(1);
PORTD=0X24;
_delay_ms(1);
PORTD=0X44;
_delay_ms(1);
PORTD=0X84;
_delay_ms(1);
PORTD=0X44;
_delay_ms(1);
PORTD=0X24;
_delay_ms(1);
PORTD=0X1F;
_delay_ms(1);
PORTD=0X00;
_delay_ms(1);
PORTD=0X00;
_delay_ms(1);
}
When you convert the codes from the spreadsheet, you get:void a()
{
PORTD=0X1F;
_delay_ms(1);
PORTD=0X24;
_delay_ms(1);
PORTD=0X44;
_delay_ms(1);
PORTD=0X84;
_delay_ms(1);
PORTD=0X44;
_delay_ms(1);
PORTD=0X24;
_delay_ms(1);
PORTD=0X1F;
_delay_ms(1);
PORTD=0X00;
_delay_ms(1);
PORTD=0X00;
_delay_ms(1);
}
31 = 1F
36 = 24
68 = 44
132 = 84
68 = 44
36 = 24
31 = 1F
The segment
PORTD=0X00;
_delay_ms(1);
PORTD=0X00;
_delay_ms(1);
is used for providing blank spaces.
Now you can code the display as you wish.
No comments:
Post a Comment