We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all.. Im quite new to 8051. Im doing a project that requires me to display value of a peak voltage on a LCD.
Anyway, Im stuck in testing the LCD. I have connected the LCD(Powertip PC 0802-A), otherwise known as 214-3288, to my 8051 development kit. The kit that im using is C8051F206-TB. I connected databus 0-7 to port 3 and RS to P2.4, R/W to P2.5, and EN to P2.6
I also have gone online to source for programs to display "Hello World" on the LCD. I have found a few in C or asm, but i have learnt the basic of assembly language, so i don't really understand C language.
Below is a program i found in 8052.com
$include (c8051f200.inc) CSEG AT 0000H LJMP MAIN CSEG AT 0100H MAIN:LCALL CONFIG LCALL INIT_LCD LCALL CLEAR_LCD LCALL HELLO CONFIG:MOV PRT0MX, #000H ; PRT0MX: Initial Reset Value MOV PRT1MX, #000H ; PRT1MX: Initial Reset Value MOV PRT2MX, #000H ; PRT2MX: Initial Reset Value MOV P2MODE, #0FFH ; Input Configuration for P2 MOV PRT3CF, #0FFH ; Output configuration for P3 INIT_LCD: CLR P2.4 MOV P3,#38H SETB P2.6 CLR P2.6 LCALL WAIT_LCD CLR P2.4 MOV P3,#0EH SETB P2.6 CLR P2.6 LCALL WAIT_LCD CLR P2.4 MOV P3,#06H SETB P2.6 CLR P2.6 LCALL WAIT_LCD RET HELLO: LCALL INIT_LCD LCALL CLEAR_LCD MOV A,#48H LCALL WRITE_TEXT MOV A,#45H LCALL WRITE_TEXT MOV A,#4CH LCALL WRITE_TEXT MOV A,#4CH LCALL WRITE_TEXT MOV A,#4FH LCALL WRITE_TEXT CLR P2.4 MOV P3,#0CAH SETB P2.6 CLR P2.6 LCALL WRITE_TEXT MOV A,#57H LCALL WRITE_TEXT MOV A,#4FH LCALL WRITE_TEXT MOV A,#52H LCALL WRITE_TEXT MOV A,#4CH LCALL WRITE_TEXT MOV A,#44H LCALL WRITE_TEXT WAIT_LCD: CLR P2.6 ;Start LCD command CLR P2.4 ;It's a command SETB P2.5 ;It's a read command MOV P3,#0FFH ;Set all pins to FF initially SETB P2.6 ;Clock out command to LCD MOV A,P3 ;Read the return value JB ACC.7,WAIT_LCD CLR P2.6 ;Finish the command CLR P2.5 ;Turn off RW for future commands RET CLEAR_LCD:CLR P2.4 MOV P3,#01H SETB P2.6 CLR P2.6 LCALL WAIT_LCD RET WRITE_TEXT:SETB P2.4 MOV P3,A SETB P2.6 CLR P2.6 LCALL WAIT_LCD RET END
You do not need any delay function. The required delays are very, very short. Most often, the required delays are shorter than the max speed the CPU can toggle signals. However, you have to make sure.
The timing sequences shows in which order different signals should be toggled to make sure that all required signals have correct values when they are needed.
If I show you a paper, and then remove it again and ask you to read it, you would not be able to. When you tell the display to read a value (when you write to the display), that value must already be available for the display to read. The value you write to the display (requests the display to read) must continue to be available until a while after you stop telling the display to read it.
All such requirements are graphically displayed in the data sheet, as timing or sequence diagrams. They show when a specific signal may take any value, when it must be low and when it must be high.
Well, in my datasheet, there is 2 diagrams, one for write operation and one for read operation. But i do not understand these diagrams. You might want to go this website: docs-asia.electrocomponents.com/.../0900766b800b986e.pdf
as this is where i Downloaded timing datasheet.
"in my datasheet, there is 2 diagrams, one for write operation and one for read operation. But i do not understand these diagrams"
The Write diagram is showing:
1. The first thing that must happen is that R/W must either already be low, or be taken low, and RS must have reached its steady state for the operation
2. A time tAS must then elapse before E reaches its high-level threshold, VIH1
3. The time that it takes E to rise from its low-level threshold, VIL1, to VIH1 is called its rise-time and is specified by tEr
4. E must remain high for a time tDSW after the Data lines DB0~DB7 stabilise to valid levels
5. The Data line must remain valid for a time tH after E falls below VIL1
etc