LCD code makes no sense


Closed Thread
Results 1 to 3 of 3
  1. #1

    Default LCD code makes no sense

    Here is a page that has code to run the LCD with PBP. I have no experince with LCDOUT so looking for decent tutorials (aren't any really).

    http://melabs.com/samples/PBP-mixed/lcd.htm


    Huh ? !

    It has a lot of references in comments to the LCD connections but nothing in the main code. ? I haven't tested it because it doesn't make any sense.
    What if I wanted to use different ports etc.

    Where is there a decent tutorial on LCDOUT ? The Picbasic manual also is rather vague.

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Makes no sense

    Nevermind. Got it now.

    Didn't know it actually has default pins for LCDOUT.

  3. #3
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Makes no sense

    Code:
    ' LCD should be connected as follows:
    12
    ' LCD   PIC
    13
    ' DB4   PortA.0
    14
    ' DB5   PortA.1
    15
    ' DB6   PortA.2
    16
    ' DB7   PortA.3
    17
    ' RS    PortA.4 (add 4.7K pullup resistor to 5 volts)
    18
    ' E     PortB.3
    19
    ' RW    Ground
    20
    ' Vdd   5 volts
    21
    ' Vss   Ground
    22
    ' Vo    20K potentiometer (or ground)
    23
    ' DB0-3 No connect

    The comments give you a clue as to how to connect the LCD !

    You don't have to use "dedicated" pins, but you do need to define what pins you use for the connections

    This works with an LCD connected to port B

    Code:
    '*******************************************************************************
    ' LCD (20 x 4) set up 
    '*******************************************************************************
    
    DEFINE LCD_DREG  PORTB                  ' LCD Data port
    DEFINE LCD_DBIT  0                      ' starting Data bit (0 or 4)
    DEFINE LCD_EREG  PORTB                  ' LCD Enable port
    DEFINE LCD_EBIT  5                      '     Enable bit  (on EasyPIC 5 LCD)
    DEFINE LCD_RSREG PORTB                  ' LCD Register Select port
    DEFINE LCD_RSBIT 4                      '     Register Select bit   (on EasyPIC 5 LCD)
    DEFINE LCD_BITS  4                      ' LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 4                      ' number of lines on LCD
    DEFINE LCD_COMMANDUS 2000               ' Command delay time in us 
    DEFINE LCD_DATAUS 50                    ' Data delay time in us

Similar Threads

  1. Sequence of statements makes code work differently. (PIC16F628A)
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th October 2016, 11:35
  2. Need help setting up Capacitive Sense 12F1822
    By Heckler in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 29th November 2013, 21:10
  3. Help understanding Current Sense MOSFET
    By Tobias in forum General
    Replies: 5
    Last Post: - 6th August 2012, 07:31
  4. SOUND makes LCD quit working
    By jderson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th April 2008, 14:12
  5. Help Make Sense of QT510 SPI Protocol
    By GCollier in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th January 2006, 04:00

Members who have read this thread : 1

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