Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/19/02 09:23
Read: times


 
#29357 - RE: 4 bit LCD initialisation
Hi all,
My codes look like this:



WATCHDOG EQU 80h
LCD_DataPort EQU P0
LCD_DB4 BIT P0.4
LCD_DB5 BIT P0.5
LCD_DB6 BIT P0.6
LCD_DB7 BIT P0.7
LCD_RS BIT P2.0
LCD_EN BIT P2.1
LCD_RW BIT P2.2

ORG 00h ; Reset
ACALL MAIN

Dly1ms: PUSH A MOV A,R0 MOV R0,#0
Dly1ms1: DJNZ R0,Dly1ms1
Dly1ms2: DJNZ R0,Dly1ms2
Dly1ms3: DJNZ R0,Dly1ms3
Dly1ms4: DJNZ R0,Dly1ms4
MOV R0,A
POP A
RET

Dly10ms: PUSH A
MOV A,#10
Dly10ms1: ACALL Dly1ms
DJNZ A,Dly10ms1
POP A
RET

Dly2s: PUSH A
MOV A,#2000
Dly2s1: ACALL Dly1ms
DJNZ A,Dly2s1
POP A
RET

Toggle_EN: SETB LCD_EN ACALL Dly10ms
CLR LCD_EN
ACALL Dly10ms
RET

Instr_Write: CLR LCD_RS
CLR LCD_RW MOV LCD_DataPort,A ACALL Toggle_EN ACALL Chk_BF RET

Chk_BF: CLR LCD_RS SETB LCD_RW CLR LCD_EN SETB LCD_DB7
LB1: CLR LCD_EN SETB LCD_EN JB LCD_DB7,LB1 CLR LCD_EN CLR LCD_RW RET

Unlock_LCD: CLR LCD_RS CLR LCD_RW MOV LCD_DataPort,#030h
ACALL Toggle_EN
ACALL Dly10ms MOV LCD_DataPort,#030h ACALL Toggle_EN
ACALL Dly10ms MOV LCD_DataPort,#030h ACALL Toggle_EN
RET
LCD_Init: ACALL Dly2s ACALL Unlock_LCD MOV LCD_DataPort,#020h ACALL Toggle_EN
ACALL Dly10ms
MOV A,#080h ACALL Instr_Write MOV A,#000h ACALL Instr_Write MOV A,#080h ACALL Instr_Write MOV A,#000h ACALL Instr_Write MOV A,#010h ACALL Instr_Write MOV A,#000h ACALL Instr_Write MOV A,#060h ACALL Instr_Write RET

MAIN: ACALL LCD_Init RET

After downloading these codes over, the LCD just show a line of blocks...hang I suppose. Anyone can help? thanks in advance

List of 17 messages in thread
TopicAuthorDate
4 bit LCD initialisation            01/01/70 00:00      
RE: 4 bit LCD initialisation            01/01/70 00:00      
RE: 4 bit LCD initialisation            01/01/70 00:00      
RE: 4 bit LCD initialisation            01/01/70 00:00      
RE: 4 bit LCD initialisation            01/01/70 00:00      
RE: 4 bit LCD initialisation            01/01/70 00:00      
RE: 4 bit LCD initialisation            01/01/70 00:00      
RE: 4 bit LCD initialisation            01/01/70 00:00      
RE: 4 bit LCD initialisation            01/01/70 00:00      
RE: 4 bit LCD initialisation / Peter            01/01/70 00:00      
RE: 4 bit LCD initialisation / Peter            01/01/70 00:00      
RE: 4 bit LCD initialisation / Peter            01/01/70 00:00      
RE: 4 bit LCD initialisation / Peter            01/01/70 00:00      
RE: 4 bit LCD initialisation / Peter            01/01/70 00:00      
   RE: 4 bit LCD initialisation / Peter            01/01/70 00:00      
RE: 4 bit LCD initialisation            01/01/70 00:00      
RE: 4 bit LCD initialisation : My C code            01/01/70 00:00      

Back to Subject List