« Close

Datasheets and User Guides

App Notes

Software & Driver

 

5.2.5 - Feedback

Feedback Overview

A flexible function that handles all command/response functionality. One or more IOTypes are used to perform a single write/read or multiple writes/reads.

Note that the general protocol described in "Section 5.1":/support/u6/users-guide/5.1 defines byte 2 of an extended command as the number of data words, which is the number of words in a packet beyond the first 3 (a word is 2 bytes). Also note that the overall size of a packet must be an even number of bytes, so in this case an extra 0x00 is added to the end of the command and/or response if needed to accomplish this.

Since this command has a flexible size, byte 2 will vary. For instance, if a single IOType of PortStateRead (d26) is passed, byte 2 would be equal to 1 for the command and 3 for the response. If a single IOType of LED (d9) is passed, an extra 0 must be added to the command to make the packet have an even number of bytes, and byte 2 would be equal to 2. The response would also need an extra 0 to be even, and byte 2 would be equal to 2.

Command:  
Byte  
0 Checksum8
1 0xF8
2 0.5 + Number of Data Words (IOTypes and Data)
3 0x00
4 Checksum16 (LSB)
5 Checksum16 (MSB)
6 Echo
7-63 IOTypes and Data
   
Response:  
Byte  
0 Checksum8
1 0xF8
2 1.5 + Number of Data Words (IOTypes and Data)
3 0x00
4 Checksum16 (LSB)
5 Checksum16 (MSB)
6 Errorcode
7 ErrorFrame
8 Echo
9-63 Data
  • IOTypes & Data: One or more IOTypes can be passed in a single command, up to the maximum packet size. More info about the available IOTypes is below. In the outgoing command each IOType is passed and accompanied by 0 or more data bytes. In the incoming response, only data bytes are returned without the IOTypes.
  • Echo: This byte is simply echoed back in the response. A host application might pass sequential numbers to ensure the responses are in order and associated with the proper command.
  • ErrorFrame: If Errorcode is not zero, this parameter indicates which IOType caused the error. For instance, if the 3rd passed IOType caused the error, the ErrorFrame would be equal to 3. Also note that data is only returned for IOTypes before the one that caused the error, so if any IOType causes an error the overall function response will have less bytes than expected.

IOTypes for Feedback Command:

Name IOType (dec) WriteBytes ReadBytes
AIN 1 3 2
AIN24 2 4 3
AIN24AR 3 4 5
WaitShort 5 2 0
WaitLong 6 2 0
LED 9 2 0
BitStateRead 10 2 1
BitStateWrite 11 2 0
BitDirRead 12 2 1
BitDirWrite 13 2 0
PortStateRead 26 1 3
PortStateWrite 27 7 0
PortDirRead 28 1 3
PortDirWrite 29 7 0
DAC0 (8-bit) 34 2 0
DAC1 (8-bit) 35 2 0
DAC0 (16-bit) 38 3 0
DAC1 (16-bit) 39 3 0
Timer0 42 4 4
Timer0Config 43 4 0
Timer1 44 4 4
Timer1Config 45 4 0
Timer2 46 4 4
Timer2Config 47 4 0
Timer3 48 4 4
Timer3Config 49 4 0
Counter0 54 2 4
Counter1 55 2 4