Maximun Cable Length for PIC to LCD


Closed Thread
Results 1 to 40 of 53

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Ontario Canada
    Posts
    30


    Did you find this post helpful? Yes | No

    Default

    That's a good laugh. I thought someone would have that reply.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by wildbilly
    Darrel I have installed the Highjack routines and also included the LCD_Anypin.pbp and VirtualPort.bas in the PBP folder. I then added the Include file in my main program just below the define Parameters.
    Excellent!

    Does your main program have this section (modified for your hardware of course).
    The old lcd DEFINES can be commented out.
    Code:
    ;----[ Change these to match your LCD ]---------------------------------------
    </i></b></font><b>LCD_DB4   </b><font color="#008000"><b>VAR </b></font><b>PORTA</b>.<font color="#800000"><b>0
    </b></font><b>LCD_DB5   </b><font color="#008000"><b>VAR </b></font><b>PORTB</b>.<font color="#800000"><b>3
    </b></font><b>LCD_DB6   </b><font color="#008000"><b>VAR </b></font><b>PORTB</b>.<font color="#800000"><b>7
    </b></font><b>LCD_DB7   </b><font color="#008000"><b>VAR </b></font><b>PORTC</b>.<font color="#800000"><b>1
    </b></font><b>LCD_RS    </b><font color="#008000"><b>VAR </b></font><b>PORTD</b>.<font color="#800000"><b>4
    </b></font><b>LCD_E     </b><font color="#008000"><b>VAR </b></font><b>PORTA</b>.<font color="#800000"><b>1
    </b></font><b>LCD_Lines     </b><font color="#008000"><b>CON </b></font><font color="#800000"><b>2    </b></font><font color="#0000FF"><b><i>' # of Lines on LCD,  1 or 2 (Note: use 2 for 4 lines)
    </i></b></font><b>LCD_DATAUS    </b><font color="#008000"><b>CON </b></font><font color="#800000"><b>50   </b></font><font color="#0000FF"><b><i>' Data delay time in us 
    </i></b></font><b>LCD_COMMANDUS </b><font color="#008000"><b>CON </b></font><font color="#800000"><b>2000 </b></font><font color="#0000FF"><b><i>' Command delay time in us 
    
    </i></b></font><font color="#008000"><b>INCLUDE </b></font><font color="#FF0000">&quot;LCD_AnyPin.pbp&quot;  </font><font color="#0000FF"><b><i>; *** Include MUST be AFTER LCD Pin assignments ****</i></b></font>
    DT

  3. #3
    Join Date
    Nov 2005
    Location
    Ontario Canada
    Posts
    30


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel. I added the list below and no longer have the error but no longer have a display on
    the LCD. I only have two black bars.

    'LCD_DB4 VAR PORTB.0
    'LCD_DB5 VAR PORTB.1
    'LCD_DB6 VAR PORTB.2
    'LCD_DB7 VAR PORTB.3
    'LCD_RS VAR PORTB.4
    'LCD_E VAR PORTB.7

    The list below works fine.

    'LCD Parameters
    '============
    DEFINE LCD_DREG PORTB ' LCD Data port
    DEFINE LCD_DBIT 0 ' starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTB ' LCD Register Select port
    DEFINE LCD_RSBIT 4 ' LCD Register Select bit
    DEFINE LCD_EREG PORTB ' LCD Enable port
    DEFINE LCD_EBIT 7 ' LCD Enable bit
    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

    My LCD is connected just like your example " http://www.pbpgroup.com/files/2_LCDs.gif

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Bummer,

    OK, let me re-create it here.
    Back at ya soon.
    <br>
    DT

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    OK,

    Just to make sure, I went thru the steps again myself.
    Have it working here on a 16F88. One thing I had to add that wasn't mentioned here, although it was in the other thread ...
    Code:
    PAUSE 500 : LCDOUT $FE,1 : PAUSE 250 ; Initialize LCD (You may not need this,
                                         ;  but some displays are picky)
    But so that I can compare Apples to Apples, What PIC are you using?

    I bought 25ft of ribbon today, just to make sure. But haven't hooked it up yet.
    DT

  6. #6
    Join Date
    Nov 2005
    Location
    Ontario Canada
    Posts
    30


    Did you find this post helpful? Yes | No

    Default

    I added the code
    PAUSE 500 : LCDOUT $FE,1 : PAUSE 250 ; Initialize LCD
    with the same result. I am using the 16F877a

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Apples it is ..

    Built a 16F877A breadboard. With LCD on the above mentioned ports.
    Still haven't hooked up the ribbon yet, just wanted 1 LCD at this point.

    Here's the Breadboard.

    Click image to enlarge

    And here's the program it's running.
    Code:
    @  __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
    
    ADCON1 = 7
    CMCON = 7
    
    DEFINE OSC 4
    
    ;----[ Change these to match your LCD ]---------------------------------------
    LCD_DB4   VAR PORTB.0
    LCD_DB5   VAR PORTB.1
    LCD_DB6   VAR PORTB.2
    LCD_DB7   VAR PORTB.3
    LCD_RS    VAR PORTB.4
    LCD_E     VAR PORTB.7
    LCD_Lines     CON 2    ' # of Lines on LCD,  1 or 2 (Note: use 2 for 4 lines)
    LCD_DATAUS    CON 50   ' Data delay time in us 
    LCD_COMMANDUS CON 2000 ' Command delay time in us 
    
    INCLUDE "LCD_AnyPin.pbp"  ; *** Include MUST be AFTER LCD Pin assignments ****
    
    PAUSE 500 : LCDOUT $FE,1 : PAUSE 250 ; Initialize LCD (You may not need this,
                                         ;  but some displays are picky)
    
    LCDOUT $FE,1,"Hello wildbilly",$FE,$C0,"Must be something",$FE,$94,"In the Hardware"
    
    Main:
    ;    toggle LED
        pause 1000
    goto Main
    Can you see anything I've done different??
    <br>
    DT

Similar Threads

  1. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  2. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  3. DS1820 Max Cable length ?
    By dccch in forum General
    Replies: 2
    Last Post: - 24th January 2008, 07:44
  4. Measure cable length with a PIC?
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th July 2007, 18:45
  5. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07

Members who have read this thread : 0

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