Appendix D

Sending Binary Data Over RS-232

About this Appendix This appendix describes the procedure for sending pure binary data over an RS-232 interface. The formatting described is used in the DIAG:DOWN:CHEC:MADD, DIAG:DOWN:CHEC:SADD, and DIAG:DRIV:LOAD:CHEC commands. this appendix contains the following main sections.

• About this Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-1

• Formatting Binary Data for RS-232 Transmission. . . . . . . . . . D-1

• Sending Binary Data Over RS-232. . . . . . . . . . . . . . . . . . . . . . . D-2

Formatting Binary Data for RS-232 Transmission

The most straightforward way to send a block of data is to open the data file, read the next byte from the file, and send it to the System Instrument until you reach the end of file. However, binary data cannot be sent to the System Instrument as is. It must be converted into a format that will not conflict with the special characters that the RS-232 interface recognizes. This is done by sending only one half byte (a nibble) at a time. To prevent this nibble from being confused with a special character, bit 7 of the nibble is set to one. This gives all data bytes in the block values greater than 127 so they are not confused with ASCII characters. It also doubles the size of the file to be sent and the transmission time for the file. Since a transmission error that required retransmission of the entire data block would be very time consuming, a 3-bit error code (which allows for correction of single bit errors) is added to the transmission byte. The following format is sent for each nibble:

Bit #

7

6

 

5

 

4

3

2

 

1

0

 

 

 

 

 

 

 

 

 

 

 

 

 

1

 

Correction Code

 

 

 

Data

 

 

 

 

 

 

 

 

 

 

 

 

 

The error correction code is based on the nibble of data sent. The easiest way to implement this code is to use table D-1. It is indexed based on the value of the nibble to send out, so there are 16 elements to the table.

Sending Binary Data Over RS-232 D-1

Page 233
Image 233
Agilent Technologies 75000 SERIES B Sending Binary Data Over RS-232, Formatting Binary Data for RS-232 Transmission, Bit #