Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 2nd November 2007, 02:48 PM   (permalink)
Default Lcd Display Help

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 is offline  
Old 2nd November 2007, 02:52 PM   (permalink)
Default

Quote:
Originally Posted by adnan012
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?
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is offline  
Old 2nd November 2007, 02:56 PM   (permalink)
Default

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...
__________________
Inconsistency is the key to flexibility!
Blueteeth is offline  
Old 2nd November 2007, 03:03 PM   (permalink)
Default 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
adnan012 is offline  
Old 2nd November 2007, 03:08 PM   (permalink)
Default

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
__________________
Inconsistency is the key to flexibility!
Blueteeth is offline  
Old 2nd November 2007, 03:14 PM   (permalink)
Default

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 ]
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is offline  
Old 2nd November 2007, 03:22 PM   (permalink)
Default Help

My Controller May Contain From 03e8 (1000) To 07d0(2000)

Last edited by adnan012; 2nd November 2007 at 03:25 PM.
adnan012 is offline  
Old 2nd November 2007, 03:23 PM   (permalink)
Default

From 1000 Micro Seconds To 2000 Micro Seconds 16-bit
adnan012 is offline  
Old 2nd November 2007, 03:27 PM   (permalink)
Default

Quote:
Originally Posted by adnan012
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.
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is offline  
Old 2nd November 2007, 03:32 PM   (permalink)
Default

Thanks A Lot
adnan012 is offline  
Old 2nd November 2007, 03:39 PM   (permalink)
Default

IS THIS CODE WILL WORK FOR ME
http://www.8052.com/codelib/bintoasc.asm
adnan012 is offline  
Old 2nd November 2007, 04:06 PM   (permalink)
Default

Quote:
Originally Posted by adnan012
IS THIS CODE WILL WORK FOR ME
http://www.8052.com/codelib/bintoasc.asm
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
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
Problem with LCD code? spondootre Micro Controllers 15 29th April 2008 10:15 AM
Is this display burned out? (Sony MD LCD Display) Amphr_Moth General Electronics Chat 4 28th October 2007 07:47 PM
calculator chinmay7 Micro Controllers 1 14th October 2007 01:45 PM
PIC16F628A LCD problems. HerbertMunch Micro Controllers 17 2nd October 2007 10:20 AM
LCD Troubles Kyle-s4h Micro Controllers 13 11th September 2007 01:30 PM



All times are GMT. The time now is 09:02 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker