PDA

View Full Version : SEROUT2 and multiple WORDS



atomski
- 4th March 2004, 09:05
Hello everyone,

I've decided to start a new thread
regarding my 16F628 project problem
(solved thanks to Melanie)...

I have another question. Is there a way
to send/receive several consecutive
WORD sized variables over rs-232 (SW
USART) using single SEROUT2/SERIN2
command?
For example, can I send this using a
single SEROUT2 command:

SEROUT2 tx,16780,["ENTER T1",13,10]
SEROUT2 tx,16780,["ENTER T2",13,10]
SEROUT2 tx,16780,["ENTER T3",13,10]
SEROUT2 tx,16780,["ENTER T4",13,10]
SEROUT2 tx,16780,["ENTER T5",13,10]

I'm pretty sure I coud do it this way:

SEROUT2 tx,16780,["ENTER T1","T2","T3","T4","T5",13,10]

However, how can I receive and store 5
consecutive values to variables with
one SERIN2 command? I would
appreciate if someone could give a clue
as to what I should do to make this
happen.

atomski
- 27th May 2004, 14:45
Originally posted by atomski
Hello everyone,

I've decided to start a new thread
regarding my 16F628 project problem
(solved thanks to Melanie)...

I have another question. Is there a way
to send/receive several consecutive
WORD sized variables over rs-232 (SW
USART) using single SEROUT2/SERIN2
command?
For example, can I send this using a
single SEROUT2 command:

SEROUT2 tx,16780,["ENTER T1",13,10]
SEROUT2 tx,16780,["ENTER T2",13,10]
SEROUT2 tx,16780,["ENTER T3",13,10]
SEROUT2 tx,16780,["ENTER T4",13,10]
SEROUT2 tx,16780,["ENTER T5",13,10]

I'm pretty sure I coud do it this way:

SEROUT2 tx,16780,["ENTER T1","T2","T3","T4","T5",13,10]

However, how can I receive and store 5
consecutive values to variables with
one SERIN2 command? I would
appreciate if someone could give a clue
as to what I should do to make this
happen.

I did a little experimenting, spent about
2 days busting my gray cells and found
a way to do what I wanned. Here's an
example:

SERIN2 rx, 16780,[DEC1 T1,DEC2 T2, DEC3 T3,DEC4 T4,DEC5 T5]
WRITE 0, T1
WRITE 1, T2
WRITE 2, T3 'Word sized var takes up 2 eeprom locations
WRITE 4, T4 'Word sized var takes up 2 eeprom locations
WRITE 6, T5 'Word sized var takes up 2 eeprom locations

I guess writting to an eeprom could be
done diffrently, however this worked for
me nicely... Just my 2 cents ;)

--
Sincerest regards,

YZ7REA Vladimir M Skrbic
4N7ATV Repeater Administrator
YU7GHZ Radio Club President