NOTE: This manual has been designed and created for use as part of the WinSystems Technical Manuals
CD and/or the WinSystems website. If this manual or any portion of the manual is downloaded, copied or
emailed, the links to additional information (i.e. software, cable drawings) may be inoperable.
WinSystems reserves the right to make changes in the circuitry
and specications at any time without notice.
Copyright 2011 by WinSystems. All Rights Reserved.
REVISION HISTORY
P/N 403-0321-000
ECO Number Date Code Rev Level
ORIGINATED 110425 A
Table of Contents
Visual Index – Quick Reference i
Top View - Connectors i
Introduction 1
General Information 1
Features 1
General Description 1
Functional Capability 2
I/O Address Selection 2
Interrupt Routing 2
Digital I/O 3
PC/104 Bus Interface 4
For the convenience of the user, a copy of the Visual Index has been provided with
direct links to connector and jumper conguration data.
J1
Ports 3-5 I/O
Connector
J2
Ports 0-2 I/O
Connector
J6
Auxillary
Interrupt
Routing Header
J5
PC/104 Bus
(8-bit, 16-bit)
Connector
J3
Base I/O
Address
Selection
Jumper
NOTE: The reference line to each component part has been drawn to Pin 1, where applicable.
Pin 1 is also highlighted with a red square, where applicable.
110425 OPERATIONS MANUAL PCM-UIO48B i
J4
Interrupt
Routing
Header
Introduction
This manual is intended to provide the necessary information regarding conguration and
usage of the PCM-UIO48B board. WinSystems maintains a Technical Support Group to help
answer questions regarding usage or programming of the board. For answers to questions not
adequately addressed in this manual, contact Technical Support at (817) 274-7553, Monday
through Friday, between 8 AM and 5 PM Central Standard Time (CST).
General Information
Features
Digital I/O
•48 Bidirectional lines with Input, Output or Output with Readback (WS16C48)
•12 mA Sink Current
Event Sense
•Supports 24 event sense lines
•Programmable polarity for each line
•Software-enabled interrupt for each Line
•Change-of-state latched for each line
Power
•+5V @ 12 mA required
Industrial Operating Temperature Range
•-40°C to 85°C
Form Factor
•PC/104-compliant
•3.60” x 3.80” (90 mm x 96 mm)
Additional Specications
•Compatible with industry standard I/O racks
•Write-protection mask register for each port
•Fused +5V logic supply for I/O modules
•8-bit, 16-bit PC/104 Interface
General Description
The PCM-UIO48B is a highly versatile PC/104 input/output module providing 48 lines of
digital I/O. It is unique in its ability to monitor 24 lines for both rising and falling digital edge
transitions, latch them, and then issue an interrupt to the host processor. The application
interrupt service routine can quickly determine, through a series of interrupt identication
registers, the exact port(s) and bit(s) which have transitioned. The PCM-UIO48B utilizes
WinSystems’ WS16C48 ASIC High Density I/O (HDIO) Chip. The rst 24 lines are capable of
fully latched event sensing with the sense polarity being software programmable. Two 50-pin
I/O connectors allow for easy mating with industry standard I/O racks.
110425 OPERATIONS MANUAL PCM-UIO48B 1
Functional Capability
I/O Address Selection
The PCM-UIO48B requires 16 consecutive I/O addresses beginning on an 16-byte
boundary. The jumper block at J3 allows for user selection of the base address.
Address selection is made by placing a jumper on the jumper pair for the address
bit, if a 0 is desired or leaving the jumper pair open if a 1 is required for the desired
address. The illustration below shows the relationship between the address bit and the
jumper position and a sample jumpering for an address of 200H.
J3
A11
A10
A9
A8
A7
A6
A5
A4
I/O Base Address Select jumper
J3 shown jumpered for 200H
1 o o 2
3 o o 4
5 o o 6
7 o o 8
9 o o 10
11 o o 12
13 o o 14
15 o o 16
Interrupt Routing
The PCM-UIO48B can generate an interrupt on up to 24 different lines each with its
own polarity select. Interrupt support is provided on the rst 24 bits of each device for
ports 0, 1 and 2. This interrupt can be routed to the PC/104 bus via the jumper at J4.
16-bit versions of the board will also have the auxillary jumper at J6 installed. The
interrupt routing header is shown below along with sample jumpering for IRQ5.
IRQ7
IRQ6
IRQ5
IRQ4
IRQ3
IRQ2
J4
1 o o 2
3 o o 4
5 o o 6
7 o o 8
9 o o 10
11 o o 12
1 o
2 o
3 o
4 o
5 o
J6
IRQ15
IRQ14
IRQ12
IRQ11
IRQ10
110425 OPERATIONS MANUAL PCM-UIO48B 2
Digital I/O
The PCM-UIO48B routes its 48 lines to 50-pin IDC connectors at J1 and J2. The pin
denitions for J1 and J2 are shown below.
P2-7
P2-6
P2-5
P2-4
P2-3
P2-2
P2-1
P2-0
P1-7
P1-6
P1-5
P1-4
P1-3
P1-2
P1-1
P1-0
P0-7
P0-6
P0-5
P0-4
P0-3
P0-2
P0-1
P0-0
+5V
J2
1 o o 2
3 o o 4
5 o o 6
7 o o 8
9 o o 10
11 o o 12
13 o o 14
15 o o 16
17 o o 18
19 o o 20
21 o o 22
23 o o 24
25 o o 26
27 o o 28
29 o o 30
31 o o 32
33 o o 34
35 o o 36
37 o o 38
39 o o 40
41 o o 42
43 o o 44
45 o o 46
47 o o 48
49 o o 50
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
P5-7
P5-6
P5-5
P5-4
P5-3
P5-2
P5-1
P5-0
P4-7
P4-6
P4-5
P4-4
P4-3
P4-2
P4-1
P4-0
P3-7
P3-6
P3-5
P3-4
P3-3
P3-2
P3-1
P3-0
+5V
J1
1 o o 2
3 o o 4
5 o o 6
7 o o 8
9 o o 10
11 o o 12
13 o o 14
15 o o 16
17 o o 18
19 o o 20
21 o o 22
23 o o 24
25 o o 26
27 o o 28
29 o o 30
31 o o 32
33 o o 34
35 o o 36
37 o o 38
39 o o 40
41 o o 42
43 o o 44
45 o o 46
47 o o 48
49 o o 50
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
NOTE:
Pin 49 on each connector can supply +5V to the I/O rack. The supply on each connector
is protected from excessive current by a 1A miniature fuse F1 for J1 and F2 for J2.
110425 OPERATIONS MANUAL PCM-UIO48B 3
PC/104 Bus Interface
The PCM-UIO48B connects to the processor through the PC/104 bus connector at
J5. The pin denitions for the 8-bit and 16-bit extension of J5 are provided here for
reference. Refer to the PC/104 Bus Specication for specic signal and mechanical
specications.
D0 o o C0
GND
+5V
GND
GND
D1 o o C1
D2 o o C2
D3 o o C3
D4 o o C4
D5 o o C5
D6 o o C6
D7 o o C7
D8 o o C8
D9 o o C9
D10 o o C10
D11 o o C11
D12 o o C12
D13 o o C13
D14 o o C14
D15 o o C15
D16 o o C16
D17 o o C17
D18 o o C18
D19 o o C19
MEMCS16#
IOCS16#
IRQ10
IRQ11
IRQ12
IRQ15
IRQ14
DACK0#
DRQ0
DACK5#
DRQ5
DACK6#
DRQ6
DACK7#
DRQ7
MASTER#
# = Active Low Signal
GND
SBHE#
LA23
LA22
LA21
LA20
LA19
LA18
LA17
MEMR#
MEMW#
SD8
SD9
SD10
SD11
SD12
SD13
SD14
SD15
KEY
IOCHK#
SD7
SD6
SD5
SD4
SD3
SD2
SD1
SD0
IOCHRDY
AEN
SA19
SA18
SA17
SA16
SA15
SA14
SA13
SA12
SA11
SA10
SA9
SA8
SA7
SA6
SA5
SA4
SA3
SA2
SA1
SA0
GND
A1 o o B1
A2 o o B2
A3 o o B2
A4 o o B4
A5 o o B5
A6 o o B6
A7 o o B7
A8 o o B8
A9 o o B9
A10 o o B10
A11 o o B11
A12 o o B12
A13 o o B13
A14 o o B14
A15 o o B15
A16 o o B16
A17 o o B17
A18 o o B18
A19 o o B19
A20 o o B20
A21 o o B21
A22 o o B22
A23 o o B23
A24 o o B24
A25 o o B25
A26 o o B26
A27 o o B27
A28 o o B28
A29 o o B29
A30 o o B30
A31 o o B31
A32 o o B32
GND
RESET
+5V
IRQ9
-5V
DRQ2
-12V
SRDY#
+12V
KEY
SMEMW#
SMEMR#
IOW#
IOR#
DACK3#
DRQ3
DACK1#
DRQ1
REFRESH#
BCLK
IRQ7
IRQ6
IRQ5
IRQ4
IRQ3
DACK2#
TC
BALE
+5V
OSC
GND
GND
NOTES:
1. Rows C and D are not required on 8-bit modules.
2. B10 and C19 are key locations. WinSystems uses key pins as connections to GND.
3. Signal timing and function are as specied in ISA specication.
4. Signal source/sink current differ from ISA values.
110425 OPERATIONS MANUAL PCM-UIO48B 4
Software Summary
WS16C48 Register Denitions – The PCM-UIO48B uses the WinSystems exclusive ASIC device,
the WS16C48. This device provides 48 lines of digital I/O. There are 17 unique registers within
the WS16C48. The following table summarized the registers and the text that follows provides
details on each of the internal registers.
Port 0 through 5 I/O – Each I/O bit in each of the six ports can be individually programmed
for input or output. Writing a 0 to a bit position causes the corresponding output pin to go to a
high-impedance state (pulled high by external 10 KΩ resistors). This allows it to be used as an
input. When used in the input mode, a read reects the inverted state of the I/O pin, such that
a high on the pin will read as a 0 in the register. Writing a 1 to a bit position causes that output
pin to sink current (up to 12 mA), effectively pulling it low.
INT_PENDING – This read-only register reects the combined state of the INT_ID0 through
INT_ID2 registers. When any of the lower three bits are set, it indicates that an interrupt is
pending on the I/O port corresponding to the bit position(s) that are set. Reading this register
allows an Interrupt Service Routine to quickly determine if any interrupts are pending and which
I/O port has a pending interrupt.
PAGE/LOCK – This register serves two purposes. The upper two bits select the register page in
use as shown here:
D7D6Page
00Page 0
01Page 1
10Page 2
11Page 3
Bits 5-0 allow for locking the I/O ports. A 1 written to the I/O port position will prohibit further
writes to the corresponding I/O port.
110425 OPERATIONS MANUAL PCM-UIO48B 5
POL0 - POL2 – These registers are accessible when Page 1 is selected. They allow interrupt
polarity selection on a port–by–port and bit-by-bit basis. Writing a 1 to a bit position selects the
rising edge detection interrupts while writing a 0 to a bit position selects falling edge detection
interrupts.
ENAB0 - ENAB2 – These registers are accessible when Page 2 is selected. They allow for port-byport and bit-by-bit enabling of the edge detection interrupts. When set to a 1 the edge detection
interrupt is enabled for the corresponding port and bit. When cleared to 0, the bit’s edge detection
interrupt is disabled. Note that this register can be used to individually clear a pending interrupt
by disabling and re-enabling the pending interrupt.
INT_ID0 – INT_ID2 – These registers are accessible when Page 3 is selected. They are used to
identify currently pending edge interrupts. A bit when read as a 1 indicates that an edge of the
polarity programmed into the corresponding polarity register has been recognized. Note that a
write to this register (value ignored) clears ALL of the pending interrupts in this register.
110425 OPERATIONS MANUAL PCM-UIO48B 6
WS16C48 Programming Reference
Introduction
This section provides basic documentation for the included I/O routines. It is intended
that the accompanying source code equip the programmer with a basic library of I/O
functions for the WS16C48 or can serve as the basis from which application specic code
can be derived.
Function Denitions
This section describes each of the functions contained in the driver. Where necessary,
short examples will be provided to illustrate usage. Any application making use of any of
the driver functions should include the header le UIS48.H, which includes the function
prototypes and the needed constant denitions.
Note that all of the functions utilize the concept of bit_number. The bit_number is a value
from 1 to 48 (1 to 24 for interrupt related functions) that correlates to a specic I/O pin.
Bit_number 1 is port 0 bit 0 and continues through to bit_number 48 at port 5 bit 7.
INIT_IO – Initializes I/O, set all ports to input
Syntax
void init_io(unsigned io_address);
Description
This function takes a single argument:
io_address – The I/O address of the WS16C48 chip.
There is no return value. This function initializes all I/O
pins for input (sets them high), disables all interrupt
settings, and sets the image values.
READ_BIT – Reads an I/O port Pin
Syntax
int read_bit(int bit_number);
Description
This function takes a single argument:
bit_number – a value from 1 to 48 specifying the I/O
pin to read from.
This function returns the state of the I/O pin. A 1 is
returned if the I/O pin is low and a 0 is returned if the
pin is high.
110425 OPERATIONS MANUAL PCM-UIO48B 7
WRITE_BIT – Writes a 1 or 0 to an I/O Pin
Syntax
void write_bit(int bit_number, int value);
Description
This function takes two arguments:
bit_number – a value from 1 to 48 specifying the I/O
pin to be acted upon.
value - is ether 1 or 0.
This function allows for writing of a single bit to either
a 0 or a 1 as specied by the second argument. There
is no return value and other bits in the I/O port are not
affected.
SET_BIT – Sets the specied I/O Pin
Syntax
void set_bit(int bit_number);
Description
This function takes a single argument:
bit_number – a value from 1 to 48 specifying the I/O
pin to be set.
This function sets the specied I/O port bit. Note that
setting a bit results in the I/O pin actually going low.
There is no return value and other bits in the same I/O
port are unaffected.
CLR_BIT – Clears the specied I/O Pin
Syntax
void clr_bit(int bit_number);
Description
This function takes a single argument:
bit_number – a value from 1 to 48 specifying the I/O
pin to clear.
This function clears the specied I/O bit. Note that
clearing the I/O bit results in the actual I/O pin going
high. This function does not affect any bits other than
the one specied.
bit_number – a value from 1 to 24, specifying the
appropriate bit.
polarity - species rising or falling edge polarity detect.
The constraints RISING and FALLING are dened
UIO48.H.
This function enables the edge detection circuitry for
the specied bit at the specied polarity. It does not
unmask the interrupt controller, install vectors, or
handle interrupts when they occur. There is no return
value and only the specied bit is affected.
bit_number – a value from 1 to 24 specifying the
appropriate bit.
This function shuts down the edge detection interrupts
for the specied bit. There is no return value and no
harm is done by calling this function for a bit which did
not have edge detection interrupts enabled. There is no
effect on any other bits.
110425 OPERATIONS MANUAL PCM-UIO48B 9
CLR_INT – Clears the specied pending interrupt
Syntax
void clr_int(int bit_number);
Description
This function takes a single argument:
bit_number – a value from 1 to 24 specifying the bit
number to reset the interrupt.
This function clears a pending interrupt on the
specied bit. It does this by disabling and reenabling
the interrupt. The net result after the call is that
the interrupt is no longer pending and is renamed
for the next transition of the same polarity. Calling
this function on a bit that has not been enabled for
interrupts will result in its interrupt being enabled with
an undened polarity. Calling this function with no
interrupt pending will have no adverse effect. Only the
specied bit is affected.
GET_INT – Retrieves bit number of pending interrupt
Syntax
void get_int(void);
Description
This function requires no arguments.
This function returns either a 0 for no bit interrupts
pending or a value between 1 and 24 representing a
bit number that has a pending edge detect interrupt.
The function returns with the rst interrupt found
and begins its search at Port 0 bit 0 proceeding
through to Port 2 Bit 7. It is necessary to use either
clr_int() or disab_int() to avoid returning the same
bit continuously. This function may be used in an
application’s ISE or can be used in the foreground to
poll for bit transitions.
110425 OPERATIONS MANUAL PCM-UIO48B 10
Sample Programs
There are three sample programs in source code form included on the PCM-UIO48B
diskette. These programs are not useful by themselves but are provided to illustrate the
usage of the I/O functions provided in UIO48.C.
FLASH.C
This program was compiled with Borland C/C++ version 3.1 on the command line with:
bcc ash.c uio48.c
This program illustrates the most basic usage of the WS16C48. It uses three functions
from the driver code. The io_init() function is used to initialize the I/O functions and the
set_bit() and clr_bit() functions are used to sequence through all 48 bits turning each on
and then off in turn.
POLL.C
This program was compiled with Borland C/C++ version 3.1 on the command line with:
bcc poll.c uio48.c
This program illustrates additional features of thw WS16C48 and the I/O library functions.
It programs the rst 24 bits for input, arms them for falling edge detection, and then polls
using the library routine get_init() to determine if any transitions have taken place.
INT.C
This program was compiled with Borland C/C++ version 3.1 on the command line with:
bcc int.c uio48.c
This program is identical in function to the POLL.C program except that interrupts are
active and all updating of the transition counters is completed in the background during
the interrupt service routine.
Summary
Links to the source code for all three programs as well as the I/O routines can be found
in the Software Drivers & Examples Section of this manual. It is also provided in the C
Source Code Listings Section of this manual. These I/O routines along with the sample
program should provide for a good basis on which to build an application using the
features of the WS16C48.
110425 OPERATIONS MANUAL PCM-UIO48B 11
C Source Code Listings
/* UIO48.H
Copyright 1996 by WinSystems Inc.
Permission is hereby granted to the purchaser of the WinSystems
UIO cards and CPU products incorporating the UIO device, to distribute
any binary le or les compiled using this source code directly or
in any work derived by the user from this le. In no case may the
source code, original or derived from this le, be distributed to any
third party except by explicit permission of WinSystems. This le is
distributed on an “As-is” basis and no warranty as to performance,
tness of purposes, or any other warranty is expressed or implied.
In no case shall WinSystems be liable for any direct or indirect loss
or damage, real or consequential resulting from the usage of this
source code. It is the user’s sole responsibility to determine
tness for any considered purpose.
*/
/**************************************************************************
* Name : uio48.h
*
* Project : PCM-UIO48 Software Samples/Examples
*
* Date : October 30, 1996
*
* Revision: 1.00
*
* Author : Steve Mottin
*
****************************************************************************
*
* Changes :
*
* Date Revision Description
* ________ ________ ______________________________________________
* 10/30/96 1.00 Created
*
*****************************************************************************
*/
#dene RISING 1
#dene FALLING 0
void init_io(unsigned io_address);
int read_bit(int bit_number);
void write_bit(int bit_number);
void set_bit(int bit_number);
void clr_bit(int bit_number);
void enab_int(int bit_number, int polarity);
void disab_int(int bit_number);
void clr_int(int bit_number);
int get_int(void);
110425 OPERATIONS MANUAL PCM-UIO48B 12
/* UIO48.C
Copyright 1996 by WinSystems Inc.
Permission is hereby granted to the purchaser of the WinSystems
UIO cards and CPU products incorporating the UIO device, to distribute
any binary le or les compiled using this source code directly or
in any work derived by the user from this le. In no case may the
source code, original or derived from this le, be distributed to any
third party except by explicit permission of WinSystems. This le is
distributed on an “As-is” basis and no warranty as to performance,
tness of purposes, or any other warranty is expressed or implied.
In no case shall WinSystems be liable for any direct or indirect loss
or damage, real or consequential resulting from the usage of this
source code. It is the user’s sole responsibility to determine
tness for any considered purpose.
*/
/**************************************************************************
* Name : uio48.c
*
* Project : PCM-UIO48 Software Samples/Examples
*
* Date : October 30, 1996
*
* Revision: 1.00
*
* Author : Steve Mottin
*
****************************************************************************
*
* Changes :
*
* Date Revision Description
* ________ ________ ______________________________________________
* 10/30/96 1.00 Created
*
*****************************************************************************
*/
#include <dos.h>
/* This global holds the base address of the UIO chip */
unsigned base_port;
/* This global array holds the image values of the last write to each I/O
ports. This allows bit manipulation routines to work without having to
actually do a read-modify-write to the I/O port.
*/
unsigned port_images[6];
/*================================================================
===========
* INIT_IO
*
* This function take a single argument :
*
*
* io_address : This is the base I/O address of the 16C48 UIO Chip
* on the board.
*
*
110425 OPERATIONS MANUAL PCM-UIO48B 13
* This function initializes all I/O pins for input, disables all interrupt
* sensing, and sets the image values.
*
*=================================================================
==========*/
void init_io(unsigned io_address)
{
int x;
/* Save the specied address for later use */
base_port = io_address;
/* Clear all of the I/O ports. This also makes them inputs */
/* Restore normal page 0 register access */
outportb(base_port+7,0);
}
/*================================================================
===========
*
* READ_BIT
*
*
* This function takes a single argument :
*
*
* bit_number : The integer argument species the bit number to read.
* Valid arguments are from 1 to 48.
*
* return value : The current state of the specied bit, 1 or 0.
*
* This function returns the state of the current I/O pin specied by
* the argument bit_number.
*
*=================================================================
==========*/
int read_bit(int bit_number)
{
unsigned port;
int val;
110425 OPERATIONS MANUAL PCM-UIO48B 14
/* Adjust the bit_number to 0 to 47 numbering */
--bit_number;
/* Calculate the I/O port address based on the updated bit_number */
port = (bit_number / 8) + base_port;
/* Get the current contents of the port */
val = inportb(port);
/* Get just the bit we specied */
val = val & (1 << (bit_number % 8));
/* Adjust the return for a 0 or 1 value */
if(val)
return 1;
return 0;
}
/*================================================================
===========
*
* WRITE_BIT
*
* This function takes two arguments :
*
*
* bit_number : The I/O pin to access is specied by bit_number 1 to 48.
*
* val : The setting for the specied bit, either 1 or 0.
*
* This function sets the specied I/O pin to either high or low as dictated
* by the val argument. A non zero value for val sets the bit.
*
*=================================================================
==========*/
void write_bit(int bit_number, int val)
{
unsigned port;
unsigned temp;
unsigned mask;
/* Adjust bit_number for 0 based numbering */
--bit_number;
/* Calculate the I/O address of the port based on the bit number */
port = (bit_number / 8) + base_port;
/* Use the image value to avoid having to read the port rst. */
temp = port_images[bit_number / 8]; /* Get current value */
/* Calculate a bit mask for the specied bit */
110425 OPERATIONS MANUAL PCM-UIO48B 15
mask = (1 << (bit_number % 8));
/* Check whether the request was to set or clear and mask accordingly */
if(val) /* If the bit is to be set */
temp = temp | mask;
else
temp = temp & ~mask;
/* Update the image value with the value we’re about to write */
port_images[bit_number / 8] = temp;
/* Now actually update the port. Only the specied bit is affected */
outportb(port,temp);
}
/*================================================================
===========
* SET_BIT
*
*
* This function takes a single argument :
*
* bit_number : The bit number to set.
*
* This function sets the specied bit.
*
*=================================================================
==========*/
void set_bit(int bit_number)
{
write_bit(bit_number,1);
}
/*================================================================
===========
* CLR_BIT
*
*
* This function takes a single argument :
*
* bit_number : The bit number to clear.
*
* This function clears the specied bit.
*
*=================================================================
==========*/
* This function takes two arguments :
*
* bit_number : The bit number to enable intterups for. Range from 1 to 48.
*
* polarity : This species the polarity of the interrupt. A non-zero
* argument enables rising-edge interrupt. A zero argument
* enables the interrupt on the ling edge.
*
* This function enables within the 16C48 an interrupt for the specied bit
* at the specied polarity. This function does not setup the interrupt
* controller, nor does it supply an interrupr handler.
*
*=================================================================
===========*/
void enab_int(int bit_number, int polarity)
{
unsigned port;
unsigned temp;
unsigned mask;
/* Adjust for 0 based numbering */
--bit_number;
/* Calculate the I/O address based uppon the bit number */
port = (bit_number / 8) + base_port + 8;
/* Calculate a bit mask based on the specied bit number */
mask = (1 << (bit_number % 8));
/* Turn on page 2 access */
outportb(base_port+7,0x80);
/* Get the current state of the interrupt enable register */
temp = inportb(port);
/* Set the enable bit for our bit number */
temp = temp | mask;
/* Now update the interrupt enable register */
outportb(port,temp);
/* Turn on access to page 1 for polarity control */
outportb(base_port+7,0x40);
/* Get the current state of the polarity register */
temp = inportb(port); /* Get current polarity settings */
/* Set the polarity according to the argument in the image value */
if(polarity) /* If the bit is to be set */
temp = temp | mask;
else
temp = temp & ~mask;
110425 OPERATIONS MANUAL PCM-UIO48B 17
/* Write out the new polarity value */
outportb(port,temp);
/* Set access back to Page 0 */
outportb(base_port+7,0x0);
}
/*================================================================
===========
*
* DISAB_INT
*
* This function takes a single argument :
*
* bit_number : Species the bit number to act upon. Range is from 1 to 48.
*
* This function shuts off the interrupt enabled for the specied bit.
*
*=================================================================
==========*/
void disab_int(int bit_number)
{
unsigned port;
unsigned temp;
unsigned mask;
/* Adjust the bit_number for 0 based numbering */
--bit_number;
/* Calculate the I/O Address for the enable port */
port = (bit_number / 8) + base_port + 8;
/* Calculate the proper bit mask for this bit number */
mask = (1 << (bit_number % 8));
/* Turn on access to page 2 registers */
outportb(base_port+7,0x80);
/* Get the current state of the enable register */
temp = inportb(port);
/* Clear the enable bit int the image for our bit number */
temp = temp & ~mask;
/* Update the enable register with the new information */
outportb(port,temp);
/* Set access back to page 0 */
outportb(base_port+7,0x0);
110425 OPERATIONS MANUAL PCM-UIO48B 18
}
/*================================================================
==========
*
* CLR_INT
*
* This function takes a single argument :
*
* bit_number : This argument species the bit interrupt to clear. Range
* is 1 to 24.
*
*
* This function is use to clear a bit interrupt once it has been recognized.
* The interrupt left enabled.
*
*=================================================================
==========*/
void clr_int(int bit_number)
{
unsigned port;
unsigned temp;
unsigned mask;
/* Adjust for 0 based numbering */
--bit_number;
/* Calculate the correct I/O address for our enable register */
port = (bit_number / 8) + base_port + 8;
/* Calculate a bit mask for this bit number */
mask = (1 << (bit_number % 8));
/* Set access to page 2 for the enable register */
outportb(base_port+7,0x80);
/* Get current state of the enable register */
temp = inportb(port);
/* Temporarily clear only OUR enable. This clears the interrupt */
temp = temp & ~mask; /* clear the enable for this bit */
/* Write out the temporary value */
outportb(port,temp);
/* Re-enable our interrupt bit */
temp = temp | mask;
/* Write it out */
outportb(port,temp);
/* Set access back to page 0 */
110425 OPERATIONS MANUAL PCM-UIO48B 19
outportb(base_port+7,0x0);
}
/*================================================================
==========
*
* GET_INT
*
* This function take no arguments.
*
* return value : The value returned is the highest level bit interrupt
* currently pending. Range is 1 to 24.
*
* This function returns the highest level interrupt pending. If no interrupt
* is pending, a zero is returned. This function does NOT clear the interrupt.
*
*=================================================================
==========*/
int get_int(void)
{
int temp;
int x;
/* read the master interrupt pending register, mask off undened bits */
temp = inportb(base_port+6) & 0x07;
/* If there are no interrupts pending, return a 0 */
if((temp & 7) == 0)
return(0);
/* There is something pending, now we need to identify what it is */
/* Set access to page 3 for interrupt id registers */
outportb(base_port+7,0xc0);
/* Read interrupt ID register for port 0 */
temp = inportb(base_port+8);
/* See if any bit set, if so return the bit number */
if(temp !=0)
{
for(x=0; x <=7; x++)
{
if(temp & (1 << x))
{
outportb(base_port+7,0); /* Turn off access */
return(x+1); /* Return bitnumber with active int */
}
}
}
/* None in Port 0, read port 1 interrupt ID register */
110425 OPERATIONS MANUAL PCM-UIO48B 20
temp = inportb(base_port+9);
/* See if any bit set, if so return the bit number */
if(temp !=0)
{
for(x=0; x <=7; x++)
{
if(temp & (1 << x))
{
outportb(base_port+7,0); /* Turn off access */
return(x+9); /* Return bitnumber with active int */
}
}
}
/* Lastly, read status of port 2 int id */
temp = inportb(base_port+0x0a); /* Read port 2 status */
/* If any pending, return the appropriate bit number */
if(temp !=0)
{
for(x=0; x <=7; x++)
{
if(temp & (1 << x))
{
outportb(base_port+7,0); /* Turn off access */
return(x+17); /* Return bitnumber with active int */
}
}
}
/* We should never get here unless the hardware is misbehaving but just
to be sure. We’ll turn the page access back to 0 and return a 0 for
no interrupt found.
*/
outportb(base_port+7,0);
return 0;
}
110425 OPERATIONS MANUAL PCM-UIO48B 21
/* FLASH.C
Copyright 1996-2001 by WinSystems Inc.
Permission is hereby granted to the purchaser of the WinSystems
UIO cards and CPU products incorporating the UIO device, to distribute
any binary le or les compiled using this source code directly or
in any work derived by the user from this le. In no case may the
source code, original or derived from this le, be distributed to any
third party except by explicit permission of WinSystems. This le is
distributed on an “As-is” basis and no warranty as to performance,
tness of purposes, or any other warranty is expressed or implied.
In no case shall WinSystems be liable for any direct or indirect loss
or damage, real or consequential resulting from the usage of this
source code. It is the user’s sole responsibility to determine
tness for any considered purpose.
*/
/* This is an utlra-simple demonstration program of some of the functions
available in the UIO48 source code library. This program simply sets and
clears each I/O line in succession. It was tested by hooking LEDs to all
of the I/O lines and wathching the lit one race through the bits.
*/
void main()
{
int x;
/* Initialize all I/O bits, and set then for input */
init_io(BASE_PORT);
/* We’ll repeat our sequencing until a key is pressed */
while(!kbhit())
{
/* We will light the LED attached to each of the 48 lines */
for(x=1; x <=48; x++)
{
/* Setting the bit lights the LED */
set_bit(x);
/* The wait time is subjective. We liked 100mS */
delay(100);
/* Now turn off the LED */
clr_bit(x);
}
}
getch();
}
110425 OPERATIONS MANUAL PCM-UIO48B 22
/* POLL.C
Copyright 1996-2001 by WinSystems Inc.
Permission is hereby granted to the purchaser of the WinSystems
UIO cards and CPU products incorporating the UIO device, to distribute
any binary le or les compiled using this source code directly or
in any work derived by the user from this le. In no case may the
source code, original or derived from this le, be distributed to any
third party except by explicit permission of WinSystems. This le is
distributed on an “As-is” basis and no warranty as to performance,
tness of purposes, or any other warranty is expressed or implied.
In no case shall WinSystems be liable for any direct or indirect loss
or damage, real or consequential resulting from the usage of this
source code. It is the user’s sole responsibility to determine
tness for any considered purpose.
/* This program uses the edge detection interrupt capability of the
WS16C48 to count transitions on the rst 24 lines. It does this
however, no by using true interrupts but by polling for transitions
using the get_int() function.
*/
/* Our transition totals are stored in this array */
unsigned int_counts[25];
/* Denitions for local functions */
void check_ints(void);
void main()
{
int x;
/* Initialize the I/O ports. Set all I/O pins to input */
int_counts[x] = 0; /* Clear the counts */
enab_int(x,FALLING); /* Enable the falling edge interrupts */
110425 OPERATIONS MANUAL PCM-UIO48B 23
}
/* Clean up the screen for our display. Nothing fancy */
clrscr();
for(x=1; x<25; x++)
{
gotoxy(1,x);
printf(“Bit number %02d “,x);
}
/* We will continue to display until any key is pressed */
while(!kbhit())
{
/* Retrieve any pending transitions and update the counts */
check_ints();
/* Display the current count values */
for(x=1; x < 25; x++)
{
gotoxy(16,x);
printf(“%05u”,int_counts[x]);
}
}
getch();
}
void check_ints()
{
int current;
/* Get the bit number of a pending transition interrupt */
current = get_int();
/* If it’s 0 there are none pending */
if(current == 0)
return;
/* Clear and rearm this one so we can get it again */
clr_int(current);
/* Tally a transition for this bit */
++int_counts[current];
}
110425 OPERATIONS MANUAL PCM-UIO48B 24
/* INTS.C
Copyright 1996-2001 by WinSystems Inc.
Permission is hereby granted to the purchaser of the WinSystems
UIO cards and CPU products incorporating the UIO device, to distribute
any binary le or les compiled using this source code directly or
in any work derived by the user from this le. In no case may the
source code, original or derived from this le, be distributed to any
third party except by explicit permission of WinSystems. This le is
distributed on an “As-is” basis and no warranty as to performance,
tness of purposes, or any other warranty is expressed or implied.
In no case shall WinSystems be liable for any direct or indirect loss
or damage, real or consequential resulting from the usage of this
source code. It is the user’s sole responsibility to determine
tness for any considered purpose.
/* This program like the poll.c sample uses the edge detection interrupt
capability of the WS16C48 to count edge transitions. Unlike poll.c,
however this program actually uses interrupts and update all of the
transition counters in the background.
*/
/* Our transition totals are stored in this global array */
setvect(0x72,old_handler); /* Put back the old interrupt handler */
/* Reenable interrupts. Things are back they way they were before we
started.
*/
enable();
}
/* This function is executed when an edge detection interrupt occurs */
void interrupt int_handler(void)
{
int current;
/* Get the current interrupt pending. There really should be one
here or we shouldn’t even be executing this function.
*/
current = get_int();
/* We will continue processing pending edge detect interrupts until
there are no more present. In which case current == 0
*/
while(current)
{
/* Clear the current one so that it’s ready for the next edge */
clr_int(current);
/* Tally up one for the current bit number */
++int_counts[current];
/* Get the next one, if any others pending */
current = get_int();
}
/* Issue a non-specic end of interrupt command (EOI) to the
interrupt controller. This rearms it for the next shot.
*/
outportb(0xa0,0x20); /* Do non-specic EOI */
outportb(0x20,0x20);
}
110425 OPERATIONS MANUAL PCM-UIO48B 27
Cables
Part NumberDescription
4-ft., Opto rack interface
CBL-115-4
CBL-129-4
*Only available for models:
PCM-UIO48B-16
4 ft., ribbon cable, 50 pin. Both ends with 50-pin socket termination
*Only available for models:
PCM-UIO48B-16
Software Drivers & Examples
Examples
(For WS16C48 Digital I/O Chip)
Linux Drivers - Kernel 2.2, 2.4linux_uio48_96.zip
Linux Drivers - Kernel 2.6uio48io_kernel_2.6.zip
DOS Example C Functionsuio48a.zip
Windows XP Driverwsuio48_96xp.zip
110425 OPERATIONS MANUAL PCM-UIO48B 28
Jumper Reference
Drawings ONLY - for more detailed information on these parts, refer to the
descriptions shown previously in this manual.
J1
Ports 3-5 I/O
Connector
J2
Ports 0-2 I/O
Connector
J6
Auxillary
Interrupt
Routing Header
J5
PC/104
Bus (8-bit)
Connector
J3
Base I/O
Address
Selection
Jumper
NOTE: The reference line to each component part has been drawn to Pin 1, where applicable.
Pin 1 is also highlighted with a red square, where applicable.
J4
Interrupt
Routing
Header
110425 OPERATIONS MANUAL PCM-UIO48B 29
Digital I/O
P2-7
P2-6
PS-5
PS-4
P2-3
P2-2
P2-1
P2-0
P1-7
P1-6
P1-5
P1-4
P1-3
P1-2
P1-1
P1-0
P0-7
P0-6
P0-5
P0-4
P0-3
P0-2
P0-1
P0-0
+5V
J2
1 o o 2
3 o o 4
5 o o 6
7 o o 8
9 o o 10
11 o o 12
13 o o 14
15 o o 16
17 o o 18
19 o o 20
21 o o 22
23 o o 24
25 o o 26
27 o o 28
29 o o 30
31 o o 32
33 o o 34
35 o o 36
37 o o 38
39 o o 40
41 o o 42
43 o o 44
45 o o 46
47 o o 48
49 o o 50
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
P5-7
P5-6
P5-5
P5-4
P5-3
P5-2
P5-1
P5-0
P4-7
P4-6
P4-5
P4-4
P4-3
P4-2
P4-1
P4-0
P3-7
P3-6
P3-5
P3-4
P3-3
P3-2
P3-1
P3-0
+5V
J1
1 o o 2
3 o o 4
5 o o 6
7 o o 8
9 o o 10
11 o o 12
13 o o 14
15 o o 16
17 o o 18
19 o o 20
21 o o 22
23 o o 24
25 o o 26
27 o o 28
29 o o 30
31 o o 32
33 o o 34
35 o o 36
37 o o 38
39 o o 40
41 o o 42
43 o o 44
45 o o 46
47 o o 48
49 o o 50
SW1
SW3
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
-12V
+12V
SWVCC
Interrupt Routing
IRQ7
IRQ6
IRQ5
IRQ4
IRQ3
IRQ2
J4
1 o o 2
3 o o 4
5 o o 6
7 o o 8
9 o o 10
11 o o 12
1 o
2 o
3 o
4 o
5 o
J6
IRQ15
IRQ14
IRQ12
IRQ11
IRQ10
110425 OPERATIONS MANUAL PCM-UIO48B 30
I/O Address Selection
J3
I/O Base Address Select jumper
J3 shown jumpered for 200H
1 o o 2
3 o o 4
5 o o 6
7 o o 8
9 o o 10
11 o o 12
13 o o 14
15 o o 16
A11
A10
A9
A8
A7
A6
A5
A4
110425 OPERATIONS MANUAL PCM-UIO48B 31
Specications
Electrical
Bus Interface :PC/104 (8-bit, optional 16-Bit extension)VCC :+5V ±5% @12 mA typical with no I/O connectionsI/O Addressing :12-Bit user jumperable base address. Each board uses 16
consecutive I/O addresses.
Mechanical
Dimensions :3.6” X 3.8” (90 mm x 96 mm)PC Board :FR-4 Epoxy glass with 2 signal layers 2 power
planes, screened component legend, and plated through holes.
Jumpers :0.025” square posts on 0.10” centersConnectors :50-pin 0.10” grid RN type IDH-50-LP
Environmental
Operating Temperature :-40°C to +85° CNoncondensing humidity :5% to 95%
110425 OPERATIONS MANUAL PCM-UIO48B 32
WARRANTY REPAIR INFORMATION
WARRANTY
WinSystems warrants to Customer that for a period of two (2) years from the date of
shipment any Products and Software purchased or licensed hereunder which have been
developed or manufactured by WinSystems shall be free of any material defects and shall
perform substantially in accordance with WinSystems’ specications therefore. With respect
to any Products or Software purchased or licensed hereunder which have been developed or
manufactured by others, WinSystems shall transfer and assign to Customer any warranty
of such manufacturer or developer held by WinSystems, provided that the warranty, if any,
may be assigned. Notwithstanding anything herein to the contrary, this warranty granted by
WinSystems to the Customer shall be for the sole benet of the Customer, and may not be
assigned, transferred or conveyed to any third party. The sole obligation of WinSystems for
any breach of warranty contained herein shall be, at its option, either (i) to repair or replace
at its expense any materially defective Products or Software, or (ii) to take back such Products
and Software and refund the Customer the purchase price and any license fees paid for the
same. Customer shall pay all freight, duty, broker’s fees, insurance charges for the return of
any Products or Software to WinSystems under this warranty. WinSystems shall pay freight
and insurance charges for any repaired or replaced Products or Software thereafter delivered
to Customer within the United States. All fees and costs for shipment outside of the United
States shall be paid by Customer. The foregoing warranty shall not apply to any Products of
Software which have been subject to abuse, misuse, vandalism, accidents, alteration, neglect,
unauthorized repair or improper installations.
THERE ARE NO WARRANTIES BY WINSYSTEMS EXCEPT AS STATED HEREIN, THERE ARE NO
OTHER WARRANTIES EXPRESS OR IMPLIED INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, IN NO EVENT
SHALL WINSYSTEMS BE LIABLE FOR CONSEQUENTIAL, INCIDENTIAL OR SPECIAL DAMAGES
INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR LOSS OF DATA, PROFITS OR GOODWILL.
WINSYSTEMS’ MAXIMUM LIABILITY FOR ANY BREACH OF THIS AGREEMENT OR OTHER CLAIM
RELATED TO ANY PRODUCTS, SOFTWARE, OR THE SUBJECT MATTER HEREOF, SHALL NOT
EXCEED THE PURCHASE PRICE OR LICENSE FEE PAID BY CUSTOMER TO WINSYSTEMS FOR
THE PRODUCTS OR SOFTWARE OR PORTION THEREOF TO WHICH SUCH BREACH OR CLAIM
PERTAINS.
WARRANTY SERVICE
1. To obtain service under this warranty, obtain a return authorization number. In the
United States, contact the WinSystems’ Service Center for a return authorization number.
Outside the United States, contact your local sales agent for a return authorization number.
2. You must send the product postage prepaid and insured. You must enclose the products
in an anti-static bag to protect from damage by static electricity. WinSystems is not responsible
for damage to the product due to static electricity.
110425 OPERATIONS MANUAL PCM-UIO48B 33
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.