McMurry
Member level 3
; i have set RB7:RB4 for D74
and RS RB1
RW RB2
EN RB3
using general PIC.
;but it just come out as 2 rows of black blocks
;jhd162a is the lcd module i am using.
;i have read some tutorials on 4 bit config, that it unfortunately makes me confused a lot. can someone point out any of my mistake? thanks.
; all the what pin EQU pin no goes here...
ORG 0x00
BSF STATUS,RP0
CLRF TRISB
CLRF TRISA
BCF STATUS,RP0
CALL DELAY
;send init value 0x38
MOVLW 0x38
BCF PORTB, RS
BCF PORTB, RW
MOVWF PORTB
BCF PORTB, EN
CALL DELAY
;send init value 0x38
MOVLW 0x38
BCF PORTB, RS
BCF PORTB, RW
MOVWF PORTB
BCF PORTB, EN
CALL DELAY
;send init value 0x38
MOVLW 0x38
BCF PORTB, RS
BCF PORTB, RW
MOVWF PORTB
BCF PORTB, EN
CALL DELAY
;send init value 0x28
MOVLW 0x28
BCF PORTB, RS
BCF PORTB, RW
MOVWF PORTB
BCF PORTB, EN
CALL DELAY
MOVLW 0x43
MOVWF TEMP
MOVF TEMP, 0
SWAPF W, 0
ANDLW 0xF0
BSF PORTB, EN
BCF PORTB, RW
BCF PORTB, EN
MOVWF PORTB
BCF PORTB, EN
MOVF TEMP, 0
ANDLW 0xF0
BSF PORTB, EN
BCF PORTB, RW
BCF PORTB, RS
MOVWF PORTB
BCF PORTB, EN
CALL DELAY
LOOP GOTO LOOP
DELAY MOVLW D'255'
MOVWF D1 ;D1=4 for 1ms
COUNT MOVLW D'255'
MOVWF D2
COUNT1 DECFSZ D2, 1
GOTO COUNT1
DECFSZ D1, 1
GOTO COUNT
RETURN
END
and RS RB1
RW RB2
EN RB3
using general PIC.
;but it just come out as 2 rows of black blocks
;jhd162a is the lcd module i am using.
;i have read some tutorials on 4 bit config, that it unfortunately makes me confused a lot. can someone point out any of my mistake? thanks.
; all the what pin EQU pin no goes here...
ORG 0x00
BSF STATUS,RP0
CLRF TRISB
CLRF TRISA
BCF STATUS,RP0
CALL DELAY
;send init value 0x38
MOVLW 0x38
BCF PORTB, RS
BCF PORTB, RW
MOVWF PORTB
BCF PORTB, EN
CALL DELAY
;send init value 0x38
MOVLW 0x38
BCF PORTB, RS
BCF PORTB, RW
MOVWF PORTB
BCF PORTB, EN
CALL DELAY
;send init value 0x38
MOVLW 0x38
BCF PORTB, RS
BCF PORTB, RW
MOVWF PORTB
BCF PORTB, EN
CALL DELAY
;send init value 0x28
MOVLW 0x28
BCF PORTB, RS
BCF PORTB, RW
MOVWF PORTB
BCF PORTB, EN
CALL DELAY
MOVLW 0x43
MOVWF TEMP
MOVF TEMP, 0
SWAPF W, 0
ANDLW 0xF0
BSF PORTB, EN
BCF PORTB, RW
BCF PORTB, EN
MOVWF PORTB
BCF PORTB, EN
MOVF TEMP, 0
ANDLW 0xF0
BSF PORTB, EN
BCF PORTB, RW
BCF PORTB, RS
MOVWF PORTB
BCF PORTB, EN
CALL DELAY
LOOP GOTO LOOP
DELAY MOVLW D'255'
MOVWF D1 ;D1=4 for 1ms
COUNT MOVLW D'255'
MOVWF D2
COUNT1 DECFSZ D2, 1
GOTO COUNT1
DECFSZ D1, 1
GOTO COUNT
RETURN
END