putting dec value on lcd

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hello all,

I am a virgin in this and doctoring around with ICC11 and some board.
I have finally got the AD converter going and get the results via printf
on the terminal screen.
Now I want to put the result on the LCD.
I have the AD result in an unsigned char variable (guess it is binary or
anyhow 8 bit for sure :)

#define LCDcmmd *(unsigned char *)0x1400
#define LCD_DATA *(unsigned char *)0x1401

Sending control codes for the LCD works ok . I can clear and position the

I want to display a decimal result of the content of the result register on
the LCD.
Easy to do that with printf to the terminal how do I do this for the LCD?

Some c sample would be appreciated.

Thanks for the help, gurus.


Re: putting dec value on lcd
Quoted text here. Click to load it

One of the many ways to do it in C:

units  = number %10;
tens = (number-units) %100;
hunderds = number/100;

to convert to ASCII: add '0' to each result


Re: putting dec value on lcd
Quoted text here. Click to load it
As you seem to have printf() available on your platform, you must also
have sprintf() available. Use this to first print the value to a buffer.
Then copy the contents of the buffer to the LCD. You may need to
substract an offset from the characters, compare the LCD datasheet to a
'normal' ASCII table.


Re: putting dec value on lcd
On Mon, 22 Sep 2003 01:35:18 -0400, "Peter Pohlmann"

Quoted text here. Click to load it

I wrote this in 1991 - let's hope it still works :)

#include <stdio.h>
char fms [10];
a = sprintf (fms, "%d:%.2d",((int) time/60), time%60);
putslcd1 (fms);

The function "putslcd" just repeatedly calls the routine
which prints a single character to the LCD until "putslcd"
detects a zero in the string.

Mike Harding

Site Timeline