Chip: 16F1829 Language: MPASM Display: generic HD44780U controller
I've been wrestling with this $2 display for 2 days. It works in 4-bit mode. I wanted to try 8-bit mode. Here is what the screen looks like:
I can add delays and get one line to fill before the other, but it appears as if all 16 characters are written simultaneously or with a very fast scroll.
Here is the code after POR:
I have not removed all of the comments in the code. I have tried longer delays on pulsing E without effect. Also the original version wrote to LATx and I changed to PORTx in desperation. All of the command functions are to PORTA/LATA . PORTC/LATC outputs to data bits D0-D7. D/W is grounded. No reads of busy.
The comment "step" refers to initialization steps listed here: **broken link removed**
They are the same as in the Hitachi datasheet, except for a little more explanation.
Any ideas on how to turn off the simultaneous writing to each position?
John
I've been wrestling with this $2 display for 2 days. It works in 4-bit mode. I wanted to try 8-bit mode. Here is what the screen looks like:
I can add delays and get one line to fill before the other, but it appears as if all 16 characters are written simultaneously or with a very fast scroll.
Here is the code after POR:
Code:
movlw 0x38 ;step 5 0x38=8-bit, 2 lines, 5X8 font
call PutCmd ;0x30=8-bit, 1 line, 5X8
DelayCy (100*usecs)
movlw 0x08 ;step 6 0x0E turns on display and cursor
call PutCmd ;0x0C turns on display no cursor
DelayCy (100*usecs)
movlw 0x01 ;step 7
call PutCmd
DelayCy (4*msecs)
movlw 0x06 ;step 8 entry mode set increment and shift cursor to right
call PutCmd
DelayCy (100*usecs) ;execution t=37 us
movlw 0x0C ;step 10
call PutCmd
DelayCy (100*usecs)
movlw 0x10 ;no effect
call PutCmd
DelayCy (100*usecs)
Main
Test
; movlw 0x20 ;0x84 causes blink, as does 0x20
; call PutDat
; DelayCy (150*msecs)
; DelayCy (150*msecs)
; movlw 0x80 ;from working4-bit
; call PutCmd
; DelayCy (100*usecs)
movlw '0'
call PutDat
DelayCy (150*msecs)
movlw '1'
call PutDat
DelayCy (150*msecs)
movlw '2'
call PutDat
DelayCy (150*msecs)
movlw '3'
call PutDat
DelayCy (150*msecs)
movlw '4'
call PutDat
DelayCy (150*msecs)
DelayCy (150*msecs)
DelayCy (150*msecs)
DelayCy (150*msecs)
bra Test
; goto $-1
PutCmd
bcf RS ;RS=0 for Cmd
bra $+2
PutDat
bsf RS ;RS=1 for Dat
movwf PORTC ;LATC
bsf E ;is a 37 usec delay needed?
;DelayCy (5*usecs) ;seems to work w/o
nop
bcf E
return
I have not removed all of the comments in the code. I have tried longer delays on pulsing E without effect. Also the original version wrote to LATx and I changed to PORTx in desperation. All of the command functions are to PORTA/LATA . PORTC/LATC outputs to data bits D0-D7. D/W is grounded. No reads of busy.
The comment "step" refers to initialization steps listed here: **broken link removed**
They are the same as in the Hitachi datasheet, except for a little more explanation.
Any ideas on how to turn off the simultaneous writing to each position?
John
Last edited: