PDA

View Full Version : serial LCD/SLCD question



MatthewM
- 17th May 2009, 16:46
I am writing a test program to learn how to write text and variable values to a serial LCD Screen, I am using melabs 20 character by 4 line serial lcd screen connected to PORTC.0 on the lab X-1 board. I was told that writing to a serial LCD is much like writing to a normal LCD, with the exception of using the SEROUT command instead of LCDOUT. But, when I try this, it says the line of code is a bad expression, it will work if I remove "DEC3" from the SEROUT command, but then it outputs the variable value as ASCII characters, instead of a numeric value. This is what I have so far:

INCLUDE "modedefs.bas" 'Include mode definitions

X VAR BYTE 'Declare x as a variable
X=1 'Set X to 1


LOOP: 'Beginning of main loop
X=X+1 'Add 1 to x
PAUSE 500 'Wait 500ms
SEROUT PORTC.0, N9600, [$fe, $1] 'Clear SLCD screen and move
'cursor to beginning
SEROUT PORTC.0, N9600, ["X=",DEC3 X] 'Display value of X
GOTO LOOP 'Do it all over

END

Thank you for your time,
Matthew

Tobias
- 17th May 2009, 17:17
Try replacing the DEC with #

Serout LCD, N9600, ["E/T ", # Time2,".", # Time1/10,10,13]

Bruce
- 17th May 2009, 17:49
SEROUT doesn't support the DEC modifier. SEROUT2 does.

MatthewM
- 18th May 2009, 03:10
Thank you, I have never used SEROUT2, is there anything different about using it?

Thank you again for your time,
Matt

MatthewM
- 18th May 2009, 14:56
Sorry for the double post,

I did not notice the other reply, your suggestion worked perfectly, thank you.

Matt