I'm new in the PLCBUS world, and I'm trying to adding PLCBUS support in a software I wrote myself in C++ earlier, but I have a problem with the ACK.
Let me describe the bug, and how to reproduce it.
When I send a message to a non existant PLCBUS module, I expect to receive a message from the 1141 and not an ACK. It works, but, after that, the 1141 seems respond wrong message to almost any command. Indeed, a lot of messages from the 1141 start with the LENGHT bit (06) instead of STX (02). Is that a bug, or my 1141 is defective ?
I'll give you an example, I have a module adressed in A1, with user code 00 and nothing else (no A2)
First step, I turn A1 ON with ACK :
Code: Select all
Message sent : 02 05 00 00 22 00 00 03 <12.5ms> 02 05 00 00 22 00 00 03
Sleep 1 sec
Bytes read : 18
Message received : 02 06 00 00 22 64 00 1e 03 02 06 00 00 22 64 00 20 03
Second step, I turn A2 ON with ACK
Code: Select all
Message sent : 02 05 00 01 22 00 00 03 <12.5ms> 02 05 00 01 22 00 00 03
Sleep 1 sec
Bytes read : 9
Message received : 02 06 00 01 22 64 00 1e 03
Third step, I turn A1 OFF with ACK :
Code: Select all
Message sent : 02 05 00 00 23 00 00 03 <12.5ms> 02 05 00 00 23 00 00 03
Sleep 1 sec
Bytes read : 17
Message received : 06 00 00 23 00 00 1e 03 02 06 00 00 23 00 00 20 03
The bug happens when I did not receive an ACK. Immediately after, the 1141 start sending incorrect messages ... totally randomly. Sometimes messages are good, sometimes messages are wrong. The only one way I have to stop this bug is to unplug the 1141 and re-plug it.
Can anyone tell me where I'm wrong ? Or is this a real bug ? Or my hardware is defective ?
Thank you very much, I'm totally lost !
Cyril