United Kingdom:One Omega Drive, River Bend Technology Centre
ISO 9002 CertifiedNorthbank, Irlam, Manchester
M44 5BD United Kingdom
TEL: +44 (0)161 777 6611FAX: +44 (0)161 777 6622
Toll Free in United Kingdom: 0800-488-488
e-mail: sales@omega.co.uk
OMEGAnet®Online Service Internet e-mail
www.omega.com info@omega.com
It is the policy of OMEGA to comply with all worldwide safety and EMC/EMI regulations that
apply. OMEGA is constantly pursuing certification of its products to the European New Approach
Directives. OMEGA will add the CE mark to every appropriate device upon certification.
The information contained in this document is believed to be correct, but OMEGA Engineering, Inc. accepts
no liability for any errors it contains, and reserves the right to alter specifications without notice.
WARNING: These products are not designed for use in, and should not be used for, patient-connected applications.
Page 3
OME-PIO-D96
User Manual
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003, PPH-008-11) ---- 1
Refer to Sec. 2.1 for board layout & I/O port location.
Note: Each PC0 can be used as interrupt signal source. Refer to Sec. 2.5 for more
information.
2.3 Enable I/O Operation
When the PC is powered up, all D/I/O ports are disabled. The enable/disable
of D/I/O is controlled by the RESET\ signal. Refer to Sec. 3.3.1 for more information
about RESET\ signal. The power-up states are given as follows:
• All D/I/O operations are disabled
• All twelve D/I/O ports are configured as D/I port
• All D/O latch register are undefined.(refer to Sec. 2.4)
The user has to perform some initialization before using these D/I/Os. These
recommended steps are given as follows:
Step 1: find address-mapping of PIO/PISO cards (refer to Sec. 3.1)
Step 2: enable all D/I/O operation (refer to Sec. 3.3.1)
Step 3: configure the first three ports to their expected D/I/O state & send the
initial value to all D/O ports (refer to Sec. 3.3.7)
Step 4: configure the other three ports to their expected D/I/O state & send
the initial value to all D/O ports(refer to Sec. 3.3.7)
Refer to DEMO1.C for demo program.
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 7
Page 10
2.4 D/I/O Architecture
I/O select (Sec. 3.3.7)
RESET\ (Sec. 3.3.1)
Data
(Sec. 3.3.8)
disable\
input Latch
Clock input
D/O latch CKT
D/I/O
• The RESET\ is in Low-state Æ all D/I/O are disabled
• The RESET\ is in High-state Æ all D/I/O are enabled
• If D/I/O is configured as D/I port Æ D/I= external input signal
• If D/I/O is configured as D/O port Æ D/I = read back D/O
• If D/I/O is configured as D/I port Æ send to D/O will change the D/O latch
register only. The D/I & external input signal will not change
Data
(Sec. 3.3.8)
disable
Buffer input
Clock input
D/I buffer CKT
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 8
Page 11
2.5 Interrupt Operation
All P2C0, P5C0, P8C0 and P11C0 can be used as interrupt signal sources. Refer
to Sec. 2.1 & Sec. 2.7 for P2C0/P5C0/P8C0/P11C0 location. The interrupt of OME-
PIO-D96 is
or non-inverted
follows:
1. make sure the initial level is High or Low
2. if the initial state is High Æ select the
3. if the initial state is Low Æ select the non-inverted signal (Sec. 3.3.6)
4. enable the INT function (Sec. 3.3.4)
5. If the interrupt signal is active Æ program will transfer into the interrupt
Refer to DEMO3.C & DEMO4.C for single interrupt source. Refer to
DEMO5.C for four interrupt sources.
If only one interrupt signal source is used, the interrupt service routine does not
have to identify the interrupt source. (Refer to DEMO3.C & DEMO4.C)
If there are more than one interrupt sources, the interrupt service routine has to
level-trigger & Active_High. The interrupt signal can be inverted
programmable. The procedures of programming are given as
inverted signal (Sec. 3.3.6)
service routine Æ if INT signal is High now Æ select the inverted input
Æ if INT signal is Low now Æ select the non-inverted input
identify the active signals as follows: (Refer to DEMO5.C)
1. Read the new status of the interrupt signal source
2. Compare the new status with the old status to identify the active signals
3. If P2C0 is active, service P2C0 & non-inverter/inverted the P2C0 signal
4. If P5C0 is active, service P5C0 & non-inverted/inverted the P5C0 signal
5. If P8C0 is active, service P8C0 & non-inverted/inverted the P8C0 signal
6. If P11C0 is active, service P11C0 & non-inverted/inverted the P11C0 signal
7. Save the new status to old status
Note: If the interrupt signal is too short, the new status may be as same as old
status. So the interrupt signal must be hold-active until the interrupt service
routine is executed. This hold time is different for different operating systems.
The hold time can be as short as micro-second or as long as second. In general,
20ms is enough for most operating systems.
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 9
Page 12
2.5.1 Interrupt Block Diagram of OME-PIO-D96
INT_CHAN_0
INT\
Level_trigger
The interrupt output signal of OME-PIO-D96, INT\, is Level_trigger &
Active_Low. If the INT\ generate a low-pulse, the OME-PIO-D96 will interrupt the
PC only once. If the INT\ is fixed in low level, the OME-PIO-D96 will interrupt the
PC continuously. So that INT_CHAN_0/1/2/3 must be controlled in a pulse type
signals. They must be fixed in low level state normally and generated a
high_pulse to interrupt the PC.
The priority of INT_CHAN_0/1/2/3 is the same. If all these four signals are active
at the same time, then INT\ will be active only once a time. So the interrupt service
INT_CHAN_1
INT_CHAN_2
INT_CHAN_3
initial_low
active_high
routine has to read the status of all interrupt channels for multi-channel interrupt.
Refer to Sec. 2.5 for mare information.
DEMO5.C → for multi-channel interrupt source
If only one interrupt source is used, the interrupt service routine doesn’t have to read
the status of interrupt source. The demo programs, DEMO3.C & DEMO4.C are
designed for single-channel interrupt demo as follows:
DEMO3.C → for INT_CHAN_0 only (P2C0 initial low)
DEMO4.C → for INT_CHAN_0 only (P2C0 initial high)
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 10
Page 13
2.5.2 INT_CHAN_0/1/2/3
INT_CHAN_0 (1/2/3)
P2C0(P5C0/P8C0/P11C0)
Inverted/Noninverted select
INV0(1/2/3)
Enable/Disable select
EN0(1/2/3)
The INT_CHAN_0(1/2/3) must be fixed in low level state normally and
generated a high_pulse to interrupt the PC.
The EN0 (EN1/EN2/EN3) can be used to enable/disable the INT_CHAN_0(1/2/3)
as follows: (Refer to Sec. 3.3.4)
EN0 (1/2/3) = 0 → INT_CHAN_0(1/2/3) = disable
EN0 (1/2/3) = 1 → INT_CHAN_0(1/2/3) = enable
The INV0 can be used to invert/non-invert the PC0 (1/2/3) as follows: (Refer to
Sec.3.3.6)
INV0 (1/2/3) = 0 → INT_CHAN_0(1/2/3) = inverted state of P2C0
(P5C0/P8C0/P11C0)
INV0 (1/2/3) = 1 → INT_CHAN_0(1/2/3) = non-inverted state of P2C0
(P5C0/P8C0/P11C0)
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 11
Page 14
2.5.3 Initial_high, active_low Interrupt source
If the P2C0 is an initial_high, active_low signal, the interrupt service routine
should use INV0 to invert or not to invert the P2C0 for high_pulse generation as
follows: (Refer to DEMO4.C)
Initial set:
now_int_state=1; /* initial state for P2C0 */
outportb(wBase+0x2a,0); /* select the inverted P2C0 */
void interrupt irq_service()
{
if (now_int_state==1) /* now P2C0 is changed to LOW */(a)
{ /* --> INT_CHAN_0=!P2C0=HIGH now */
COUNT_L++; /* find a LOW_pulse (P2C0) */
If((inport(wBase+7)&1)==0)/* the P2C0 is still fixed in LOW */
{ /* Æ need to generate a high_pulse */
outportb(wBase+0x2a,1);/* INV0 select the non-inverted input */(b)
/* INT_CHAN_0=P2C0=LOW --> */
/* INT_CHAN_0 generate a high_pulse */
now_int_state=0; /* now P2C0=LOW */
}
else now_int_state=1; /* now P2C0=HIGH */
/* don’t have to generate high_pulse */
}
else /* now P2C0 is changed to HIGH */(c)
{ /* --> INT_CHAN_0=P2C0=HIGH now */
COUNT_H++; /* find a HIGH_pulse (P2C0) */
If((inport(wBase+7)&1)==1)/* the P2C0 is still fixed in HIGH */
{ /* need to generate a high_pulse */
outportb(wBase+0x2a,0);/* INV0 select the inverted input */(d)
/* INT_CHAN_0=!P2C0=LOW --> */
/* INT_CHAN_0 generate a high_pulse */
now_int_state=1; /* now P2C0=HIGH */
}
else now_int_state=0; /* now P2C0=LOW */
/* don’t have to generate high_pulse */
}
if (wIrq>=8) outportb(A2_8259,0x20);
outportb(A1_8259,0x20);
}
P2C0
(a)(b)(c)(d)
INV0
INT_CHAN_0
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 12
Page 15
2.5.4 Initial_low, active_high Interrupt source
If the P2C0 is an initial_low, active_high signal, the interrupt service routine
should use INV0 to invert or not to invert the P2C0 for high_pulse generation as
follows: (Refer to DEMO3.C)
Initial set:
now_int_state=0; /* initial state for P2C0 */
outportb(wBase+0x2a,1); /* select the non-inverted P2C0 */
void interrupt irq_service()
{
if (now_int_state==1) /* now P2C0 is changed to LOW */(c)
{ /* --> INT_CHAN_0=!P2C0=HIGH now */
COUNT_L++; /* find a LOW_pulse (P2C0) */
If((inport(wBase+7)&1)==0)/* the P2C0 is still fixed in LOW */
{ /* Æ need to generate a high_pulse */
outportb(wBase+0x2a,1);/* INV0 select the non-inverted input */(d)
/* INT_CHAN_0=P2C0=LOW --> */
/* INT_CHAN_0 generate a high_pulse */
now_int_state=0; /* now P2C0=LOW */
}
else now_int_state=1; /* now P2C0=HIGH */
/* don’t have to generate high_pulse */
}
else /* now P2C0 is changed to HIGH */(a)
{ /* --> INT_CHAN_0=P2C0=HIGH now */
COUNT_H++; /* find a High_pulse (P2C0) */
If((inport(wBase+7)&1)==1)/* the P2C0 is still fixed in HIGH */
{ /* need to generate a high_pulse */
outportb(wBase+0x2a,0);/* INV0 select the inverted input */(b)
/* INT_CHAN_0=!P2C0=LOW --> */
/* INT_CHAN_0 generate a high_pulse */
now_int_state=1; /* now P2C0=HIGH */
}
else now_int_state=0; /* now P2C0=LOW */
/* don’t have to generate high_pulse */
}
if (wIrq>=8) outportb(A2_8259,0x20);
outportb(A1_8259,0x20);
}
P2C0
(a)(b)(c)(d)
INV0
INT_CHAN_0
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 13
Page 16
2.5.5 Muliti Interrupt Source
Assume: P2C0 is initial Low, active High,
P5C0 is initial High, active Low
P8C0 is initial Low, active High
P11C0 is initial High, active Low
as follows:
P2C0
P5C0
P8C0
P11C0
P2C0 & P5C0 are
active at the same
time.
P8C0 & P11C0
are active at the
same time.
Refer to DEMO5.C for the source. All these four falling edges & rising edges can
be detected by DEMO5.C.
P2C0 & P5C0 are
return to normal
at the same time.
P8C0 & P11C0 are
return to normal at
the same time.
Note: When the interrupt is active, the user program has to identify the active
signals. Multiple signals maybe active simultaneously. So the interrupt service
routine has to service all active signals at the same time.
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 14
Page 17
void interrupt irq_service()
{
new_int_state=inportb(wBase+7)&0x0f; /* read all interrupt state */
int_c=new_int_state^now_int_state; /* compare which interrupt */
/* signal be change */
if ((int_c&0x1)!=0) /* INT_CHAN_0 is active */
{
if ((new_int_state&0x01)!=0) /* now P2C0 change to high */
{
CNT_H1++;
}
else /* now P2C0 change to low */
{
CNT_L1++;
}
invert=invert^1; /* to generate a high pulse */
}
if ((int_c&0x2)!=0)
{
if ((new_int_state&0x02)!=0) /* now P5C0 change to high */
{
CNT_H2++;
}
else /* now P5C0 change to low */
{
CNT_L2++;
{
invert=invert^2; /* to generate a high pulse */
}
if ((int_c&0x4)!=0)
{
If ((new_int_state&0x04)!=0) /* now P8C0 change to high */
{
CNT_H3++;
}
else /* now P8C0 change to low */
{
CNT_L3++;
}
invert=invert^4; /* to generate a high pulse */
}
if ((int_c&0x8)!=0)
{
if ((new_int_state&0x08)!=0) /* now P11C0 change to high */
{
CNT_H4++;
{
else /* now P11C0 change to low */
{
CNT
}
invert
}
now_in
outportb(wBase+0x2a,invert);
if (wIrq>=8) outportb(A2_8259,
outportb(A1_8259,0x20);
}
_L4++;
=invert^8; /* to generate a high pulse */
t_state=new_int_state;
0x20);
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 15
Page 18
2.6 Daughter Boards
2.6.1 OME-DB-37
The OME-DB-37 is a general purpose daughter board for D-sub 37 pins. It is
designed for easy wire connection.
2.6.2 OME-DN-37 & OME-DN-50
The OME-DN-37 is a general purpose daughter board for D-sub 37-pin connector.
The OME-DN-50 is designed for 50-pin flat-cable header. They are designed for easy
wiring. Both are DIN rail mountable.
37pin cable
OME-DN-37
2.6.3 OME-DB-8125
The OME-DB-8125 is a general purpose screw terminal board. It is designed for
easy wiring. There is one D-sub 37-pin connector & two 20-pin flat-cable headers in the
OME-DB-8125.
37pin cable
OME-DB-8125
(D-sub 37-pin or
20-pin flat-cable header)
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 16
Page 19
2.6.4 OME-ADP-37/PCI & OME-ADP-50/PCI
The OME-ADP-37/PCI & OME-ADP-50/PCI are extenders for 50-pin
headers. One side of OME-ADP-37/PCI & OME-ADP-50/PCI can be connected to a
50-pin header. The other side can be mounted on the PC chassis as follows:
OME-ADP-37/PCI: 50-pin header to D-sub 37 extender.
OME-ADP-50/PCI: 50-pin header to 50-pin header extender.
NOTE: The user has to choose the suitable extender for their boards.
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 17
Page 20
2.6.5 OME-DB-24P/24PD Isolated Input Board
The OME-DB-24P is a 24 channel isolated digital input daughter board. The
optically isolated inputs of the OME-DB-24P, consists of a bi-directional opto-
coupler with a resistor for current sensing. You can use the OME-DB-24P to sense
DC signal from TTL levels up to 24V or use the OME-DB-24P to sense a wide range
of AC signals. You can use this board to isolate the computer from large common-
mode voltage, ground loops and transient voltage spikes that often occur in industrial
environments.
OME-PIO-D96
Opto-Isolated
OME-PIO-D96
50Pin cable
OME-DB-24P
AC or DC Signal
0V to 24V
+
-
OME-DB-24P OME-DB-24PD
50-pin flat-cable header Yes Yes
D-sub 37-pin header No Yes
Other specifications Same
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 18
Page 21
2.6.6 OME-DB-24R/24RD Relay Board
The OME-DB-24R, 24 channel relay output board, consists of 24 form C relays
for efficient switch of load by programmed control. The relays are energized by apply
12V/24V signal to the appropriated relay channel on the 50-pin flat connector. There
are 24 enunciator LEDs for each relay and they light when their associated relay is
activated.
Form C Relay
50Pin cable
OME-PIO-D96
Normal Open
Normal Close
Com.
OME-DB-24R
Note:
Channel : 24 Form C Relays
Relay : Switching up to 0.5A at 110ACV
or 1A at 24DCV
OME-DB-24R OME-DB-24RD
50-pin flat-cable header Yes Yes
D-sub 37-pin header No Yes
Other specifications Same
OME-DB-24R, OME-DB-24RD 24*Relay (120V, 0.5A)
OME-DB-24PR, OME-DB-24PRD 24* Power Relay (250V, 5A)
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 19
Page 22
2.6.7 OME-DB-24PR/24POR/24C
y
OME-DB-24PR 24*power relay, 5A/250V
OME-DB-24POR 24*Photo MOS relay, 0.1A/350VAC
OME-DB-24C 24*open collector, 100mA per channel, 30V max.
The OME-DB-24PR, 24 channel power relay output board, consists of 8 form C
and 16 form A electromechanical relays for efficient switching of load by
programmed control. The contact of each relay can control a 5A load at
250VAC/30VDC. The relay is energized by applying a 5 volt signal to the appropriate
relay channel on the 20-pin flat cable connector (only 16 relays) or 50-pin flat cable
connector(compatible for OME-DIO-24 series). Twenty-four enunciator LEDs, one
for each relay, light when their associated relay is activated. To avoid overloading
your PC’s power supply, this board needs a +12VDC or +24VDC external power
supply.
Normal Open
Form A Relay
Com.
50Pin cable
To 50pin connector
OME-DB-24PR
CN2 ~ CN4=D/O
OME-PIO-D96
Note:
50-Pin connector for OME-DIO-24, OME-DIO-48, OME-DIO-144,
Note: If your board is a different version, it may also have different Sub IDs.
However this will present no actual problem. No matter which version of the
board you select, we offer the same function calls.
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 26
to DEMO5.C for more information. The Aux 0~3 are used as interrupt source. The
interrupt service routine has to read this register for interrupt source identification.
Refer to Sec. 2.5 for more information.
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 32
Page 35
3.3.6 Interrupt Polarity Control Register
(Read/Write): wBase+0x2A
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 0 0 0 INV3 INV2 INV1 INV0
Note. Refer to Sec. 3.1 for more information about wBase.
INV0=1Æ select the non-inverted signal from P2C0
INV0=0Æ select the inverted signal from P2C0
outportb(wBase+0x2a,0x0f); /* select the non-inverted input P2/5/8/11C0 */
outportb(wBase+0x2a,0x00); /* select the inverted input of P2/5/8/11C0 */
outportb(wBase+0x2a,0x0e); /* select the inverted input of P2C0 */
/* select the non-inverted input P5/8/11C0 */
outportb(wBase+0x2a,0x0c); /* select the inverted input of P2/5C0 */
/* select the non-inverted input P8/11C0 */
Refer to Sec. 2.5 for more information.
Refer to DEMO5.C for more information.
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 33
Page 36
3.3.7 I/O Selection Control Register
(Write): wBase+0xcc
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 0 0 0 0 Port2 Port1 Port0
(Write): wBase+0xdc
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 0 0 0 0 Port5 Port4 Port3
(Write): wBase+0xec
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 0 0 0 0 Port8 Port7 Port6
(Write): wBase+0xfc
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 0 0 0 0 Port11 Port10 Port9
Note. Refer to Sec. 3.1 for more information about wBase.
Before using these D/I/O ports, user has to configure the state of ports as desired.
port?=1Æ this port is used as a D/O port
port?=0Æ this port is used as a D/I port
outportb(wBase+0xcc,0x03); /* set port0 as D/O ports */
/* set port1 as D/O ports */
/* set port2 as D/I ports */
outportb(wBase+0xdc,0x07); /* set port3 ~ port5 as D/O ports */
outportb(wBase+0xec,0x00); /* set port6 ~ port8 as D/I ports */
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 34
Page 37
3.3.8 Read/Write 8-bit data Register
(Read/Write):wBase+0xc0/0xc4/0xc8/0xd0/0xd4/0xd8/
0xe0/0xe4/0xe8/0xf0/0xf4/0xf8/
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
D7 D6 D5 D4 D3 D2 D1 D0
Note. Refer to Sec. 3.1 for more information about wBase.
There are twelve 8-bit I/O port in the OME-PIO-D96. Every I/O port can be
programmed as D/I or D/O port. Refer to Sec. 3.3.8 for D/I or D/O selection. When
the PC is power-up, all twelve ports are used as D/I port.
outportb(wBase+0xc0,Val); /* write to Port0 */
Val=inportb(wBase+0xc0); /* read from Port0 */
outportb(wBase+0xcc,0x07); /* set port0~port2 as D/O ports */
outportb(wBase+0xc0,i1); /* write to Port0 */
outportb(wBase+0xc4,i2); /* write to Port1 */
outportb(wBase+0xc8,i3); /* write to Port2 */
outportb(wBase+0xec,0x04); /* set Port6 & Port7 as D/I ports */
/* set Port8 as D/O port */
j1=inportb(wBase+0xe0); /* read Port6 */
j2=inportb(wBase+0xe4); /* read Port7 */
outportb(wBase+0xe8,j3); /* write to Port8 */
NOTE: Make sure the I/O port configuration (DI or DO) before performing
read/write to the data register. (Refer to sec. 3.3.7)
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 35
Page 38
4. Demo program
It is recommended to read the release note first. All important information will be
given in release note as follows:
1. Where you can find the software driver & utility?
2. How to install software & utility?
3. Where is the diagnostic program?
4. FAQ
The demo programs are provided on the software floppy disk or CD. After the
software installation, the driver will be installed into disk as follows:
• \TC\*.* Æ for Turbo C 2.xx or above
• \MSC\*.* Æ for MSC 5.xx or above
• \BC\*.* Æ for BC 3.xx or above
• \TC\LIB\*.* Æ for TC library
• \TC\DEMO\*.* Æ for TC demo program
• \TC\LIB\Large\*.* Æ TC large model library
• \TC\LIB\Huge\*.* Æ TC huge model library
• \TC\LIB\Large\PIO.H Æ TC declaration file
• \TC\\LIB\Large\TCPIO_L.LIB Æ TC large model library file
• \TC\LIB\Huge\PIO.H Æ TC declaration file
• \TC\\LIB\Huge\TCPIO_H.LIB Æ TC huge model library file
• \MSC\LIB\Large\PIO.H Æ MSC declaration file
• \MSC\LIB\Large\MSCPIO_L.LIB Æ MSC large model library
file
• \MSC\LIB\Huge\PIO.H Æ MSC declaration file
• \MSC\\LIB\Huge\MSCPIO_H.LIB Æ MSC huge model library file
• \BC\LIB\Large\PIO.H Æ BC declaration file
• \BC\LIB\Large\BCPIO_L.LIB Æ BC large model library file
• \BC\LIB\Huge\PIO.H Æ BC declaration file
• \BC\\LIB\Huge\BCPIO_H.LIB Æ BC huge model library file
NOTE: The library is validated for all OME-PIO/PISO series cards.
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 36
Page 39
4.1 PIO_PISO
/* ------------------------------------------------------------ */
/* Find all PIO_PISO series cards in this PC system */
/* step 1 : plug all PIO_PISO cards into PC */
/* step 2 : run PIO_PISO.EXE */
/* ------------------------------------------------------------ */
#include "PIO.H"
WORD wBase,wIrq;
WORD wBase2,wIrq2;
int main()
{
int i,j,j1,j2,j3,j4,k,jj,dd,j11,j22,j33,j44;
WORD wBoards,wRetVal;
WORD wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
char c;
float ok,err;
clrscr();
wRetVal=PIO_DriverInit(&wBoards,0xff,0xff,0xff); /*for PIO-PISO*/
printf("\nThrer are %d PIO_PISO Cards in this PC",wBoards);
if (wBoards==0 ) exit(0);
NOTE: the PIO_PISO.EXE is valid for all PIO/PISO cards. The user can execute
the PIO_PISO.EXE to get the following information:
• List all PIO/PISO cards installed in this PC
• List all resources allocated to every PIO/PISO cards
• List the wSlotBus & wSlotDevice for specified PIO/PISO card identification.
(Refer to Sec. 3.2 for more information)
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 37
Page 40
4.1.1 PIO_PISO.EXE for Windows
User can find this utility in the software CD or floppy disk. It is useful for all
OME-PIO/PISO series cards.
After executing the utility, detailed information for all OME-PIO/PISO cards that
are installed in the PC will be shown as follows:
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 38
Page 41
4.2 DEMO1
/* demo 1 : D/O demo of CN1 */
/* step 1 : connect a OME-DB-24C to CN1 of OME-PIO-D96 */
/* step 2 : run DEMO1.EXE */
/* step 3 : check the LEDs of OME-DB-24C will turn on sequentially*/
/* -------------------------------------------------------------- */
#include "PIO.H"
WORD wBase,wIrq;
main()
{
int i1,i2,i3;
long i=1;
WORD wBoards,wRetVal,t1,t2,t3,t4,t5,t6;
WORD wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
char c;
clrscr();
/* step1 : find address-mapping of PIO/PISO cards */
wRetVal=PIO_DriverInit(&wBoards,0x80,0x01,0x10); /* for OME-PIO-D96
*/
printf("\n(1) Threr are %d OME-PIO-D96 Cards in this PC",wBoards);
if ( wBoards==0 ) exit(0);
printf("\n\n-------------- The Configuration Space --------------");
for(i=0;i<wBoards;i++)
{
PIO_GetConfigAddressSpace(i,&wBase,&wIrq,&wSubVendor,&wSubDevice
printf("\nCard_%d: wBase=%x,wIrq=%x,subID=[%x,%x,%x],
SlotID=[%x,%x]",i,wBase,wIrq,wSubVendor,wSubDevice,
wSubAux,wSlotBus,wSlotDevice);
printf(" --> ");
ShowPioPiso(wSubVendor,wSubDevice,wSubAux);
}
PIO_GetConfigAddressSpace(0,&wBase,&wIrq,&t1,&t2,&t3,&t4,&t5);
/* select card_0 */
/* step2 : enable all D/I/O port */
outportb(wBase,1); /* /RESET -> 1 */
/* step3 : configure I/O direction */
outportb(wBase+0xcc,0x07); /* set CN1 as D/O ports */
for (;;)
{
i1=i&0xff;
i2=(i>>8)&0xff;
i3=(i>>16)&0xff;
outportb(wBase+0xc0,i1);
outportb(wBase+0xc4,i2);
outportb(wBase+0xc8,i3);
delay(10000);
i=i<<1;
i=i&0x0ffffff;
if (i==0) i=1;
if (kbhit()!=0) return;
}
PIO_Dri
}
verClose();
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 39
Page 42
4.3 DEMO2
/* demo 2 : DI/O demo of CN2 - CN3 */
/* step 1 : connect CN2 t0 CN3 of OME-PIO-D96
*/
/* step 2 : run DEMO2.EXE */
/* step 3 : check the information on screen D/I will same as D/O */
/* -------------------------------------------------------------- */
#include "PIO.H"
WORD wBase,wIrq;
main()
{
int i1,i2,i3,j1,j2,j3;
WORD wBoards,wRetVal,t1,t2,t3,t4,t5,t6;
WORD wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
char c;
long i=1;
clrscr();
/* step1 : find address-mapping of PIO/PISO cards */
.
.
/* step2 : enable all D/I/O port */
outportb(wBase,1); /* /RESET -> 1 */
/* step3 : configure I/O direction */
outportb(wBase+0xdc,0x07); /* set CN2 as D/O ports */
outportb(wBase+0xec,0x00); /* set CN3 as D/I ports */
static void interrupt irq_service();
int COUNT_L,COUNT_H,irqmask,now_int_state;
int main()
{
int i,j;
WORD wBoards,wRetVal,t1,t2,t3,t4,t5,t6;
WORD wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
char c;
clrscr();
/* step1 : find address-mapping of PIO/PISO cards */
.
.
/* select card_0 */
/* step2 : enable all D/I/O port */
outportb(wBase,1); /* /RESET -> 1 */
/* step3 : configure I/O direction */
outportb(wBase+0xcc,0x00); /* set CN1 as D/I ports */
init_low();
printf("\n\n***** show the count of High_pulse *****\n");
for (;;)
{
gotoxy(1,8);
printf("\nCOUNT_H=%d",COUNT_H);
if (kbhit()!=0) break;
}
outportb(wBase+5,0); /* disable all interrupt */
PIO_DriverClose();
}
/* Use P2C0 as external interrupt signal */
WORD init_low()
{
disable();
outportb(wBa
if (wIrq<8)
{
irq
outportb(A1_8259+1,irqmask &
setvect(wIrq+8,irq_service);
}
else
mask=inportb(A1_8259+1);
se+5,0); /* disable all interrupt */
0xff ^ (1<<wIrq));
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 41
ou
now_int_state=0; /* now ini_signal is low */
outportb(wBase+0x2a,1); /* select the non-inverte */
enable();
}
d interrupt irq_service()
ivo
{
(now_int_state==1) if
/* now P2C0 change to low */
{ /* INT_CHAN_0 = !P2C0 */
COUNT_L++; /* find a low pulse (P2C0) */
if ((inportb(wBase+7)&1)==0) /* P2C0 still fixed in low */
{ /* need to generate a high pulse */
outportb(wBase+0x2a,1); /* INV0 select noninverted input */
now_int_state=0; /* now P2C0=low */
}
now_int_state=1; /* now P2C0=High */ else
}
/* now P2C0 change to high */ else
{ /* INT_CHAN_0 = P2C0 */
COUNT_H++; /* find a high pulse (P2C0) */
if ((inportb(wBase+7)&1)==1) /* P2C0 still fixed in high */
{ /* need to generate a high pulse */
outportb(wBase+0x2a,0); /* INV0 select inverted input */
now_int_state=1; /* now P2C0=high */
}
now_int_state=0; /* now P2C0=low */ else
}
rq>=8) outportb(A2_8259,0x20);
(wIif
outportb(A1_8259,0x20);
}
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 42
Page 45
4.5 DEMO4
/* demo 4 : Count high pulse of P2C0 */
/* (initial High & active Low) */
/* step 1 : run DEMO4.EXE */
/* -------------------------------------------------------------- */
static void interrupt irq_service();
int COUNT_L,COUNT_H,irqmask,now_int_state;
int main()
{
int i,j;
WORD wBoards,wRetVal,t1,t2,t3,t4,t5,t6;
WORD wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
char c;
clrscr();
/* step1 : find address-mapping of PIO/PISO cards */
.
.
/* select card_0 */
/* step2 : enable all D/I/O port */
outportb(wBase,1); /* /RESET -> 1 */
/* step3 : configure I/O direction */
outportb(wBase+0xcc,0x00); /* set CN1 as D/I ports */
init_high();
printf("\n\n***** show the count of Low_pulse *****\n");
for (;;)
{
gotoxy(1,7);
printf("\nCOUNT_L=%d",COUNT_L);
if (kbhit()!=0) break;
}
outportb(wBase+5,0); /* disable all interrupt */
PIO_DriverClose();
}
/* Use P2C0 as external interrupt signal */
WORD init_high()
{
disable();
outportb(wBa
if (wIrq<8)
{
irq
outportb(A1_8259+1,irqmask &
setvect(wIrq+8,irq_service);
}
else
mask=inportb(A1_8259+1);
se+5,0); /* disable all interrupt */
0xff ^ (1<<wIrq));
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 43
ou
now_int_state=1; /* now ini_signal is high */
outportb(wBase+0x2a,0); /* select the inverte */
enable();
}
d interrupt irq_service()
ivo
{
(now_int_state==1) if
/* now P2C0 change to low */
{ /* INT_CHAN_0 = !P2C0 */
COUNT_L++; /* find a low pulse (P2C0) */
if ((inportb(wBase+7)&1)==0) /* P2C0 still fixed in low */
{ /* need to generate a high pulse */
outportb(wBase+0x2a,1); /* INV0 select noninverted input */
now_int_state=0; /* now P2C0=low */
}
now_int_state=1; /* now P2C0=High */ else
}
/* now P2C0 change to high */ else
{ /* INT_CHAN_0 = P2C0 */
COUNT_H++; /* find a high pulse (P2C0) */
if ((inportb(wBase+7)&1)==1) /* P2C0 still fixed in high */
{ /* need to generate a high pulse */
outportb(wBase+0x2a,0); /* INV0 select inverted input */
now_int_state=1; /* now P2C0=high */
}
now_int_state=0; /* now P2C0=low */ else
}
Irq>=8) outportb(A2_8259,0x20); if (w
outportb(A1_8259,0x20);
}
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 44
Page 47
4.6 DEMO5
/* demo 5 : Four interrupt sources */
/* P2C0 : initial Low , active High */
/* P5C0 : initial High , active Low */
/* P8C0 : initial Low , active High */
/* P11C0 : initial High , active Low */
/* step 1 : run DEMO5.EXE */
/* -------------------------------------------------------------- */
static void interrupt irq_service();
int irqmask,now_int_state,new_int_state,invert,int_c,int_num;
int CNT_L1,CNT_L2,CNT_L3,CNT_L4;
int CNT_H1,CNT_H2,CNT_H3,CNT_H4;
int main()
{
int i,j;
WORD wBoards,wRetVal,t1,t2,t3,t4,t5,t6;
WORD wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
char c;
clrscr();
/* step1 : find address-mapping of PIO/PISO cards */
.
.
/* select card_0 */
/* step2 : enable all D/I/O port */
outportb(wBase,1); /* /RESET -> 1 */
/* step3 : configure I/O direction */
outportb(wBase+0xcc,0x00); /* set CN1 as D/I ports */
outportb(wBase+0xdc,0x00); /* set CN2 as D/I ports */
outportb(wBase+0xec,0x00); /* set CN3 as D/I ports */
outportb(wBase+0xfc,0x00); /* set CN4 as D/I ports */
init();
printf("\n***** show the count of pulse *****\n");
for (;;)
{
gotoxy(1,7);
printf("\n(CNT_L,CNT_H)=(%d,%d) (%d,%d) (%d,%d) (%d,%d)
%x",CNT_L1,CNT_H1,CNT_L2,CNT_H2,CNT_L3,CNT_H3,CNT_L4,CNT_H4,int_num);
if (kbhit()!=0) break;
}
tportb(wBase+5,0); /* disable all interrupt */
ou
PIO_DriverClose();
}
Use P2C0, P5C0, P8C0 & P11C0 as external interrupt signal */
/*
WORD init()
{
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 45
Page 48
disable();
outportb(wBa
se+5,0); /* disable all interrupt */
if (wIrq<8)
{
irq
outportb(A1_8259+1,irqmask &
/*
/* NOTE:1.The hold-time of INT_CHAN_0/1/2/3 must long enough */
/* 2.The ISR must read the interrupt status again to the */
/* active interrupt sources. */
/* 3.The INT_CHAN_0&INT_CHAN_1 can be active at the same time*/
/* -------------------------------------------------------------- */
void interrupt irq_service()
{
t_num++; in
new_int_stat
e=inportb(wBase+7)&0x0f;
int_c=new_int_state^now_int_state;
((int_c&0x1)!=0) if
{
if ((new_int_state&0x01)!=0) /*
now P2C0 change to high */
{
CNT_H1++;
}
else
/* now P2C0 change to low */
{
CNT_L1++;
}
invert=invert^
1; /* generate a high pulse */
}
if ((i
if ((new_int_state&0x02)!=0) /*
nt_c&0x2)!=0)
{
now P5C0 change to high */
{
CNT_H2++;
}
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 46
Page 49
else /* now P5C0 change to low */
{
CNT
_L2++;
}
invert
=invert^2; /* generate a high pulse */
}
if ((int_c&0x4)!=0)
{
if ((new_int_state&0x04)!=0) /* now P8C0 change to high */
{
CNT_H3++;
}
/* now P8C0 change to low */ else
{
T_L3++; CN
}
t=invert^4; /* generate a high pulse */ inver
}
if ((int_c&0x8)!=0)
{
((new_int_state&0x08)!=0) /* now P11C0 change to high */
if
{
CNT_H4++;
}
/* now P11C0 change to low */ else
{
T_L4++; CN
}
t=invert^8; /* generate a high pulse */ inver
}
now_int_state=new_int_state;
rtb(wBase+0x2a,invert); outpo
if (wIrq>=8) outportb(A2_8259,
0x20);
outportb(A1_8259,0x20);
}
OME-PIO-D96 User Manual (Ver.1.1, Mar/2003) ---- 47
Page 50
WARRANTY/DISCLAIMER
OMEGA ENGINEERING, INC. warrants this unit to be free of defects in materials and workmanship for a
period of 13 months from date of purchase. OMEGA’s WARRANTY adds an additional one (1) month
grace period to the normal one (1) year product warranty to cover handling and shipping time. This
ensures that OMEGA’s customers receive maximum coverage on each product.
If the unit malfunctions, it must be returned to the factory for evaluation. OMEGA’s Customer Service
Department will issue an Authorized Return (AR) number immediately upon phone or written request.
Upon examination by OMEGA, if the unit is found to be defective, it will be repaired or replaced at no
charge. OMEGA’s WARRANTY does not apply to defects resulting from any action of the purchaser,
including but not limited to mishandling, improper interfacing, operation outside of design limits,
improper repair, or unauthorized modification. This WARRANTY is VOID if the unit shows evidence of
having been tampered with or shows evidence of having been damaged as a result of excessive corrosion;
or current, heat, moisture or vibration; improper specification; misapplication; misuse or other operating
conditions outside of OMEGA’s control. Components which wear are not warranted, including but not
limited to contact points, fuses, and triacs.
OMEGA is pleased to offer suggestions on the use of its various products. However,
OMEGA neither assumes responsibility for any omissions or errors nor assumes liability for any
damages that result from the use of its products in accordance with information provided by
OMEGA, either verbal or written. OMEGA warrants only that the parts manufactured by it will be
as specified and free of defects. OMEGA MAKES NO OTHER WARRANTIES OR
REPRESENTATIONS OF ANY KIND WHATSOEVER, EXPRESS OR IMPLIED, EXCEPT THAT OF TITLE,
AND ALL IMPLIED WARRANTIES INCLUDING ANY WARRANTY OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. LIMITATION OF
LIABILITY: The remedies of purchaser set forth herein are exclusive, and the total liability of
OMEGA with respect to this order, whether based on contract, warranty, negligence,
indemnification, strict liability or otherwise, shall not exceed the purchase price of the
component upon which liability is based. In no event shall OMEGA be liable for
consequential, incidental or special damages.
CONDITIONS: Equipment sold by OMEGA is not intended to be used, nor shall it be used: (1) as a “Basic
Component” under 10 CFR 21 (NRC), used in or with any nuclear installation or activity; or (2) in medical
applications or used on humans. Should any Product(s) be used in or with any nuclear installation or
activity, medical application, used on humans, or misused in any way, OMEGA assumes no responsibility
as set forth in our basic WARRANTY/ DISCLAIMER language, and, additionally, purchaser will indemnify
OMEGA and hold OMEGA harmless from any liability or damage whatsoever arising out of the use of the
Product(s) in such a manner.
RETURN REQUESTS/INQUIRIES
Direct all warranty and repair requests/inquiries to the OMEGA Customer Service Department. BEFORE
RETURNING ANY PRODUCT(S) TO OMEGA, PURCHASER MUST OBTAIN AN AUTHORIZED RETURN
(AR) NUMBER FROM OMEGA’S CUSTOMER SERVICE DEPARTMENT (IN ORDER TO AVOID
PROCESSING DELAYS). The assigned AR number should then be marked on the outside of the return
package and on any correspondence.
The purchaser is responsible for shipping charges, freight, insurance and proper packaging to prevent
breakage in transit.
FOR W
ARRANTY
RETURNS, please have the
following information available BEFORE
contacting OMEGA:
1. Purchase Order number under which the product
was PURCHASED,
2. Model and serial number of the product under
warranty, and
3. Repair instructions and/or specific problems
relative to the product.
FOR NON-W
ARRANTY
REPAIRS,
consult OMEGA
for current repair charges. Have the following
information available BEFORE contacting OMEGA:
1. Purchase Order number to cover the COST
of the repair,
2. Model and serial number of the product, and
3. Repair instructions and/or specific problems
relative to the product.
OMEGA’s policy is to make running changes, not model changes, whenever an improvement is possible. This affords
our customers the latest in technology and engineering.
reproduced, translated, or reduced to any electronic medium or machine-readable form, in whole or in part, without the
prior written consent of OMEGA ENGINEERING, INC.