Claude
01-05-2006, 08:45 AM
Greetings-
I’m attempting to use SERIN to process a variable length commands originating at a PLC. The commands deal with relay control. For example:
RLYA – Prints the status of all relays
RLY1OFF – Turns off relay 1
RLY1ON – Turns on relay 1
XXX – Other commands I’m not interested in processing (note these are three bytes long)
I would like nothing more than to say SERIN RX, Baud, 1000, Do_Task_1, [STR serStr\7] and read as few as 3 or as many as 7 bytes. I’m seeing that you can only specify only the number of byte you can safety anticipate. That is, I start with SERIN \3 and either determine I have a valid command (“RLY”) or not. If the string equals “RLY”, I do a SERIN \1 and determine if the string equals “A” or “1 thru 9”. If “1 thru 9”, then I do a SERIN \2 to get an indication of an ON (“ON”) or OFF “OF”).
I must be missing something, because this shouldn’t be this hard. Can the group suggest an alternative? --Thanks
Best Regards,
Claude
I’m attempting to use SERIN to process a variable length commands originating at a PLC. The commands deal with relay control. For example:
RLYA – Prints the status of all relays
RLY1OFF – Turns off relay 1
RLY1ON – Turns on relay 1
XXX – Other commands I’m not interested in processing (note these are three bytes long)
I would like nothing more than to say SERIN RX, Baud, 1000, Do_Task_1, [STR serStr\7] and read as few as 3 or as many as 7 bytes. I’m seeing that you can only specify only the number of byte you can safety anticipate. That is, I start with SERIN \3 and either determine I have a valid command (“RLY”) or not. If the string equals “RLY”, I do a SERIN \1 and determine if the string equals “A” or “1 thru 9”. If “1 thru 9”, then I do a SERIN \2 to get an indication of an ON (“ON”) or OFF “OF”).
I must be missing something, because this shouldn’t be this hard. Can the group suggest an alternative? --Thanks
Best Regards,
Claude