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

If you find that RTWrite is not working in a Vispro/REXX program, please read the section Important Notes for details.

This function writes data_Value to port_Address. The function format is as follows:

return_data = RTWrite( port_Address, data_Value )

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. The value of data_Value must be in decimal and have a range of 0 to 255.

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

Addr: xxx Data: yyy

where xxx is the port_Address and yyy is the data just written to the port. All values are in decimal form.

If the RTWrite 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 = 12 Unsuccessful write.
yy = rc Return code of DosDevIOCtl.

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

Example:

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

port_Address = X2D('300')
data_Value = 255
return_data = RTWrite( port_Address, data_Value )
SAY 'Data written is ' || return_data

Output:
Data written is Addr: 768 Data: 255

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).