R4x Pro Command Set

Hello!

I inherited a test system developed at my employer a few years ago and the documentation that was left to me didn’t exactly cover how some of the relay board commands worked.

I found the manual linked here http://assets.controlanything.com/manuals/R4xR8xPro.PDF for product R41DPDT. The commands listed have clarified things but some of the commands our original developer created don’t quite match up with what I am looking at here, and was wondering if you could help me out.

My understanding so far (taken from the manual):
• 254: Required pre-amble to enter command mode
• 250: Enable a selected device to listen to your commands
• 248: Enables all devices to listen to your commands
• 0-7: Turns off a relay
• 8-15: Turns On a relay

That said, the commands that the developer used all include a 13 at the end of each string, citing “carriage return”.

We develop using C, an example a command string was named K1_Off:

Unsigned char K1_Off [3][1] = {254, 0, 13};

His comments on the code mention that the 254 for command mode, 0 to turn off relay K1, and then 13 for carriage return. Now I understand that the carriage return ASCII value is 13, and in C it is used to move the cursor to the beginning of the current line. I don’t know if you folks use C, but is this 13 actually required?

We don’t have an 8 channel card, so its not relating to K6 in this case.

Secondly, there is a command string that has the ASCII commands {254, 250, 1, 13}, which is said to enable a relay board device. In this case, I am understanding that this sequence follows as: Enter command mode, Enable Specific device command, Device to enable = 1, carriage return. Would enabling device 1 in this case relate to relay 2?

Please let me know if I am not clarifying my questions well enough.

A carriage return byte is not required. You can remove the 13 byte from all commands.

You only need to use the E3C device selection commands if there are multiple devices on the same RS 232 bus. If the RS232 connection has only one board then you never need the 250 or 248 bytes in the command.

For your 4 channel board the only commands you will ever need to turn relays on and off are:
254, 0 - Relay 1 OFF
254, 1 - Relay 2 OFF
254, 2 - Relay 3 OFF
254, 3 - Relay 4 OFF
254, 8 - Relay 1 ON
254, 9 - Relay 2 ON
254, 10 - Relay 3 ON
254, 11 - Relay 4 ON

We are experienced with C program development so if you have any other questions please let us know.

Thank you,
Travis Elliott

1 Like

That is helpful, very helpful, thank you!

That said, I had been having difficulty getting the K1 relay to actually switch off. I had been using the correct commands, as you had listed, but it simply did not want to switch.

I then tried using the 248 command for all devices at the start of my program and suddenly it started cooperating. Would you have any thoughts as to why that might be the case? I can go into more detail should you like.

It is not going to hurt anything at all to send that 248 command at the start of the program. I would say the previous developer stored an E3C device number into the board previously which is why this is an issue. That said if sending that command at the start of the program solves the problem I see no problem with that.