Unit IOD48FCT; (***************************************************************************** * MODULE: IOD48FCT.C * * * * The purpose of this module is to provide direct software interface to * * the IOD-48s digital board. * * * * LAST MODIFICATION: JULY 31, 1992 * * * *****************************************************************************) { these are the port address offsets for reading and control of the IOD48 } interface procedure IOD48_cos_enable(portad : integer; value : integer); procedure IOD48_clr_cos_int(portad : integer); function IOD48_read_port(portad : integer; offset : integer) : integer; procedure IOD48_port_control(portad : integer; offset : integer; value : integer); CONST PORT0A = $0000; PORT0B = $0001; PORT0C = $0002; PORT0CONTROL = $0003; PORT1A = $0004; PORT1B = $0005; PORT1C = $0006; PORT1CONTROL = $0007; COSENABLE = $000B; CLRCOSINT = $000F; implementation (***************************************************************************** * FUNCTION: IOD48_cos_enable -- export routine * * * * PURPOSE: To write the enable word passed to it to the IOD48 board. See * * IOD48 board manual for more information. * * * * INPUT: unsigned port: contains the board port address. * * char value: control value to write. * * * * OUTPUT: None. * * * * CALLS: None. * * * *****************************************************************************) procedure IOD48_cos_enable(portad : integer; value : integer); begin port[portad + COSENABLE] := value; { send the byte } end; { end IOD48_cos_enable } (***************************************************************************** * FUNCTION: IOD48_clr_cos_int -- export routine * * * * PURPOSE: To write anything to this board address, clears any interrupts * * caused by change of state. * * * * INPUT: unsigned port: contains the board port address. * * * * OUTPUT: None. * * * * CALLS: None. * * * *****************************************************************************) procedure IOD48_clr_cos_int(portad : integer); begin port[portad + CLRCOSINT] := 0; { send anything } end; { end IOD48_clr_cos_int } (***************************************************************************** * FUNCTION: IOD48_read_port -- export routine * * * * PURPOSE: Reads the value contained at one of the 6 ports contained on * * the IOD48 board. * * * * INPUT: unsigned port: contains the board port address. * * unsigned offset: determines which port to read. * * * * OUTPUT: Returns the value read in from the board. * * * * CALLS: None. * * * *****************************************************************************) function IOD48_read_port(portad : integer; offset : integer) : integer; var value : integer; begin value := port[portad + offset]; IOD48_read_port := value; end; { end IOD48_read_port } (***************************************************************************** * FUNCTION: IOD48_port_control -- export routine * * * * PURPOSE: Writes the control word to the PPI indicated by offset. This * * word determines the direction of digital I/O as well mode. * * See IOD48 manual for more information. * * * * INPUT: unsigned port: contains the board port address. * * unsigned offset: determines which PPI to write to. * * char value: control word to write. * * * * OUTPUT: None. * * * * CALLS: None. * * * *****************************************************************************) procedure IOD48_port_control(portad : integer; offset : integer; value : integer); begin port[portad + offset] := value; { send the byte } end; { end IOD48_port_control } begin end.