serial LCD 1602 Backpack using PIC16F690 for Hitach HD44780


Results 1 to 40 of 60

Threaded View

  1. #21
    Join Date
    May 2013
    Location
    australia
    Posts
    2,722


    Did you find this post helpful? Yes | No

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

    for my money i would let pbp do all the heavy lifting and leverage their nice efficent routines like this

    works for 4 or 8 bit mode and all
    Code:
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '
    'Name  : 16F690 LCD BACKPACK
    ' Date  : oct 2025    richard
    ' Note  : 300 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        
        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
         
        CLEAR
        DEFINE LCD_BITS 8     'defines the number of data interface lines (4 or 8) 
        DEFINE LCD_DREG PORTC    'defines the port where data lines are connected to
        DEFINE LCD_RSREG PORTB    'defines the port where RS line is connected to
        DEFINE LCD_RSBIT 6     'defines the pin where RS line is connected to 
        DEFINE LCD_EREG PORTB     'defines the port where E line is connected to 
        DEFINE LCD_EBIT 4     'defines the pin where E line is connected 
        DEFINE LCD_COMMANDUS 1500     'defines the delay after LCDOUT statement 
        DEFINE LCD_DATAUS 50         'delay in micro seconds
    
    
        B1 var byte 
        Bl var byte 
    
    
    ' 300=3313  600=1646  1200=813  2400=396  4800=188  9600=84  19200=32
        BaudR var byte : baudr = 32 
        
        TRISC = 0 
        TRISA = % 11111110 
        OSCCON = $70
      
    
    
        PAUSE 500
        Porta.0 = 1    ' Backlight ON
        
        LCDOUT $FE,1
    '    LCDOUT "ready @19200"
    @  bsf   LCD_RSREG ,LCD_RSBIT
    
    
    
    
    
    
    main:
       serin2 Portb.5,baudr,3,main,[b1]
       if bl then
            if b1 = 0 then 
                 porta.0 = 0  ' Back Light OFF
            endif
            if b1 = 8 then 
                 porta.0 = 1 ' Back Light ON
            endif
            bl = 0
            goto main
       endif
       if b1 = 255 then 
             bl = 1
             goto main
       endif
       if b1 = 254 then
    @  bcf   LCD_RSREG ,LCD_RSBIT
             goto main 
       endif 
    @  MOVE?BB _B1,R3
    @  L?CALL lcdsend
    @  bsf   LCD_RSREG ,LCD_RSBIT
    goto main             ' loop back to top
    ps forgot to add it is now so easy to add a flash screen on boot
    Last edited by richard; - 3rd October 2025 at 11:16.
    Warning I'm not a teacher

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 : 16

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