Hi!,
I'm doing a program with serial communication (I'm trying to communicate my PC with a KRC2) and I'm using CREAD and CWRITE Commands with interruption included, but I have one problem when I try to use CREAD more than one time. Every time I use CREAD, I wait for $DATA_SER3 for data to be available for reading, So when I use the Wait Until Command for the first time, It works perfectly, However at the second time It doesn't wait, maybe because $DATA_SER3 has changed before (with the first CREAD).
When I use cclose and copen again, $DATA_SER3 turn to 0, and it work perfectly but, I want to know if someone knows another way to restart the DATA_SER variable or clean the buffer somehow.
*Also I'm using interruption with DATA_SER3 Variable ( INTERRUPT DECL 1 WHEN $DATA_SER3<>0 DO Sensor() ) so I have to OPEN and CLOSE the serial every time I leave the sub interruption program! I think this is very inefficient !!