Looking for info - functions built-into PBP3 for controlling HD44780 displays?
Hello All,
The HD44780 lcd display can run in 8-bit or 4-bit mode.
It has to receive about a dozen commands at start-up to configure itself to run in 4-bit mode.
Within PBP3 - the LCD is initialized the first time any character or command is sent to it using LCDOUT
This is a huge convenience feature!
But it means that those dozen or so commands that set the lcd into 4-bit mode happen when PBP3 sees the first LCDOUT command in your code.
My first time running an LCD I noticed right up front that there is no .h file that is being included.
So I understood immediately that the developers of PBP3 built this in as default functionality.
If its possible, I'd like to see the code that performs these behind the scene functions.
Is there I file within PBP3 that I look at to find these?
Or is this a black-box situation?
Sincere thanks
dw
Re: Looking for info - functions built-into PBP3 for controlling HD44780 displays?
I'm pretty sure it's part of the compiler. The manual for the 44780 shows the string to send to get into the various modes.
Re: Looking for info - functions built-into PBP3 for controlling HD44780 displays?
Yes there is file. You can edit it. There is example on forum cale LCD-AnyPIn, or something like that. But always have backup if you edit it.
You can find it in few places.
in PBP3 instalation folder there is few files .lib.
eg
pbppi14e.lib
Files correspond to PIC family.
For LCD look in that file for
Code:
btfsc LCDINITFLAG ; Has lcd been inititalized?
goto lcdout1 ; Yes
movlw 15100 >> 8 ; Wait at least 15ms
movwf R0 + 1
movlw low 15100
call PAUSEUSL
movlw 33h ; Init lcd
movwf R3 ; Save char
call lcdloop ; Send init
movlw 4200 >> 8 ; Wait at least 4.1ms
movwf R0 + 1
movlw low 4200
call PAUSEUSL
call lcdloop ; Send init (33) again
movlw 100 ; Wait at least 100us
call PAUSEUS
call lcdloop ; Send init (33) one more time
if ((LCD_BITS) == 8)
if ((LCD_LINES) == 1)
movlw 30h ; 8-bit mode, 1 line, 5x7 font
else
movlw 38h ; 8-bit mode, 2+ lines, 5x7 font
endif
else
movlw 22h ; Send init to 4-bit mode
movwf R3 ; Save character
call lcdloop ; Set interface to 4-bit mode
if ((LCD_LINES) == 1)
movlw 20h ; 4-bit mode, 1 line, 5x7 font
else
movlw 28h ; 4-bit mode, 2+ lines, 5x7 font
endif
endif
call lcdoutcom ; Send function set
movlw 0ch ; Display on, no cursor, no blink
call lcdoutcom
movlw 01h ; Display clear
call lcdoutcom
movlw 06h ; Lcd entry mode set, increment, no shift
call lcdoutcom
bsf LCDINITFLAG ; Set to initialized
movf R3 + 1, W ; Get saved char back (again)
goto lcdout1
lcdoutcom bsf LCDCDFLAG ; Set for command
everything between is LCD initialization.
In .lib files, there is bunch stuff that is optionally compiled. If you want to see just stuff that your code uses(there are again some optionally parts included) look for file .LST in your project folder.
And also search for same stuff as in lib. And you will se what PBP is doing in background.
Re: Looking for info - functions built-into PBP3 for controlling HD44780 displays?
Wonderful!
Thank you very much!