(Solved) – Read COM port response with VBA 2

(solved)-–-read-com-port-response-with-vba-2

Good morning, I would like to receive a reply from the COMx port to which an RS485 card with 8 relays is connected to find out the status of the individual relays. I can send the ON / OFF commands with the following command FF 01 01/00 which is equivalent to the code

Open "COM4: 9600, N, 8.1" For Binary As # 1

Put # 1,, Chr (& HFF) & Chr (& H1) & Chr (& H1)/(&H0)
Close # 1

To know its status the command is FF A1 00 whose answer is FF A1 00 00 00 00 00 00 00 00 but I can’t find a way to write it in VBA

Leave a Reply

Your email address will not be published. Required fields are marked *