Lcd Display Help

Status
Not open for further replies.

adnan012

New Member
I can diplay characters on lcd a,b c,d,... by using commands
mov A,#'A'
acall ,display

in 89c2051

but i can't diplay the contents of "timer register" time captured by an event event in decimal.
is any conversion required?
 
adnan012 said:
I can diplay characters on lcd a,b c,d,... by using commands
mov A,#'A'
acall ,display

in 89c2051

but i can't diplay the contents of "timer register" time captured by an event event in decimal.
is any conversion required?

Yes, a binary to bcd/ascii conversion routine is required.

>> time captured by an event event in decimal. .....do you mean decimal?
 
Hmm if I understand your problem, you have an alphanumeric 'character' LCD display. This uses ascii characters.

The 'value' for your timer....you say 'decimal', but really whether its binary, decimal or hex depends on how you display it

What you need to do is convert the 'single' number from your timer, into binary coded decimal. For example, say your timer value is '172', you must send 3 charaters to the LCD. '1', '7', and '2'.

After you have three bytes with the values 1,7 and 2...you must convert this to ASCII. From memory, I think you just have to add '30' (decimal) to the value.

Hope that helps, if not, explain your problem in more detail.

Blueteeth

Edit: Oh you're too quick for me eric...
 
help

i am using 'jhd 162a' lcd
i want to display the pulse width "by an external source measured by the controller) on LCD.
I NEED THE COVERSION METHOD
 
Ok, so I assume your microcontroller has already measured the pulse width and has a value stored in a register? Doesthis value relate to a time-base in anyway? like 'ms' ?

The 'CONVERSION METHOD' you need is 'binary to decimal conversion'. Either 8 bit for a single byte (0-255) or 16 bit.

Google really is a wonderful thing. Just search for 'BCD' and your microcontrollers part number and I'm sure you will come up with something.

BT
 
hi,

Whats the maximum value of the number you wish to convert fron binary to bcd/ascii? is it 8bits or 16bits?

[I have slowed down blueteeth, let you play catch up ]
 
adnan012 said:
My Controller May Contain From 03e8 (1000) To 07d0(07d0)

hi,
In that case you require a 16bit binary conversion, which will give 5 bcd digits, just drop the MSD and the add 0x30 to the bcd digits to form the ascii characters.

As suggested there are lots of 16bit routines on the web,, if you get a problem come back.
 
adnan012 said:
IS THIS CODE WILL WORK FOR ME
**broken link removed**

From the description, its what you need. I dont use the 80xx series of MCU's

>>> Purpose: Routine to convert a 16bit binary number in ASCII
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…