Getting relay status in vb.net

Having problems getting the status of the relays on a VMB4RYLD.
It’s address is module “F1” relay “1”
Can switch it on and off ok, but can’t get it to return its status.
Help please

    'compile the packet
    VBAddress = "&H" + "F1"
    VBCommand = "&H" + "FB"
    VBByte1 = "&H" + "1"
    VBDataSize = 1

    VBpacket = New Packet()
    VBpacket.Address = VBAddress
    VBpacket.Priority = PacketPriority.Low
    VBpacket.DataSize = VBDataSize
    VBpacket.Command = VBCommand
    VBpacket.Item(1) = VBByte1

    VelbusSerialBus.SendBlocking(VBpacket)

Handle the PacketReceived event of your VelbusSerialBus

Yes i do that for the inputs but what packet do i send to provoke a responce from the relay to give me its status.

Andrew

A ‘Relay status request’ packet

velleman.eu/downloads/0/velb … b4ryld.pdf
Page 8

Yes i have that book and still cna not get a responce from the relay to provide its status.
So what is wrong with the code below ?

'compile the packet

 VBAddress = "&H" + "F1"
 VBCommand = "&H" + "FB"
 VBByte1 = "&H" + "1"
 VBDataSize = 1

 VBpacket = New Packet()
 VBpacket.Address = VBAddress
 VBpacket.Priority = PacketPriority.Low
 VBpacket.DataSize = VBDataSize
 VBpacket.Command = VBCommand
 VBpacket.Item(1) = VBByte1

 VelbusSerialBus.SendBlocking(VBpacket)

Should be at least:

VBpacket = New Packet()
VBpacket.Address = &HF1
VBpacket.Priority = PacketPriority.Low
VBpacket.DataSize = 1
VBpacket.Command = &HFB
VBpacket.Item(1) = &H01

VelbusSerialBus.SendBlocking(VBpacket)

Respect each variable’s data type, don’t assign strings to integers! I’m surprised it even compiles o_O

“&H” + “0A” is a concatenation of two strings, which in result is the string “&H0A” [NOT OK]
&H0A is the hexadecimal notation of the decimal number 10 [OK]

Thanks for that, i tried to request the status of relay F1 using the exact code you gave above but i still get nothing back from the system
I can still switch the relays on and off with command 01 and 02, but just can’t get the status, but when i stick &HFB in as the command nothing happens.

any further ideas ?

Andrew

I my earlier post I indicated that the command was on page 8. On page 8 you will find a ‘Relay status request’ command. The command byte is FA. It has 2 data bytes, one for the command and one for an extra parameter.

The packet with command FB is the response. The response is on page 4 in the manual.

VBpacket = New Packet()
VBpacket.Address = &HF1
VBpacket.Priority = PacketPriority.Low
VBpacket.DataSize = 2
VBpacket.Command = &HFA
VBpacket.Item(1) = &H01

The protocol manual might be hard to understand at first because it was written from the perspective of the module and the CAN protocol, not from a computer’s perspective.

Thank you i will try this.

It has been a bit of a challange to get to this stage based on the manual avaialble.
Has there been any other publications regarding the use of the system with a PC ?

Regards

Andrew

All we have is downloadable from our website

Just because I know that beginning from scratch could be hard : here is a small help I’ve written to help those who want to create nice Velbus applications !

golfy.free.fr/Velbus/Velbus_starter_guide.pdf

Hope that will help you to understand official documentations