Looking for info - functions built-into PBP3 for controlling HD44780 displays?


+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2007
    Posts
    78

    Default 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

  2. #2

    Default 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.
    George

  3. #3
    Join Date
    Sep 2009
    Posts
    713

    Default 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.
    Last edited by pedja089; - 1st January 2021 at 10:27.

  4. #4
    Join Date
    Jan 2007
    Posts
    78

    Default Re: Looking for info - functions built-into PBP3 for controlling HD44780 displays?

    Wonderful!
    Thank you very much!

Similar Threads

  1. String types and functions AND Functions with arguments
    By PickyBiker in forum PBP Wish List
    Replies: 3
    Last Post: - 1st January 2015, 09:00
  2. Usage of built-in DAC ?
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 16th December 2014, 05:59
  3. Anybody built one of these yet?
    By Byte_Butcher in forum Off Topic
    Replies: 1
    Last Post: - 21st April 2010, 16:44
  4. Using PWM built in Module 16F628
    By earltyso in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 9th October 2007, 06:40
  5. how to built a device that can be interface using sms?
    By fazan83 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 21st January 2007, 02:23

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts