Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/04/03 15:33
Read: times


 
#35589 - RE: hi rob
How are you converting the 12bit(stored as int (u16)) data into individual characters for the display.When converted a u16 will produce 5 chars that will be displayed(0 to 4096 for your 12 bit data)...

the usual code I use is....
Note that I use a lookup table to get the ascii,but you could just add 0x30 (And I've removed the blank checking routine for clarity (ie 6 not 00006)..
------------------------------------------
code U8 lcd_map[10] = {'0','1','2','3','4','5','6','7','8','9'};


void display_int(U16 value) {

char1=value%10;
value/=10;
char2=value%10;
value /=10;
char3=value%10;
value /=10;
char4=value%10;
value /=10;
char5=value%10;

char5=lcd_map[char5];}
char4=lcd_map[char4];
char3=lcd_map[char3];
char2=lcd_map[char2];
char1=lcd_map[char1];

lcd_putc(char5);//msb
lcd_putc(char4);
lcd_putc(char3);
lcd_putc(char2);
lcd_putc(char1);//lsb



}

List of 13 messages in thread
TopicAuthorDate
serial adc            01/01/70 00:00      
RE: serial adc            01/01/70 00:00      
RE: serial adc            01/01/70 00:00      
To:Rob            01/01/70 00:00      
RE: To:Rob            01/01/70 00:00      
RE: To:Rob            01/01/70 00:00      
RE: To:Rob            01/01/70 00:00      
RE: To:Rob            01/01/70 00:00      
RE: To:Rob            01/01/70 00:00      
hi rob            01/01/70 00:00      
RE: hi rob            01/01/70 00:00      
RE: hi rob            01/01/70 00:00      
RE: hi rob            01/01/70 00:00      

Back to Subject List