# lcd display using pic

Status
Not open for further replies.

#### mic5

##### Member
i need the convertion method that changes digital number into decibel reading
number may have 10 or 8 bits

how can transfer a number from port lines to display on lcd and which lcd is easy and compatible with r8c/tiny..

#### Brian Hoskins

##### New Member
If I have read your question right, you want to take an 8-bit binary number (which represents a decimal number from 0-255) and display it on an LCD?

I have recently tackled this problem myself, and I did manage to come up with a solution but I'm not going to claim that it was the most efficient way of doing it. Other people may have better ideas. I decided to divide the 8-bit number by 10, and by repeating this method the units, tens and hundreds were separated from the number. Then, with the units, tens and hundreds stored in separate variables, I simply added 48 to them (since 48 is decimal zero in ascii) to apply ascii correction. Then you can send the hundreds, tens and units to the LCD display.

For example, here is how I extracted the hundreds, tens and units from an 8-bit binary number stored in the variable "command". I stored the separated digits into C3, C2 and C1 which were then separately sent to the LCD:

Code:
C3 = 48 ; C2 = 48 ; C1 = 48 ;

C3 = C3 + (Command % 10 ) ;	// These steps extract the hundreds, tens and units
Command = Command / 10 ;	// from Command and stores them in C1, C2 and C3
C2 = C2 + (Command % 10 ) ;
Command = Command / 10 ;
C1 = C1 + (Command % 10 ) ;

This was the easiest method I could come up with and the processing time lost by repeatedly dividing by 10 wasn't a problem for my application. If anyone can offer a better method, please feel free to share it!

Brian

Last edited:

#### Mr RB

##### Well-Known Member
Yeech! Divide by 10?? Modulus 10?

subtract 1000's and inc a digit
subtract 100's and inc a digit
subtract 10's and inc a digit
remainder is the units

For 10 bit (max 4095) the average loops are roughly 2+5+5 about 12 to 13 loops of simple subtractions. I posted some C code to do this on this forum a few days back.

But there's probably a quicker way than that too...

#### mic5

##### Member
thanks for the informations...

How can we transfer individual digit(0,1,2,..) from port line to lcd?
I know only transfer of bits on port to other circuit.Give some information regarding lcd display system like the connection lines, transfer of number by ascii or bits.....

#### Brian Hoskins

##### New Member
All the information you need for that is in the datasheet for the device. You need to consult the datasheet to find out which lines you need to toggle, what commands and initialisation codes you need to send, and how to send the actual data to be printed on the display. It sounds complicated but in practice it is quite easy.

Try the datasheet, then ask questions if you're still stuck.

Mr RB:

I'm going to look into that!

#### mic5

##### Member
alright

thanks for u r suggestion..!

I will be back after finishing all those things

Last edited:

#### Brian Hoskins

##### New Member
thanks for u r suggestion..!

I will be back after finishing all those things

If you are unfamiliar both with programming microcontrollers and driving LCDs, I would recommend separating the two problems. You can learn how to drive a parallel LCD without a Microcontroller by setting it up on prototyping board with switches for your control lines and data. Then, by setting the data you want to send on the data bus and toggling your control lines in the correct fashion, you can manually send the LCD commands and text data. This will at least give you a basic appreciation of how the LCD works. Once you're comfortable with that, you can move on to the problem of getting a Microcontroller to control the LCD.

Brian

#### Brian Hoskins

##### New Member
hi Brian,
This is for FFh, but the method is the same, just add the 1000's part.

Look at Pommie's post

[

Thanks Eric I will indeed take a look at that. As it happens, dividing by 10 wasn't an issue for my particular application but I always like to find more efficient solutions to problems

Brian

#### mic5

##### Member
Thanks for the new ideas!

May any one send the circuit to display any character on lcd screen without using microcontroller?

#### Nigel Goodwin

##### Super Moderator
Thanks for the new ideas!

May any one send the circuit to display any character on lcd screen without using microcontroller?

Silly idea, you need a processor - end of story.

You could connect it to a PC and do it that way, but it's a bit of overkill.

#### Brian Hoskins

##### New Member
Silly idea, you need a processor - end of story.

Nigel - I suggested connecting the LCD up on breadboard without a Microcontroller purely as a learning exercise. It would give an appreciation for how an LCD works. You would need a processor to implement a useful display, of course.

Brian

#### Nigel Goodwin

##### Super Moderator
Nigel - I suggested connecting the LCD up on breadboard without a Microcontroller purely as a learning exercise. It would give an appreciation for how an LCD works. You would need a processor to implement a useful display, of course.

Exactly, you can't 'use' it without a processor, if you just want to manually 'play' with one, then full details are in the excellent EPE LCD tutorial articles available on their website.

I see the links you provided are actually copies of those.

Status
Not open for further replies.

Replies
27
Views
3K
Replies
6
Views
3K
Replies
11
Views
5K
Replies
18
Views
27K
Replies
8
Views
32K