Note: This function is not required to control the RadioTrack cards and is only included for completeness.

This function reads port_Address and returns the data in return_data. The function format is as follows:

return_data = RTRead( port_Address )

The value of port_Address must be a decimal number in the range of 256 to 65535 which corresponds to the I/O range of the IBM Personal Computer.

If the RTRead was successful, the return_data contains the following string:

Addr: xxx Data: yyy

where xxx is the port_Address and yyy is the data of the port read. All values are in decimal form. The range of the data read is 0 to 255.

If the RTRead was unsuccessful, the following errors are returned:

Addr: xx Data: yy

xx = 10 TESTCFG.SYS could not be opened during RTLoadFuncs.
yy = rc Return code of DOSOpen.

xx = 11 Unsuccessful read.
yy = rc Return code of DosDevIOCtl.

For error codes of DosOpen and DosDevIOCtl see the section on Error Codes.

Examples:

The code below reads the port at location 768 (300 hex) and results in the following output:

port_Address = X2D('300')
return_data = RTRead( port_Address )
SAY 'Data read is ' || return_data

Output:
Data read is Addr: 768 Data: 255

The code below reads the port at location 888 (378 hex) which is reserved for LPT1 and tied up by PRINT01.SYS. It results in the following read error output:

port_Address = X2D('378')
return_data = RTRead( port_Address )
SAY 'Data read is ' || return_data

Output:
Data read is Addr: 11 Data: 19

The error (19) given here is not listed under the return codes of DosDevIOCtl of the Control Programming documentation. Error 19 is listed as ERROR_WRITE_PROTECT under the disk access functions. Go figure.

The port_Address range is not directly checked by this function, however, TESTCFG.SYS does not allow to read or write to ranges below 256 (100 hex) as these contain critical system parameters. Also, it does not allow to read or write to ports that are controlled by other drivers, like the printer (LPT1) or serial ports (COM1, COM2).