#include <rb8506_sifu.h>
Inherits Pia.
Provide digital inputs and outputs.
Module RB8506, SIFU variant, is a digital input-output interface. It has four level-sensitive inputs, four negative-edge-sensitive inputs, four level outputs and four outputs that can be pulsed as a group.
There is also a provision to check if any of both the negative-edge-sensitive inputs and the level-sensitive inputs have changed state since it was last checked.
Inputs and outputs are available in TTL and in CMOS: TTL or CMOS can be selected with a switch on the front, two inputs or two outputs at the time. A LED indicates if TLL (red) or CMOS (green) is selected.
The SIFU module consists of a PIA parallel interface (see Pia) and a Sense Interrupt Flag Unit (SIFU) board.
The table below indicates which lines are pulse or level inputs-ouputs.
line | kind of input-output ------+---------------------- 0 | ] 1 | ] level 2 | ] 3 | ] | 4 | ] 5 | ] negative pulse 6 | ] note 1 7 | ]
Note 1: contrary to what the hardware documentation states, I think that the pulse inputs are sensitive to a high-low transition.
When SIFU is created, its parallel interface (PIA) is configured as follows:
The class provides methods to read all inputs at a time or to read each input line individually. It also allows to check if any line has changed since the last time it was checked. Ouputs may be read or written all at once or each output may be read or written individually. Four pulse outputs can be pulsed at one time.
RB8506_Sifu sifu( "sifu" ); if ( sifu.inputLineHasChanged() ) { sifu.setOuputPortData( sifu.getInputPortData() ); }
The following tables show how the SIFU input-output lines are connected to the PIA of the parallel interface.
output line | PIA port A -------------+--------------------------------- level 0 | PA0 1 | PA1 2 | PA2 3 | PA3 | pulse 4 | PA4 ] 5 | PA5 ] 6 | PA6 ] pulsed via CA2 7 | PA7 ]
The pulse outputs are pulsed via control line CA2 (see enablePulseOutputs()).
input line | PIA port B -------------+--------------------------------- level 0 | PB4 note 1 1 | PB5 2 | PB6 3 | PB7 | pulse 4 | PB0 ] 5 | PB1 ] high-low transition 6 | PB2 ] recorded via CB1 7 | PB3 ] note 2
Note 1: lines 0--3 connect to PB4--PB7 and that lines 4--7 connect to PB0--PB3.
Note 2: contrary to what the hardware documentation states, I think that CB1 must act on a high-low transistion.
Changes in one or more of the level inputs or a negative transition on one or more of the pulse inputs are recorded via CB1 (see isChangedInputLine()).
Public Member Functions | |
Construction | |
~RB8506_Sifu () | |
destructor. | |
RB8506_Sifu (NameCref name, Addr addr=DEF_ADDR, Rack rack=DEF_RACK) | |
constructor. | |
Accessors | |
int | getInputPortData () |
the input data bit-pattern; also clears input flip-flops. | |
int | getOutputPortData () |
the bit-pattern of the outputs. | |
bool | isChangedInputLine () |
true if the level of one or more input lines have changed; clears input-has-changed flag; see also tstInputLineLevel(). | |
int | tstInputLineLevel (int line) |
the level of the specified input line; clears input-has-changed flag, retains state of input flip-flops; see also inputLineHasChanged(); may throw RulbusRangeError. | |
int | getInputLineLevel (int line) |
the level of the specified input line; clears input flip-flops; may throw RulbusRangeError. | |
int | getOutputLineLevel (int line) |
the line level of the specified output line; may throw RulbusRangeError. | |
bool | isEnabledPulseOutputs () |
true if the pulse outputs are enabled. | |
Mutators | |
void | setOutputPortData (int data) |
set the outputs to the specified bit-pattern; may throw RulbusRangeError. | |
void | setOutputLineLevel (int line, bool set) |
set or clear specified output line; may throw RulbusRangeError. | |
void | enablePulseOutputs (bool enable=true) |
enable or disable the pulse outputs. | |
Static Public Attributes | |
Defaults | |
const Addr | DEF_ADDR = Pia::DEF_ADDR + 4 |
default address (second PIA) | |
const int | DEF_DIRPA = 0xFF |
port A is output | |
const int | DEF_DIRPB = 0x00 |
port B is input | |
const char | DEF_EDGECB1 = 'p' |
positive active edge | |
const char | DEF_DIRCA2 = 'o' |
CA2 output. | |
const char | DEF_DIRCB2 = 'o' |
CB2 output. | |
const char | DEF_LVLCA2 = 0 |
CA2 0. | |
const char | DEF_LVLCB2 = 1 |
CB2 1. | |
const bool | DEF_INTRCB1 = true |
enable CB1 interrupt flag | |
const int | DEF_OUTDATA = 0 |
default output levels | |
Protected Member Functions | |
Construction and Assignment | |
RB8506_Sifu () | |
prevent default construction | |
RB8506_Sifu (RB8506_SifuCref rhs) | |
prevent copying | |
RB8506_SifuRef | operator= (RB8506_SifuCref rhs) |
prevent copying | |
Tools | |
void | clearFlipFlops () |
clear pulse input flip-flops. | |
Static Protected Member Functions | |
Class tools | |
int | swapNibbles (int byte) |
swap input data for line 0..3 with line 4..7. | |
int | swapLines (int line) |
swap input linenumber 0..3 with lne 4..7. |