Appendix D
Adding Data Field Confirmation
Appendix D |
With serial communications in a laboratory environment, the possibility of a communication error occurring is minimal. However, in a harsh or an industrial environment the possibility increases. A communication error occurs when a bit transmitted as a “1” is received as a “0” or vice versa. If the 232SDD16 receives a error in one or more of the first four command characters (“!0xx”), the unit will not execute the command. However, if the 232SDD16 receives an communication error on a data byte (I/O byte for Read Digital command or state byte for Set Output State command), the command will be executed since the unit has no way of knowing that there was an error.
To provide the 232SDD16 with a way of detecting errors in the data fields, an additional set of commands can be used. This set of commands begins with the “#” (23h) character, instead of the “!” (21h) character. Refer to Table
Command syntax:
#0RD
Response syntax:
{I/O msb}{~ I/O msb}{I/O lsb} {~ I/O lsb}
Where “~” is used to indicate the “complement of.” If I/O has a reading of 1, the following would be received:
{00}{FF}{01}{FE}
Where FFh is the complement of 0 and FEh is the complement of
1.The complement of number “x” can be calculated in QuickBasic as follows:
comp = (NOT x) AND &HFF
Appendix D |
B&B Electronics | B&B Electronics |
PH (815) | PH (815) |