|
Setting and Detecting a "Break" State (Scripting) |
|
|
Some serial application protocols (e.g. LIN) make use of the so-called Break state for synchronization purposes. Docklight Scripting supports sending a "break" within a Send Sequence and detecting a "break" state using a Receive Sequence definition. "break" signals are added to your sequence definition by inserting a Function Character '%' (F10 key). A Docklight "break" signal has a minimum length of 15 * <nominal bit length>.
Preconditions
Sending a "Break" state
We assume there is already a "Test" Send Sequence which looks like this in ASCII mode: T | e | s | t
% | T | e | s | t
The TX line will go to Space (logical 0) for at least 15 bit durations, then the "Test" ASCII sequence will be transmitted. The "break" character does not appear in the communication window display.
Detecting a "Break" state
Received "break" signals are not displayed in the communication window, because they are not part of the actual data sequence. Nonetheless, it is possible to define a Receive Sequence including a "break" function character.
Docklight will now add BREAK detected to the communication window display each time a break signal is detected.
NOTE: After detecting a break signal, an additional <NUL> character (decimal code 0) may appear in the received data stream. This behavior cannot be controlled by Docklight, it depends on how the serial UART of your PC's COM port interpretes the break state.
NOTE: If you need to implement a Receive Sequence that checks for a break signal followed by additional data, keep in mind that Docklight cannot tell the exact position of the break signal within the data stream. The break signal will sometimes show up earlier in the data stream, but never later than the actual position. To define a Receive Sequence that safely triggers on break + specific data, you can use the following workaround: Insert some '#' (zero or one character) wildcards between the break character and the additional data. The resulting Receive Sequence could look like this: % | # | # | # | # | # | # | # | # | T | e | s | t
|