parthaarathi said:i am using atmel avr microcontroller.
char bcd2seg7 (unsigned char b) {
char seg7 [10] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,
0x7c,0x07,0x7f,0x67 };
if (b<10) return seg7[b];
switch (b) {
case 0xff:
return 0x40; // minus
break;
default:
return 0;
}
}
void update_lcd (int nLCD) {
if (nLCD>999) nLCD=999;
else if (nLCD<-99) nLCD=-99;
if (nLCD<0) {
lcd_bcd[0]=0xff;
nLCD=-nLCD;
}
else lcd_bcd[0]=nLCD / 100;
if (lcd_bcd[0]==0) lcd_bcd[0] = 10; // zero supress
lcd_bcd[1]=(nLCD % 100) / 10;
lcd_bcd[2]=nLCD % 10;
EA = 0;
p0 = bcd2seg7(lcd_bcd[2]);
p3 = bcd2seg7(lcd_bcd[1]) << 1;
p2 = bcd2seg7(lcd_bcd[0]) | (p3 & 2) <<6;
EA = 1;
}
if (tic_128 & 2) {
P0 = ~p0 & ~0x80;
P2 = ~p2;
P3 = ~p3 | 3;
}
else {
P0 = p0 | 0x80;
P2 = p2;
P3 = p3 | 3;
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?