serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780


+ Reply to Thread
Results 1 to 21 of 21
  1. #1
    Join Date
    Jan 2022
    Posts
    56

    Default serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    Hello everyone,

    I'de like to share this project, may come handy for hobbyist working around LCD display.

    My search for a serial LCD that can receive serial data from 300 to 19200 baud on the internet was not successful
    then I roll-up my sleeves and build this LCD backpack that use a common Hitachi HD44780 display. (still popular today)

    My project was simple with parts already on hand like PIC16F690, NPN smd transistor, potentiometer, resistor. and PBP3 Basic code.

    So enjoy,

    Code:
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Name  : 16F690 LCD BACKPACK
    ' Date  : Sep 27-2025
    ' Note  : 393 words used  of 2048
    ' Notes : Serin2 Baud Rate 300 ~ 19200 Intrc_OSC 8Mhz
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    #CONFIG
    cfg = _INTRC_OSC_NOCLKOUT 
    cfg&= _WDT_OFF
    cfg&= _PWRTE_OFF
    cfg&= _MCLRE_OFF
    cfg&= _CP_OFF
    cfg&= _CPD_OFF
    cfg&= _BOD_OFF
    cfg&= _IESO_OFF
    cfg&= _FCMEN_OFF
      __CONFIG cfg
    #ENDCONFIG
    DEFINE OSC 8        ' Core is running at EXT-CRYSTAL 16MHz PBP 33,217
    ANSEL = 0           ' Set all pins digital
    ANSELH = 0          ' Set all pins digital
    OPTION_REG.7 = 0    ' PORTA/PORTB pull-ups are enabled by individual port latch values
    CM1CON0 = 0         ' Analog comparators off
    
    
    En var Portb.4 : low en
    RS var Portb.6 : low rs
    B1 var byte : b1 = 0
    
    
    ' 300=3313  600=1646  1200=813  2400=396  4800=188  9600=84  19200=32
    BaudR var byte : baudr = 32 
    
    
    TRISA = 0 : TRISB = 100000 : TRISC = 0
    PORTA = 0 : PORTB = 0 : PORTC = 0
    OSCCON = $70  
    
    
    high Porta.0              ' Backlight ON
    
    
    gosub LCDinit             ' initialise LCD
    
    
    'Serin2
    main:
        serin2 Portb.5,baudr,3,main,[b1]
    
    
        if b1 < 253 then     ' Characters
            PORTC = b1 
            HIGH EN : PAUSEus 5 : LOW EN
            goto main        
        elseif b1 = 254 then  ' LCD Command
            low RS            
            serin2 Portb.5,baudr,3,main,[b1]
            PORTC = b1          ' output the data
            HIGH EN : PAUSEus 5 : LOW EN
            high RS           ' character mode
            goto main         
        elseif b1 = 255 then  
            low rs            ' LCD Command
    
    
        serin2 Portb.5,baudr,3,main,[b1]
            if b1 = 0 then 
                low porta.0   ' Back Light OFF
            high rs
            endif
            if b1 = 8 then 
                high porta.0  ' Back Light ON
            high rs    
            endif
           goto main             ' loop back to top
        ENDIF
    
    
    LCDINIT:                  ' Standard LCD Module Initialisation
    PORTC = 000001          ' 2, Clear Display
        HIGH EN : PAUSEus 300 : LOW EN ' Send data
        pause 4
    PORTC = 000010          ' 4, Return Home
        HIGH EN : PAUSEus 300 : LOW EN
        pause 4
    PORTC = 111000         ' 1, 8 bit, 2 line, 5x8 Characters
        HIGH EN : PAUSEus 300 : LOW EN
        pause 4
    ' PORTC = 001100          ' Display on, no cursor, no blink
    PORTC = 001110          ' 1, Display on, cursor, blink
        HIGH EN : PAUSEus 300 : LOW EN
        pause 4
    PORTC = 000110          ' 1, Entry mode
        HIGH EN : PAUSEus 300 : LOW EN
        pause 4
        high rs                  ' character mode
    RETURN

    Name:  DSC02371.JPG
Views: 42
Size:  89.9 KB


    Name:  DSC02372.JPG
Views: 40
Size:  103.3 KB

  2. #2
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    Here's an code update

    on the LCD backpack code the line

    BaudR var byte should be replace with: BaudR var Word

    and here's the serial sender code updated as well. (use an 12F683)

    Code:
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    'Project : 12F683 Serial LCD Test 300 ~ 19200 baud for 16F690 Lcd Backpack
    'Date    : Sep 27-2025
    'Notes   : 285 words used  of 2048                                             
    'Notes   : Serout2 300 ~ 19200  Intrc_OSC 8Mhz
    '300=3313  600=1646  1200=813  2400=396  4800=188  9600=84  19200=32 
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    #CONFIG
     __config  _INTOSCIO & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _BOD_OFF  & _CP_OFF & _CPD_OFF
    #ENDCONFIG
    DEFINE OSC 8           ' Core is running at EXT-CRYSTAL 16MHz PBP 33,217
    LCD Var GPIO.0         ' Serial out
    ANSEL = 0              ' Set all digital  PULLUP Resistor  page:10
    TRISIO = %00000000     ' INPUT=1 OUTPUT = 0
    OSCCON = $70           ' $70=8Mhz  $60=4mhz  $50=2MHZ  $40=1MHZ  $30=500KHZ   
    
    
    BaudR var word
    baudR = 32 ' 300=3313  600=1646  1200=813  2400=396  4800=188  9600=84  19200=32 
    Pace var byte          ' for serout2 
    pace = 0
    
    
    SEROUT2 lcd,baudR,pace,[ 254, 1] ' Clear LCD
    pause 40
    
    
    DO
    ' LCD 1602
        sEROUT2 lcd,baudR,pace,[254,128,"ABCDEFGHIJKLMNOP"] ' Line 1 16 Char.
        SEROUT2 lcd,baudR,pace,[254,192,"0123456789-=,./>"] ' Line 2 16 Char.
    
    
    ' LCD 2004
        'SEROUT2 lcd,BaudR,pace,[254,128,"ABCDEFGHIJkLMNOPQRST"] ' Line 1 20 Char.
        'SEROUT2 lcd,BaudR,pace,[254,192,"0123456789-=,./;!@#$"] ' Line 2 20 Char.
        'SEROUT2 lcd,BaudR,pace,[254,148,"ABCDEFGHIJkLMNOPQRST"] ' Line 3 20 Char.
        'SEROUT2 lcd,BaudR,pace,[254,212,"0123456789-=,./;!@#$"] ' Line 4 20 Char.
    
    
        PAUSE 2000
        SEROUT2 lcd,baudR,pace,[ 255, 0] ' Back Light OFF
        PAUSE 200    
        SEROUT2 lcd,baudR,pace,[ 255, 8] ' Back Light ON
        PAUSE 2000
     
        SEROUT2 lcd,baudR,pace,[ 254, 1] ' Clear LCD
        pause 1000
    LOOP
    END

  3. #3
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    final code update in "16F690 LCD BACKPACK"
    the low rs and high rs lines are not needed, since it control PortA.0 and not the HD44780 chip.


    elseif b1 = 255 then
    ' low rs ' LCD Command
    serin2 Portb.5,baudr,3,main,[b1]
    if b1 = 0 then
    low porta.0 ' Back Light OFF
    ' high rs
    endif
    if b1 = 8 then
    high porta.0 ' Back Light ON
    ' high rs
    endif
    Last edited by jackberg1; - 28th September 2025 at 19:27.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,156


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    Thanks for posting your project.

    But why not use the Hardware USART instead of the Software one?

    Ioannis

  5. #5
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    Hello Ioannis,

    good question,

    when I design the PCB I used the PortB.5 with a 20Mhz crystal with bigger pcb foot print 46x17mm
    then I decided to lower the parts count and the PCB foot print to a bare minimum (41 x 17mm)
    Also theses HD44780 are still in use by many hobbyist around the world, I guess, and the baud rate I was looking is plenty for this kind of display.

    thank's for asking.

    Name:  new PCB 41x17mm.jpg
Views: 25
Size:  64.6 KB



  6. #6
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    Hello,

    you're right
    my assumption was that software or hardware control serial communication are the same
    and one way or another I'll get the same result.

    if I may ask in this project what the benefit of hardware over software serial control.

    thank's again.

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,156


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    Less code usage. If for some reason you need Serin, it may hang if the device is not replying correctly. Hserin has timout and will save the day.

    For your project it may not have any meaning, but I think it is good practice to use as much as you can the hardware features than the emulated software.

    Ioannis
    Last edited by Ioannis; - 30th September 2025 at 13:31.

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,661


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    if I may ask in this project what the benefit of hardware over software serial control.
    doubtful there is any since the 690 does nothing else anyway and the lcd's speed is the real bottle neck
    Warning I'm not a teacher

  9. #9
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    I aggree on both comment, Hserin is more convenient than Serin2

    the goal of this project was to learn base on inexpensive parts on-hand

    you can strech the total cost for less than $12 pcb included not bad for an hobbyist who's looking to add a simple but pratical alphanumeric display

    I really appreciate comments

    btw , what is happening with MELab Forum, is it close for good.
    Last edited by jackberg1; Yesterday at 01:01.

  10. #10
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,156


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    The Melabs Forum is(was?) supported by the company itself. So little is known as to what is happening.

    The company does not really have a future.

    Some of us here are also dinosaures and reluctant to switch to C or other platforms. So we stay and try to support its operation, as long as our host, honorable Lester, allows this forum to live.

    Ioannis

  11. #11
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    very kind of you to reply,

    Roughly 12 years ago, I started learning Basic Pic programming with Picaxe, then GCBasic
    now I'm mostly using MELab PBP Pro, and Positron both are like twin of Pic Basic compiler.

    my guess is these IDE Compilers are the last ones on the market, now the current trend is
    with Arduino, Python etc..

    if I may ask,

    are you aware of any good sources on how,
    to learn asm, and understand the asm files structure, to write assembler code, compile it and to download to a PIC

    regards.

  12. #12
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,156


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    What is the use of learning ASM when C is better with great support and portable too?

    I think it is a waste of time if you choose ASM. Also you have to deal with pages, Banks and will be very much difficult to keep your mind checking all the time if your code has to change banks, pages etc in order to access registers correctly.

    But if you insist on diving in the deep dark waters of ASM, then I guess Microchip is the first to think. But these video tutorials also help https://www.youtube.com/@IESD2013

    Ioannis

  13. #13
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    thanks for the advice, it's helping what to consider.

  14. #14
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    as for C is considered, which IDE/Compiler you use or recommend

  15. #15
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    quick update for the Backpack code: High RS line should be remove to avoid random character on screen when booting.

    PORTC = %00000110 : High En : DelayUS 1 : Low En : DelayMS 1 ' Entry mode
    ' High RS
    Return

  16. #16
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    correct order for display control

    PORTC = %00001110 ' %00001DCB Display on/off, cursor on/off, blink y/n

  17. #17
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,156


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    Regarding C, MPLABX is the one to try and sure the last. It includes also the MCC tool to setup any microcontroller with ease.

    Tried a couple of times C but i guess i am too old to change ...

    Ioannis

  18. #18
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    I did try MPLAB X a year ago and it's was a bitter chalenge comparing to what I'm used to do with PBP3,Picaxe, Positron

  19. #19
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    Oct 2 2025

    update on 16F690 Backpack, new LCDINT pause to accomodate 28800,38400 baud rate for (Xtal = 20Mhz)

    #CONFIG
    __config _HS_OSC & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOD_OFF & _IESO_OFF & _FCMEN_OFF
    #ENDCONFIG

    LCDINIT: ' Standard LCD Module Initialisation
    PORTC = %00000001 : HIGH EN : PAUSEus 1 : LOW EN : pause 4 ' Clear Display
    PORTC = %00000010 : HIGH EN : PAUSEus 1 : LOW EN : pause 2 ' Return Home
    PORTC = %00111000 : HIGH EN : PAUSEus 1 : LOW EN : Pause 2 ' 8 bit, 2 line, 5x8 Characters
    PORTC = %00000110 : HIGH EN : PAUSEus 1 : LOW EN : Pause 2 ' Entry mode
    PORTC = %00001110 : HIGH EN : PAUSEus 1 : LOW EN : Pause 2 ' %00001DCB Display on/off, Cursor on/off, Blink y/n
    RETURN

  20. #20
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,156


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    Agree that MPLABX is a bit scarry but has all the tools to complete a task regarding C at least.

    You have MCC, Simulator, breakpoints etc. Basic does not give all these goodies.

    As for your LCD driver, I think it is a little bit dependant on the specific LCD characteristics. Some are slow and some are a bit faster, so user has take that into account.

    Ioannis

  21. #21
    Join Date
    Jan 2022
    Posts
    56


    Did you find this post helpful? Yes | No

    Default Re: serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780

    totally agree, the LCD is kind of an old tech, but for an hobbyist it's a good learning tool.

    to clarify the baud rate turn around, just include this chart to figure it out.

    with each OSC setup, it can manage baud rate from 300 ~ 38400.


    Name:  Baud Rate Chart.jpg
Views: 3
Size:  57.6 KB

Similar Threads

  1. Using 16F1503 as Serial LCD Backpack
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th March 2015, 19:58
  2. 16F877A and LCD HD44780
    By epilot in forum mel PIC BASIC Pro
    Replies: 38
    Last Post: - 1st November 2013, 18:17
  3. FREE Serial LCD Backpack Board
    By rmteo in forum Off Topic
    Replies: 36
    Last Post: - 29th July 2010, 02:32
  4. Lcd Hd44780
    By alaaodeh in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 6th February 2007, 14:04
  5. LCD 4x20 HD44780
    By inteco in forum mel PIC BASIC
    Replies: 13
    Last Post: - 27th June 2006, 16:52

Members who have read this thread : 7

You do not have permission to view the list of names.

Posting Permissions

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