PDA

View Full Version : Bad Token with LCDout



docwisdom
- 9th February 2006, 03:09
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”

Bruce
- 9th February 2006, 07:17
Your double quotes around “Hello” look odd. Cut & paste this directly into your code and see if that helps.

LCDOUT $FE, 1, "Hello"

docwisdom
- 9th February 2006, 08:21
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

Melanie
- 9th February 2006, 09:03
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?

docwisdom
- 9th February 2006, 09:14
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.

Melanie
- 9th February 2006, 11:57
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.

docwisdom
- 9th February 2006, 17:43
no luck,

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