5.2.1.4.7 Data Transmission

When the terminal module and the two dashboards have been set up as described in the previous sections, the ADP example goes into a mode where it is continuously sending data to the host computer and receiving data from the host computer according to the configured streams. Below are examples of data messages being transmitted from the ATSAMD21 target to the host computer.

Table 5-40. Light Sensor ADC Stream
FieldValuesDescription
Token0xFF
Message ID0x40
Data length6
Number of streams (N)1
Stream ID0x0002ID of ADC value stream
Num bytes (Xn)2Number of bytes from the stream
Stream X data sample M634 (0x027A)The data of the stream (uint_16)
Table 5-41. Night Mode Stream
FieldValuesDescription
Token0xFF
Message ID0x40
Data length5
Number of streams (N)1
Stream ID0x0029ID of Night mode stream
Num bytes (Xn)1Number of bytes from the stream
Stream X data sample M0x01 (Bright light, day mode)The data of the stream (uint_8)

When the Night mode changes, the example also changes the background color of the terminal module by sending another MSG_CONF_TERMINAL.

Table 5-42. MSG_CONF_TERMINAL to update Terminal Background Color to White
FieldValuesDescription
Token0xFF
Message ID0x26
Data length26
ID0x0000ID of terminal
Label“Status terminal\0”Terminal label
Width80Number of characters wide
Height50Number of lines high
Background color0xFFFFFFRGB background color
Foreground color0x008000RGB foreground color
Table 5-43. Status Message Stream
FieldValuesDescription
Token0xFF
Message ID0x40
Data length44
Number of streams (N)1
Stream ID0x0000ID of status message stream
Num bytes (Xn)40Number of bytes from the stream
Stream X data samples

“It's bright again... Entered day mode!\r\n”

{0x49, 0x74, 0x27, 0x73, 0x20, 0x62, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x61, 0x67, 0x61, 0x69, 0x6E, 0x2E, 0x2E, 0x2E, 0x20, 0x45, 0x6E, 0x74, 0x65, 0x72, 0x65, 0x64, 0x20, 0x64, 0x61, 0x79, 0x20, 0x6D, 0x6F, 0x64, 0x65, 0x21, 0x0D, 0x0A}

The data of the stream (uint_8)

Examples of data messages for the various streams from the computer to the target can be found in the tables below.

Table 5-44. Hysteresis Low Value Stream Data Message
FieldValuesDescription
Token0xFF
Message ID0x14MSG_RES_DATA
Data length5
Stream ID0x0011ID of hysteresis low value stream
Bytes sent2Number of bytes in the data payload
Data bytes0x07C6The data (uint_16)
Table 5-45. Hysteresis High Value Stream Data Message
FieldValuesDescription
Token0xFF
Message ID0x14MSG_RES_DATA
Data length5
Stream ID0x0002ID of hysteresis high value stream
Bytes sent2Number of bytes in the data payload
Data bytes0x0BB7The data (uint_16)
Table 5-46. LED Toggle Stream Data Message
FieldValuesDescription
Token0xFF
Message ID0x14MSG_RES_DATA
Data length5
Stream ID0x0030ID of LED toggle stream
Bytes sent1Number of bytes in the data payload
Data bytes0x00The data (uint_8)