Some applications, especially microcontroller applications without a dedicated serial data buffer, require an extra delay between individual characters to avoid buffer overflows and allow the microcontroller to execute other code.
In Docklight you can implement inter-character delays by inserting one or several Function Characters '&' (F9 key) in your Send Sequence data, followed by a character specifying the desired delay time from 0.01 seconds to 2.55 seconds.
You can also use the '&' delay character inside a Receive Sequence to specify a minimum silent time where no further characters should be received. This is useful for detecting pauses in the data stream that indicate the beginning/end of a telegram, especially for protocols where there is no dedicated start or end character.
•Docklight is ready to run a test as described in testing a serial device or a protocol implementation.
•The Docklight project already contains one or several Send Sequences, but an additional delay at certain character positions is required.
A) Modifying the existing Send Sequence
|1.||Open the Edit Send Sequence dialog.|
|2.||Switch Edit Mode to Decimal. Our "get" example looks like this in decimal mode:|
103 | 101 | 116 | 013
|3.||Insert a delay function character between the first and the second character: Press F9, or open the context menu using the right mouse button, and choose Function character '&' (delay... . The example sequence now reads:|
103 | & | 101 | 116 | 013
|4.||Add the delay time: In this example a decimal value of 002 (20 milliseconds) after the "&" function character is added. The sequence is now:|
103 | & | 002 | 101 | 116 | 013
|5.||Insert a delay between all other inter-character positions: the delay character and delay time can be copied using Ctrl+C, and pasted in the desired positions using Ctrl+V. Our example sequence finally reads:|
103 | & | 002 | 101 | & | 002 | 116 | & | 002 | 013
Or back in ASCII Mode:
g | & | o | e | & | o | t | & | o | r
|6.||Click OK to confirm the changes|
NOTE: To distinguish a '&' delay character from a regular ampersand ASCII character (decimal code 38), the delay function character is shown on a different background color by the sequence editor.
NOTE: The character after a delay function character is interpreted as the delay time and is not sent to the serial device.
B) Sending the command to the microcontroller application
|1.||Send the modified Send Sequences using the Send button.|
Docklight will send out the same data as before, but leave additional timing gaps as specified by the delay characters. The communication display will show the same communication data as without the delays.
NOTE: Docklight's accuracy for delay timing is limited because it has no control over the UART's internal TX FIFO buffer. The specified delay times for the '&' delay function character are minimum values. Measured delay values are significantly higher, because Docklight always waits a minimum time to ensure the UART TX FIFO buffer is empty. Also, the display format and the additional performance settings affects the timing. If you have more specific requirements on Send Sequence timing and need to control the Docklight "wait time" as well as your UART FIFO settings, please contact our e-mail support.
TIP: If you require the same delay between each character of the transmitted data, have a look at the SendByteTiming.pts sample script (see the folder Extras\SendByteTiming in your Script Samples directory). This script will automatically slice your Send Sequences into individual characters and send the data "byte-by-byte", using a predefined inter-character delay.
Docklight already offers the Pause detection... display option to insert additional time stamps or line breaks after communication pauses.
If you require not only visual formatting, but need to define actions after a minimum pause, or simply make sure the Receive Sequence detection algorithm starts anew after a pause, you can add the delay function character to your Receive Sequence definition.
In most applications the best place for the delay function character will be at the beginning of the Receive Sequence, before the actual receive data characters. You can also create a Receive Sequence that contains a delay/pause definition only, and no actual serial data. This can be very useful for implementing timing constraints, e.g. resetting the telegram detection after a pause occurred.
TIP: See the LineParser.ptp / LineParser.pts project and script file (folder Extras\LineParser in your Script Samples directory) for a sample application.