Relay Box Hex Codes problem
vegastech
Posts: 369
I am trying to control a Relay Box that uses 232, but I'm having a problem with sending the correct code structure, I think. The device's protocol guide shows the following settings need to be made on my controller:
Configure port as 4800 bps N-8-1.
So I've done this:
First byte = header (40h)
Second byte = address (01h - FEh)
Third byte =
Zone number (1 ? 8) in lower nibble and
Command (3 = ON & 4 = off) in upper
Example (all 3 bytes) for module address 1:
zone1 on = 40 01 31 (hex)
zone1 off = 40 01 41 (hex)
So I read that to mean that I need to send 40 01 31 in hex to the device. Here is what I have in my button presses:
Configure port as 4800 bps N-8-1.
So I've done this:
DATA_EVENT[dvRelay] //data event for rs232 relay8net control box { ONLINE: { SEND_COMMAND dvRelay, "'SET BAUD 4800,O,8,1'" }For the actual command structure, the protocol guide says this:
First byte = header (40h)
Second byte = address (01h - FEh)
Third byte =
Zone number (1 ? 8) in lower nibble and
Command (3 = ON & 4 = off) in upper
Example (all 3 bytes) for module address 1:
zone1 on = 40 01 31 (hex)
zone1 off = 40 01 41 (hex)
So I read that to mean that I need to send 40 01 31 in hex to the device. Here is what I have in my button presses:
BUTTON_EVENT[dvTp,40] { PUSH: { nShadeStatus = 1 SEND_STRING dvRelay, "$40,$01,$13" //turns relay 1 on Wait 5 'relay 1 on' SEND_STRING dvRelay, "$40,$01,$14" //turns relay 1 off } }I don't know if it's a problem with the processor not sending commands at the right speed, or if my interpretation of how to send the codes I want is incorrect. help? Is there a place in NS3 to verify the port settings on the controller?
0
Comments
It should be:
You can verify port settings by enabling notifications for the device (set your notification options first.)
Then use 'Control a Device' to send the port the GET BAUD command. The ports settings will show up in the notifications window.
The response of the Rain8 is to execute any command then send back the same three bytes as an ACK.
Try this instead: