I am using MPLAB, HI TECH compiler for a project.
This project require me to display some word on LCD and I got some question in the following code:
/* write a number of integer to the LCD */
void lcd_number(unsigned int no, char base, char digit)
{
char i,di[10];
for(i=0;i<=9;i++)
di=0;
i=0;
do
{
di=no%base;
no=no/base;
i++;
}
while(no!=0);
for(i=digit;i>0;i--)
{
if(di[i-1]<=9)
lcd_write(i-1,'0');
else
lcd_write(i-1-10,'A');
}
}
what is the purpose of "lcd_write(i-1,'0');" and "lcd_write(i-1,'A');"?
what does the 'O' and 'A' stand for?
why do it use 'O' and 'A', but not straight away display the digit in that variable?
any idea?
This project require me to display some word on LCD and I got some question in the following code:
/* write a number of integer to the LCD */
void lcd_number(unsigned int no, char base, char digit)
{
char i,di[10];
for(i=0;i<=9;i++)
di=0;
i=0;
do
{
di=no%base;
no=no/base;
i++;
}
while(no!=0);
for(i=digit;i>0;i--)
{
if(di[i-1]<=9)
lcd_write(i-1,'0');
else
lcd_write(i-1-10,'A');
}
}
what is the purpose of "lcd_write(i-1,'0');" and "lcd_write(i-1,'A');"?
what does the 'O' and 'A' stand for?
why do it use 'O' and 'A', but not straight away display the digit in that variable?
any idea?