Bad Token with LCDout


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2006
    Posts
    76

    Default LCDout

    I am getting
    error line 38 bad token "|" and
    error line 38 bad expression on my LCDOUT line. I copied & pasted it from the manual. Any suggestions?


    -brian


    ' Set LCD Data port
    DEFINE LCD_DREG PORTB
    ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_DBIT 0

    ' Set LCD Register Select port
    DEFINE LCD_RSREG PORTB
    ' Set LCD Register Select bit
    DEFINE LCD_RSBIT 4

    ' Set LCD Enable port
    DEFINE LCD_EREG PORTB
    ' Set LCD Enable bit
    DEFINE LCD_EBIT 5

    ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_BITS 4
    ' Set number of lines on LCD
    DEFINE LCD_LINES 1
    ' Set command delay time in us
    DEFINE LCD_COMMANDUS 2000
    ' Set data delay time in us
    DEFINE LCD_DATAUS 50

    LCDOUT $FE, 1, “Hello”
    Last edited by docwisdom; - 9th February 2006 at 09:24.

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


    Did you find this post helpful? Yes | No

    Default

    Your double quotes around “Hello” look odd. Cut & paste this directly into your code and see if that helps.

    LCDOUT $FE, 1, "Hello"
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Jan 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    That was the fix, I was lucky enough to figure it out before your reply, but its good to have it documented for others in the future.

    Now that its compiled and programmed, I am still having no luck with the Hello displaying on the LCD.
    With the code above on a 16F737 I get one solid black block in the first character location and a blinking cursor in the second character location. all others are blank. Can anyone deduce what is causing this problem?

    I am using a 4bit mode to the LCD and it is wired just as the picbasic manual says in the LCDOUT subsection
    Last edited by docwisdom; - 9th February 2006 at 09:13.

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


    Did you find this post helpful? Yes | No

    Default

    And of course since the PICBasic manual example uses PORTA and you're using a PIC16F877A which has Comparators and ADC's you remembered to switch PORTA into DIGITAL mode?

  5. #5
    Join Date
    Jan 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    I actually misspoke. I was using a 877a until I fryed it, now I am using a 16f737.

    I will research the digital IO. I thought they were digital by default. I am also using portb, as I redefined in my code.

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


    Did you find this post helpful? Yes | No

    Default

    OK... if you have it wired as per your DEFINEs... then add PAUSE 1000 before you do your first output to the LCD... most LCD's need time to wake up following a power-on, you could be throwing data at it before it's ready and initialised.

  7. #7
    Join Date
    Jan 2006
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    no luck,

    I also put in an indicator light at the beginning of the code so I knew it was executing.

Similar Threads

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