PDA

View Full Version : Reading RS232 String



Peter1960
- 6th June 2005, 02:47
Hi,

I am trying to read a RS232 string and act upon it.
IE. RS232 in is "ABC1" @ 9600 baud, place in variable R
Can I then simply do If R = ABC1 Then excute the command?
Peter

mister_e
- 6th June 2005, 04:11
No or, not directly. You'll need to compare an String Array to another one.

If you have only 1 string to act with you can also use the WAIT modifier.

In my case, when i need to jump to several Subroutine with PCTask, i use a simple Byte and Branch(or more than often BRANCHL)

something like



SubRoutineToBeExecute var byte

Main:
HSERIN[SubRoutineToBeExecute]
branch SubRoutineToBeExecute,[Sub1,Sub2,Sub3,Sub4]
goto Main

Sub1:
' stuff here
goto Main

Sub2:
' stuff here
goto Main

Sub3:
' stuff here
goto Main

Sub4:
' stuff here
goto Main


easier than use this precious Code space to store String stuff IMHO.

Peter1960
- 6th June 2005, 04:51
Steve,

Shouldn't I be using SerIn on a PIC12F675?
(Sorry I negeleted to mention it before)

Peter

mister_e
- 6th June 2005, 09:02
sure you can use SERIN, SERIN2, DEBUG...