LCDOUT custom commands - how to?


Closed Thread
Results 1 to 40 of 69

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    Did you find this post helpful? Yes | No

    Default Code

    I'm still not sure how to connect the datalines from the display to the PIC (is it DB0 = D7 and so on or is it DB0 = D4 and so on).

    Here is my code:
    Code:
    'PIC 16F88
    
    ' LCD circuitery
    '23,24,25,26,32,33,34,35,40 - Vdd (+5V)
    '27,38  - Vss (GND)
    '28 DB0 - PORTA.0
    '29 DB1 - PORTA.1
    '30 DB2 - PORTA.2
    '31 DB3 - PORTA.3
    '39 RS  - PORTA.4
    '36 E   - PORTA.6
    '37 R/W - PORTA.7
    
    
    DEFINE LCD_DREG PORTA       'LCD data port 
    DEFINE LCD_DBIT 4           'LCD data starting bit 0 or 4 
    DEFINE LCD_RSREG PORTA      'LCD register select port 
    DEFINE LCD_RSBIT 4          'LCD register select bit 
    DEFINE LCD_EREG PORTA       'LCD enable port 
    DEFINE LCD_EBIT 6           'LCD enable bit 
    DEFINE LCD_RWREG PORTA      'LCD read/write port
    DEFINE LCD_RWBIT 7          'LCD read/write bit
    DEFINE LCD_BITS 4           'LCD bus size 4 or 8 
    DEFINE LCD_LINES 2          'Number lines on LCD 
    DEFINE LCD_COMMANDUS 2000   'Command delay time in us 
    DEFINE LCD_DATAUS 50        'Data delay time in us
    
    
    ' Register settings
    OSCCON     = %01100000      'Internal RC set to 4MHZ
    ANSEL      = %00000000      'Disable Analogue Inputs
    OPTION_REG = %01000000      'Enable PORTB pullups
    
    
    START:
        Lcdout $FE, 1           'Clear screen
    
    
    MAIN:
        pause 1000
        lcdout $FE, 2,   "This is line one"
        lcdout $FE, $C0, "This is line two"
        goto MAIN
    
    end
    Roger

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    This...

    '28 DB0 - PORTA.0
    '29 DB1 - PORTA.1
    '30 DB2 - PORTA.2
    '31 DB3 - PORTA.3

    is not compatible with this...

    DEFINE LCD_DREG PORTA 'LCD data port
    DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4

    ...and double-check with the Datasheet that you've disabled all Analogue Functions on PortA.

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    Did you find this post helpful? Yes | No

    Default

    The display's datasheet makes me connect the lines D4 to DB3, D5 to DB2, D6 to DB1 and D7 to DB0 (see attachment "DB-Lines_connections.jpg"). This is why I thought the starting bit would be the fourth.

    I changed:
    Code:
    DEFINE LCD_DREG PORTA       'LCD data port 
    DEFINE LCD_DBIT 0           'LCD data starting bit 0 or 4
    and added:
    Code:
    ADCON0.0   = 0              'Disable Converter Module
    I went through the PIC's datasheet and couldn't find other settings that could affect the A ports. Still, the display looks just dead.

    I have two of them and react the same. I changed for my second 16F88 and the result is same too.
    Attached Images Attached Images  
    Roger

  4. #4
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Normally for a 4 bit bus

    DB0-DB3 = D4-D7

    Also if you are using a 16F88 check the ANSEL register
    Keith

    www.diyha.co.uk
    www.kat5.tv

  5. #5
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    Did you find this post helpful? Yes | No

    Default

    ANSEL is set to have all analog ports disabled.

    As you suggested, I connected DB0 to D4 and so on...

    Still nothing happens.

    I'm just suprised that the display don't even flickers a little. It looks just like dead. Two displays doing the same makes me think I'm doing something wrong.

    Is is right to say that to make it work the Enable bit must be high? If yes, I could at least mesure it with my logic probe or oscillo....

    What can I "electrically" check else to minimise the cabling error risk?
    Roger

  6. #6
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Is there (or should there be) a contrast control that needs adjusting ?
    Keith

    www.diyha.co.uk
    www.kat5.tv

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    i'm not sure if PBP handle the R/W line itself.

    How about LOW PORTA.7

    AND maybe i'm blind.. i don't see any config fuses?

    On some LCD, you need to tie the unused DB lines to GND, in your case they should be tied to 5V.

    AND what about the CSB line?
    <img SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1215&d=1164381937">
    Last edited by mister_e; - 24th November 2006 at 18:24.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 08:56
  2. need help in coding..
    By daphne8888 in forum mel PIC BASIC
    Replies: 1
    Last Post: - 19th March 2008, 08:31
  3. Help GPS read with serin
    By leinske in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th September 2007, 03:33
  4. Crystalfontz LCD
    By jman12 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th February 2007, 16:04
  5. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 13:22

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