PDA

View Full Version : SerOut and Arrays



shawn
- 4th July 2005, 17:11
Hi,
I'm using the serout command to communicate to a serial LCD Module. I've searched for about an hour and a half and have found nothing. My Question is can a person use a array variable in the serout comand like this.
Serout pin,6,[ControlVar,ArrayVariable.0]
My LCD is 16 Characters wide. What I want to do is have an array with 16 elements which would be one for each character. Then I can just load the array with the values I want and serout to my LCD once.
If even possible a little example of arrays with the serout command would be nice

Thanks
Shawn

mister_e
- 4th July 2005, 17:21
You'll need to use HSEROUT or SEROUT2
Serout....[STR ArrayVar]

look into the manual in the SEROUT2 section.

Melanie
- 4th July 2005, 17:32
You can't do that with SEROUT, but you CAN with SEROUT2... see the manual... quick example...

DataPin var PortB.0
Counter var Byte
DisplayString var Byte [18]

DisplayString(0)=$FE
DisplayString(1)=$01
For CounterA=2 to 16
DisplayString(CounterA)=CounterA+63
Next CounterA

SEROUT2 DataPin,T9600,[STR DisplayString\16]

This should clear the screen and display "ABCDEFGHIJKLMNOP" on the first line (assuming you have a 16 character display).