Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
DA800User’s Manual
™
Real Time Devices, Inc.“Accessing the Analog World”
®
®
DA800User’s Manual
REAL TIME DEVICES, INC.820 North University Drive
Post Office Box 906State College, Pennsylvania 16804
Phone: (814) 234-8087FAX: (814) 234-5218
Published byReal Time Devices, Inc.820 N. University Dr.
P.O. Box 906State College, PA 16804
Copyright © 1992 by Real Time Devices, Inc.All rights reserved
Printed in U.S.A.
Rev. A 9311
Table of Contents
i
INTRODUCTION ....................................................................................................................................i-1
Digital-to-Analog Conversion .................................................................................................................................i-3Digital I/O ...............................................................................................................................................................i-38254 Timer/Counter ................................................................................................................................................i-3What Comes With Your Board ...............................................................................................................................i-3Board Accessories ...................................................................................................................................................i-4Using This Manual ..................................................................................................................................................i-4When You Need Help .............................................................................................................................................i-4
CHAPTER 1 — BOARD SETTINGS .................................................................................................. 1-1
Factory-Configured Switch and Jumper Settings .................................................................................................. 1-3P3 — Interrupt Channel Select (Factory Setting: G Connected; Interrupt Channels Disabled) ....................... 1-4P4 — Interrupt Source Select (Factory Setting: EXT) ..................................................................................... 1-5P5 — 8254 Timer/Counter Clock Sources (Factory Settings: CLK0-XTAL, CLK1-OUT0, CLK2-OUT1) .. 1-5P7 Through P10 — DAC1 Through DAC4 Output Range Select (Factory Setting: -5 to +5 Volts) ................ 1-6S1 — Base Address (Factory Setting: 300 hex (768 decimal)) ......................................................................... 1-7S2 and S3 — Buffer Bypass Switches (Factory Setting: OPEN (Not Bypassed)) ............................................ 1-8
Pull-up/Pull-down Resistors on Digital I/O Lines ............................................................................................... 1-10
CHAPTER 2 — BOARD INSTALLATION ....................................................................................... 2-1
Board Installation ................................................................................................................................................... 2-3External I/O Connections ....................................................................................................................................... 2-4
Connecting the Analog Outputs — Voltage Outputs ........................................................................................ 2-4Connecting the Analog Outputs — 4-20 mA Current Loop Outputs ................................................................ 2-4Connecting the Timer/Counters and Digital I/O ................................................................................................ 2-6
Running the 800DIAG Diagnostics Program ........................................................................................................ 2-6
CHAPTER 3 — HARDWARE DESCRIPTION................................................................................. 3-1
D/A Conversion ..................................................................................................................................................... 3-3Digital I/O, 8255 Programmable Peripheral Interface .......................................................................................... 3-3Timer/Counters ...................................................................................................................................................... 3-4Interrupts ................................................................................................................................................................ 3-4
CHAPTER 4 — BOARD OPERATION AND PROGRAMMING ................................................... 4-1
Defining the I/O Map ............................................................................................................................................. 4-3BA + 0: PPI Port A — Digital I/O (Read/Write) .............................................................................................. 4-4BA + 1: PPI Port B — Digital I/O (Read/Write) .............................................................................................. 4-4BA + 2: PPI Port C — Digital I/O (Read/Write) ............................................................................................... 4-4BA + 3: 8255 PPI Control Word (Write Only) ................................................................................................. 4-4BA + 4: D/A Converter 1 LSB (Write Only) .................................................................................................... 4-6BA + 5: D/A Converter 1 MSB (Write Only) .................................................................................................. 4-6BA + 6: D/A Converter 2 LSB (Write Only) .................................................................................................... 4-6BA + 7: D/A Converter 2 MSB (Write Only) .................................................................................................. 4-6BA + 8: D/A Converter 3 LSB (Write Only) .................................................................................................... 4-6BA + 9: D/A Converter 3 MSB (Write Only) .................................................................................................. 4-6BA + 10: D/A Converter 4 LSB (Write Only) .................................................................................................. 4-6BA + 11: D/A Converter 4 MSB (Write Only) ................................................................................................ 4-6
ii
BA + 12: Update DAC Outputs (Write Only) .................................................................................................. 4-6BA + 13: Reserved ............................................................................................................................................ 4-6BA + 14: IRQ Enable (Write Only) .................................................................................................................. 4-7BA + 15: Interrupt Status/Clear (Read/Write) .................................................................................................. 4-7BA + 16: 8254 Timer/Counter 0 (Read/Write) ................................................................................................. 4-7BA + 17: 8254 Timer/Counter 1 (Read/Write) ................................................................................................. 4-7BA + 18: 8254 Timer/Counter 2 (Read/Write) ................................................................................................. 4-7BA + 19: 8254 Control Word (Write Only) ..................................................................................................... 4-7
Programming the DA800 ....................................................................................................................................... 4-8Clearing and Setting Bits in a Port ..................................................................................................................... 4-9D/A Conversions .............................................................................................................................................. 4-10Initializing the 8255 PPI .................................................................................................................................. 4-12Digital I/O Operations ..................................................................................................................................... 4-12Timer/Counters ................................................................................................................................................ 4-12Interrupts .......................................................................................................................................................... 4-13
What Is an Interrupt? ................................................................................................................................... 4-13Interrupt Request Lines ............................................................................................................................... 4-138259 Programmable Interrupt Controller .................................................................................................... 4-14Interrupt Mask Register (IMR) .................................................................................................................... 4-14End-of-Interrupt (EOI) Command ............................................................................................................... 4-14What Exactly Happens When an Interrupt Occurs? .................................................................................... 4-14Using Interrupts in Your Programs ............................................................................................................. 4-14Writing an Interrupt Service Routine (ISR) ................................................................................................ 4-14Saving the Startup Interrupt Mask Register (IMR) and Interrupt Vector .................................................... 4-16Restoring the Startup IMR and Interrupt Vector ......................................................................................... 4-16Common Interrupt Mistakes ........................................................................................................................ 4-16
Example Programs ............................................................................................................................................... 4-17C and Pascal Programs .................................................................................................................................... 4-17BASIC Programs ............................................................................................................................................. 4-17
CHAPTER 5 — CALIBRATION ......................................................................................................... 5-1
Required Equipment ............................................................................................................................................... 5-3D/A Calibration ...................................................................................................................................................... 5-3
X2 Voltage Multiplier ........................................................................................................................................ 5-34-20 mA Current Loop ...................................................................................................................................... 5-5
APPENDIX A — DA800 SPECIFICATIONS ..................................................................................... A-1
APPENDIX B — I/O CONNECTOR PIN ASSIGNMENTS ............................................................. B-1
APPENDIX C — COMPONENT DATA SHEETS ............................................................................ C-1
APPENDIX D — WARRANTY............................................................................................................ D-1
iii
LIST OF ILLUSTRATIONS
1-1 Board Layout Showing Factory-Configured Settings .............................................................................. 1-41-2 Interrupt Channel Select Jumper, P3 ........................................................................................................ 1-41-3 Pulling Down the Interrupt Request Line ................................................................................................. 1-51-4 Interrupt Source Select Jumper, P4 .......................................................................................................... 1-51-5 8254 Timer/Counter Clock Source Jumpers, P5 ...................................................................................... 1-51-6 8254 Timer/Counter Circuit Block Diagram ............................................................................................ 1-61-7 DAC1 Through DAC8 Output Range Select, P7 Through P10 ............................................................... 1-71-8 Base Address Switch, S1 .......................................................................................................................... 1-81-9 Port C Buffer Circuitry ............................................................................................................................. 1-91-10 Port A Buffer Circuitry ............................................................................................................................. 1-91-11 Pull-up/Pull-down Resistor Circuitry ..................................................................................................... 1-101-12 Adding Pull-ups and Pull-downs to Some Digital I/O Lines ................................................................. 1-112-1 P2 and P6 I/O Connector Pin Assignments .............................................................................................. 2-42-2 Voltage Output Connections .................................................................................................................... 2-52-3 Current Output Connections, No Loop Supply ........................................................................................ 2-52-4 Current Output Connections, Single Loop Supply ................................................................................... 2-72-5 Current Output Connections, Multiple Loop Supplies ............................................................................. 2-73-1 DA800 Block Diagram ............................................................................................................................. 3-34-1 8254 Timer/Counter Circuit Block Diagram .......................................................................................... 4-125-1 Board Layout ............................................................................................................................................ 5-35-2 4-20 mA Current Loop Calibration Connections ..................................................................................... 5-5
iv
i-1
INTRODUCTION
i-2
i-3
The DA800 Advanced Industrial Control series analog output and digital control board turns your IBMPC/XT/AT or compatible into a high-performance testing and control system. Installed within a single short or full-size expansion slot in the computer, the DA800 board features:
• 4 fast-settling 12-bit analog output channels,• ±5, ±10, 0 to +5, or 0 to +10 volt analog output range,• Industrial 4-20 mA current loop source capability,• Simultaneous updating of all output channels,• 24 TTL/CMOS 8255-based programmable digital I/O lines,• Buffered outputs for high driving capability,• Three 16-bit, 8 MHz timer/counters,• Optional pull-up/pull-down resistors,• Simple I/O, strobed I/O & bidirectional I/O operation,• Software enabled interrupts (IRQ2-IRQ7),• BASIC, Turbo Pascal & Turbo C source code; diagnostics program.
The following paragraphs briefly describe the major functions of the board. More detailed discussions of boardfunctions are included in Chapter 3, Hardware Description, and Chapter 4, Board Operation and Programming. Theboard setup is described in Chapter 1, Board Settings.
Digital-to-Analog Conversion
The digital-to-analog (D/A) circuitry features two 12-bit converter channels in each AD7237 D/A converter ICfor a total of four output channels. The two channels in each AD7237 are internally double buffered and all chan-nels are simultaneously updated by issuing a single command. Each channel can be jumpered to one of four outputvoltage ranges, ±5, ±10, 0 to +5, or 0 to +10, or configured as a 4-20 mA current loop source. The industrial4-20 mA current loop signals are less susceptible than voltage signals to electrically induced noise.
Digital I/O
The DA800 has 24 TTL/CMOS-compatible digital I/O lines which can be directly interfaced with externaldevices or signals to sense switch closures, trigger digital events, or activate solid-state relays. These lines areprovided by the on-board 8255 programmable peripheral interface chip. The 8255 can be operated in one of threemodes: Mode 0, simple I/O; Mode 1, strobed I/O; or Mode 2, strobed bidirectional I/O. To ensure high drivingcapacity, CMOS buffers are installed. These buffers must be bypassed as described in Chapter 1 for Mode 1 andMode 2 operation. TTL buffers are available on request.
Pads for installing and activating pull-up or pull-down resistors on the digital I/O lines are included on theboard. Installation procedures are given at the end of Chapter 1, Board Settings.
8254 Timer/Counter
An 8254 programmable interval timer contains three 16-bit, 8 MHz timer/counters to support a wide range oftiming and counting functions. The clock, gate, and output pins for each of the timer/counters are available at the P2I/O connector.
What Comes With Your Board
You receive the following items in your DA800 package:
• DA800 interface board• Software and diagnostics diskette with BASIC, Turbo Pascal, and Turbo C source code• User’s manual
If any item is missing or damaged, please call Real Time Devices’ Customer Service Department at(814) 234-8087. If you require service outside the U.S., contact your local distributor.
i-4
Board Accessories
In addition to the items included in your DA800 package, Real Time Devices offers a full line of accessories.Call your local distributor or our main office for more information about these accessories and for help in choosingthe best items to support your board’s application.
Accessories for the DA800 include SIGNAL*MATH acquisition and analysis software, the MR8/MR16 series8 or 16 channel mechanical relay boards, the OP8/OP16 series 8 or 16 channel optoisolated digital input boards, theOR16 mechanical relay/optoisolated digital I/O board, the TB50 terminal board and XB50 prototype/terminal boardfor prototype development and easy signal access, and the XT50 twisted pair wire flat ribbon cable assembly forexternal interfacing.
Using This Manual
This manual is intended to help you install your new board and get it running quickly, while also providingenough detail about the board and its functions so that you can enjoy maximum use of its features even in the mostcomplex applications. We assume that you already have an understanding of data acquisition principles and that youcan customize the example software or write your own applications programs.
When You Need Help
This manual and the example programs in the software package included with your board provide enoughinformation to properly use all of the board’s features. If you have any problems installing or using this board,contact our Technical Support Department, (814) 234-8087, during regular business hours, eastern standard time oreastern daylight time, or send a FAX requesting assistance to (814) 234-5218. When sending a FAX request, pleaseinclude your company’s name and address, your name, your telephone number, and a brief description of theproblem.
1-1
CHAPTER 1
BOARD SETTINGS
The DA800 board has jumper and switch settings you canchange if necessary for your application. The board is factory-configured as listed and shown on a diagram in the beginning ofthis chapter. Should you need to change these settings, use theseeasy-to-follow instructions before you install the board in yourcomputer.
Note that by installing resistor packs at four RN locations nearthe 8255 PPI and soldering a jumper between +5V and common orground and common in the associated pads for each resistor net-work, you can configure groups of digital I/O lines to be pulled upor pulled down. This procedure is explained at the end of thischapter.
1-2
1-3
Factory-Configured Switch and Jumper Settings
Table 1-1 lists the factory settings of the user-configurable jumper and switches on the DA800 board. Fig-ure 1-1 shows the board layout and the locations of the factory-set jumpers. The following paragraphs explain howto change the factory settings. Pay special attention to the setting of S1, the base address switch, to avoid addresscontention when you first use your board in your system.
Table 1-1: Factory SettingsSwitch/Jumper Function Controlled
Factory Settings(Jumpers Installed)
P3
Connects the interrupt source selected on P4 toan interrupt channel, IRQ2-IRQ7; pulls tri-statebuffer to ground for multiple interrupt applications
All channels disabled; G (ground forbuffer) connected
P4 Selects the interrupt source EXT
P5Sets the clock sources for the three 8254timer/counters (TC0-TC2)
CLK0-OSC; CLK1-OT0; CLK2-OT1(all 3 timer/counters cascaded)
P7Configures the output voltage range or currentloop settings for DAC1
Jumpers installed on ±5, X1, VEN,VOUT to set output at -5 to +5 volts
P8Configures the output voltage range or currentloop settings for DAC2
Jumpers installed on ±5, X1, VEN,VOUT to set output at -5 to +5 volts
P9Configures the output voltage range or currentloop settings for DAC3
Jumpers installed on ±5, X1, VEN,VOUT to set output at -5 to +5 volts
P10Configures the output voltage range or currentloop settings for DAC4
Jumpers installed on ±5, X1, VEN,VOUT to set output at -5 to +5 volts
S1 Sets the base address 300 hex (768 decimal)
S2Bypasses 8255 Port A buffers for Mode 2operation Open (buffers not bypassed)
S3Bypasses 8255 Port C buffers for Mode 1 or Mode2 operation Open (buffers not bypassed)
1-4
Fig. 1-1 — Board Layout Showing Factory-Configured Settings
P3 — Interrupt Channel Select (Factory Setting: G Connected; Interrupt Channels Disabled)
This header connector, shown in Figure 1-2, lets you connect an interrupt source selected on P4 to an interruptchannel, IRQ2 through IRQ7. To connect the interrupt source to an interrupt channel, you must install a jumperacross the desired IRQ channel.
The rightmost pair of pins on P3, labeled G, are provided so that you can install a jumper which connects a1 kilohm pull-down resistor to the output of a high-impedance tri-state driver which carries the interrupt requestsignal. This pull-down resistor drives the interrupt request line low whenever interrupts are not active. So, wheneveran interrupt request is made, the tri-state buffer is enabled, forcing the output high and causing an interrupt. You canmonitor the interrupt status through bit 0 in the status word (I/O address location BA + 15). After the interrupt hasbeen serviced, the clear command returns the IRQ line low, disabling the tri-state buffers, and pulling the output lowagain. Figure 1-3 shows this circuit. Because the interrupt request line is driven low only by the pull-down resistor,you can have two or more boards which share the same IRQ channel. You can tell which board issued the interruptrequest by monitoring each board’s IRQ status bit.
NOTE: When you use multiple boards that share the same interrupt, only one board should have the G groundjumper installed. The rest should be disconnected. Whenever you operate a single board, the G jumper should beinstalled.
P3IRQ
2 3 4 5 6 7 G
Fig. 1-2 — Interrupt Channel Select Jumper, P3
82C54
82C55
Made in U
SA
DA800
5V 5V X1
X2
VE
N
IEN
VO
UT
IOU
T
+ --+ IOU
T
VO
UT
IEN
VE
N
X2
X15V5V
AO
UT
4A
OU
T3
AO
UT
2A
OU
T1
IRQ2 3 4 5 6 7 G
OT
0
OT
1
OT
2
EX
T
PC
3
PC
0
AD694 AD694
AD694AD694
74HC
T08
PAL
74LS244
PAL
74HCT245
74HC
T245
74LS125
74HCT688
74HCT243
AD7237
AD712
74HCT138
74HCT367
++
74HCT243
74HCT245
SWITCH
SWITCH
AD7237
AD712
Real Time Devices, Inc. State College, PA 16804
XTAL
+
SWITCH
+C20
C43
C22
C8U8S3
C1
U1
C13U13
S2
C10
U10
RN5V G PC
HPA
V G
RN3PB
VGPBC11
U11
P6
RN4
U9
C9
C4
U4
U3
C3
R1
V
G
PC
L
P3
U2
U14
C14
C2
C21
U12
U6
P5
RN2
P4RN15
U15
C6
U5
C5C19
U19C7
Y1
RN1
S1 BASE ADDRESS TR1 TR2 TR3 TR4TR5 TR6 TR7 TR8
P2
C30 C29 C24
C39
C37
C36
C41
C35
C42
C34
C31
C32
C33
C38
C40
C28C27C16 C17C26 C15C23 C25
P7
P8
RN8C18RN7
RN
10
P9
P10
RN9
U17U19
U16
U20
U23
U18
U21
U22PA
PCH
PCL
CLK
2C
LK1
CLK
0
OSC
OSC
OSC
EC0
EC2
EC1
OT1
OT0
R
,, ,,Accessing the Analog World
1-5
INTERRUPT
+5 VINTERRUPTREGISTER
INTSOURCE
CLR
IRQ STATUS
P3G
CLR
CLK
Fig. 1-3 — Pulling Down the Interrupt Request Line
P4 — Interrupt Source Select (Factory Setting: EXT)
This header connector, shown in Figure 1-4, lets you connect one of six interrupt sources for interrupt genera-tion. These sources are: OT0, OT1, and OT2, which are the three 8254 timer/counter outputs; PC3, which is theINTRA signal from the 8255 PPI; PC0, which is the INTRB signal from the 8255 PPI; and EXT, an externalinterrupt you can route onto the board through the P2 I/O connector. To connect an interrupt source, place thejumper across the desired set of pins. Note that only ONE interrupt source can be activated at a time.
P4
OT
0
OT
1
OT
2
EX
T
PC
3
PC
0
Fig. 1-4 — Interrupt Source Select Jumper, P4
P5 — 8254 Timer/Counter Clock Sources (Factory Settings: CLK0-XTAL, CLK1-OUT0, CLK2-OUT1)
This header connector, shown in Figure 1-5, lets you select the clock sources for the 8254 timer/counters, TC0,TC1, and TC2. The factory setting cascades all three timer/counters, with the clock source for TC0 being the on-board 8 MHz oscillator, the output of TC0 providing the clock for TC1, and the output of TC1 providing the clockfor TC2. You can connect any or all of the sources to an external clock input through the P2 I/O connector, or youcan set TC1 and TC2 to be clocked by the 8 MHz oscillator. Figure 1-6 shows a block diagram of the timer/countercircuitry to help you with these connections.
NOTE: When installing jumpers on this header, make sure that only one jumper is installed in each group oftwo or three CLK pins.
OSC
EC0
OT0
OSC
EC1
OT1
OSC
EC2
P5CLK
0C
LK1
CLK
2
Fig. 1-5 — 8254 Timer/Counter Clock Source Jumpers, P5
1-6
CLK1
CLK2
CLK0
8 00I/O CONNECTOR
P2
PIN 46
PIN 43
PIN 42
8254
TIMER/COUNTER
0CLK
GATE
OUT
TIMER/COUNTER
1CLK
GATE
OUT
TIMER/COUNTER
2CLK
GATE
OUT
PIN 39
PIN 44
OSC (8 MHz)
P5
+5 V
+5 V
+5 V
PIN 19
PIN 40
PIN 41
PIN 45
T/C OUT 0
OUT0
OUT1
EXT CLK 0
T/C OUT 1
EXT CLK 1
EXT GATE 2
T/C OUT 2
EXT CLK 2
EXT GATE 0
EXT GATE 1
Fig. 1-6 — 8254 Timer/Counter Circuit Block Diagram
P7 Through P10 — DAC1 Through DAC4 Output Range Select (Factory Setting: -5 to +5 Volts)
These identical header connectors, shown in Figure 1-7, let you independently set the output of each D/Aconverter to one of four voltage ranges or as a 4-20 mA current loop source. Figure 1-7 shows all five possibleconfigurations for these headers, and the table below summarizes these settings. The topmost pair of pins, 5V, isjumpered when operating in a unipolar voltage range or as a current loop. The next pair of pins, ±5V, is jumperedwhen operating in a bipolar voltage range (±5 or ±10 volts). The X1 and X2 pins set the range multiplier. When ajumper is installed across X1, the multiplier is set at times 1 for 0 to +5 and ±5 volt ranges. When the jumper isinstalled across X2, the multiplier is times 2 for 0 to +10 and ±10 volt ranges. The VEN pins enable voltage outputswhen a jumper is installed, or the IEN pins enable 4-20 mA current loop operation when a jumper is installed.Finally, a jumper must be placed across the VO pins for output voltages or across the IO pins for 4-20 mA currentloop operation. To configure each header for your application, install the jumpers as shown in the diagrams on thenext page for the desired output range. The factory setting of each DAC is shown in Figure 1-7a, ±5 volts.
Jumpers(left to right)
Output Range
±5V 0 to +5V ±10V 0 to +10V 4-20 mA
5V OFF ON OFF ON OFF
±5V ON OFF ON OFF ON
X1 ON ON OFF OFF ON
X2 OFF OFF ON ON OFF
VEN ON ON ON ON OFF
IEN OFF OFF OFF OFF ON
VOUT ON ON ON ON OFF
IOUT OFF OFF OFF OFF ON
1-7
5V ±5V
X1
X2
VE
N
IEN
VO
UT
IOU
T
Fig. 1-7a — ±5V Output5V ±5
V
X1
X2
VE
N
IEN
VO
UT
IOU
T
5V ±5V
X1
X2
VE
N
IEN
VO
UT
IOU
T
Fig. 1-7e — 4-20 mA Output
Fig. 1-7 — DAC1 Through DAC4 Output Range Select, P7 Through P10
S1 — Base Address (Factory Setting: 300 hex (768 decimal))
One of the most common causes of failure when you are first trying your board is address contention. Some ofyour computer’s I/O space is already occupied by internal I/O and other peripherals. When the DA800 boardattempts to use I/O address locations already used by another device, contention results and the board does not work.
To avoid this problem, the DA800 has an easily accessible DIP switch, S1, which lets you select any one of 16starting addresses in the computer’s I/O. Should the factory setting of 300 hex (768 decimal) be unsuitable for yoursystem, you can select a different base address simply by setting the switches to any value shown in Table 1-2. Thetable shows the switch settings and their corresponding decimal and hexadecimal (in parentheses) values. Make surethat you verify the order of the switch numbers on the switch (1 through 4) before setting them. When the switchesare pulled forward, they are OPEN, or set to logic 1, as labeled on the DIP switch package. When you set the baseaddress for your board, record the value in the table inside the back cover. Figure 1-8 shows the DIP switch set for abase address of 300 hex (768 decimal).
5V ±5V
X1
X2
VE
N
IEN
VO
UT
IOU
T
Fig. 1-7b — 0 to +5V Output
5V ±5V
X1
X2
VE
N
IEN
VO
UT
IOU
T
Fig. 1-7c — ±10V Output
Fig. 1-7d — 0 to +10V Output
Table 1-2: Base Address Switch Settings, S1Base AddressDecimal / (Hex)
Switch Setting4 3 2 1
Base AddressDecimal / (Hex)
Switch Setting4 3 2 1
512 / (200) 0 0 0 0 768 / (300) 1 0 0 0
544 / (220) 0 0 0 1 800 / (320) 1 0 0 1
576 / (240) 0 0 1 0 832 / (340) 1 0 1 0
608 / (260) 0 0 1 1 864 / (360) 1 0 1 1
640 / (280) 0 1 0 0 896 / (380) 1 1 0 0
672 / (2A0) 0 1 0 1 928 / (3A0) 1 1 0 1
704 / (2C0) 0 1 1 0 960 / (3C0) 1 1 1 0
736 / (2E0) 0 1 1 1 992 / (3E0) 1 1 1 1
0 = closed, 1 = open
1-8
Fig. 1-8 — Base Address Switch, S1
S2 and S3 — Buffer Bypass Switches (Factory Setting: OPEN (Not Bypassed))
Mode 1 Operation (S3) — When operating the 8255 in Mode 1, the lines of Port C function as control lines,some as outputs and some as inputs. When using Mode 1, the Port C buffers must be removed and bypassed to allowthe Port C lines to be individually set as inputs or outputs. Figure 1-9 shows the Port C buffers, and the followingsteps tell you how to configure the board for Mode 1 operation.
To remove buffering from Port C:
1. Close DIP switches 1 through 8 on S3.2. Remove U8 from the board.3. Remove U9 from the board.
CAUTION: Remember, whenever you close the switches on S3, be sure to remove the buffers, U8 and U9,from the board. Failure to do so may damage the board.
Mode 2 Operation (S2, S3) — When operating the 8255 in Mode 2, the lines of Port A must be bidirectionaland the lines of Port C function as control lines, some as outputs and some as inputs. When using Mode 2, both thePort A and Port C buffers must be removed and bypassed. Figure 1-10 shows the Port A buffers, Figure 1-9 showsthe Port C buffers, and the following steps tell you how to configure the board for Mode 2 operation.
To remove buffering from Ports A and C:
1. Close DIP switches 1 through 8 on S2 (Port A).2. Remove U10 from the board.3. Close DIP switches 1 through 8 on S3 (Port C).4. Remove U8 from the board.5. Remove U9 from the board.
CAUTION: Remember, whenever you close the switches on S2 and S3, be sure to remove the buffers, U8,U9, and U10, from the board. Failure to do so may damage the board.
1-9
PIN 24 PIN 16
PIN 26 PIN 14
PIN 28 PIN 12
PIN 30 PIN 10
800I/O CONNECTOR
P2 / P6
BUFFER
U8
BUFFER
U9
82C55
PORTC
S3
PIN 32 PIN 8
PIN 34 PIN 6
PIN 36 PIN 4
PIN 38 PIN 2
1
2
3
4
5
6
7
8
PC7
PC6
PC5
PC4
PC3
PC2
PC1
PC0
Fig. 1-9 — Port C Buffer Circuitry
PIN 23
PIN 25
PIN 27
PIN 29
800I/O CONNECTOR
P282C55
PORTA
S2
PIN 31
PIN 33
PIN 35
PIN 37
1
2
3
4
5
6
7
8
PA7
PA6
PA5
PA4
PA3
PA2
PA1
PA0
BUFFER
U10
Fig. 1-10 — Port A Buffer Circuitry
1-10
82C55
RN6
74LS245
74LS245
SWITCH
C13U13
S2
C10
U10
RN5V G PC
H
PA
V G
RN3PB
VGPBC11
U11
P6
RN4V
G
PC
L
PA
PCH
PCL
82C54
82C55
Made in U
SA
DA800
5V 5V X1
X2
VE
N
IEN
VO
UT
IOU
T
+ --+ IOU
T
VO
UT
IEN
VE
N
X2
X15V5V
AO
UT
4A
OU
T3
AO
UT
2A
OU
T1
IRQ2 3 4 5 6 7 G
OT
0
OT
1
OT
2
EX
T
PC
3
PC
0
AD694 AD694
AD694AD694
74HC
T08
PAL
74LS244
PAL
74HCT245
74HC
T245
74LS125
74HCT688
74HCT243
AD7237
AD712
74HCT138
74HCT367
++
74HCT243
74HCT245
SWITCH
SWITCH
AD7237
AD712
Real Time Devices, Inc. State College, PA 16804
XTAL
+
SWITCH
+C20
C43
C22
C8U8S3
C1
U1
C13U13
S2
C10
U10
RN5V G PC
H
PA
V G
RN3PB
VGPBC11
U11
P6
RN4
U9
C9
C4
U4
U3
C3
R1
V
G
PC
L
P3
U2
U14
C14
C2
C21
U12
U6
P5
RN2
P4RN15
U15
C6
U5
C5C19
U19C7
Y1
RN1
S1 BASE ADDRESS TR1 TR2 TR3 TR4TR5 TR6 TR7 TR8
P2
C30 C29 C24
C39
C37
C36
C41
C35
C42
C34
C31
C32
C33
C38
C40
C28C27C16 C17C26 C15C23 C25
P7
P8
RN8C18RN7
RN
10
P9
P10
RN9
U17U19
U16
U20
U23
U18
U21
U22PA
PCH
PCL
CLK
2C
LK1
CLK
0
OSC
OSC
OSC
EC0
EC2
EC1
OT1
OT0
R
,, ,,Accessing the Analog World
Pull-up/Pull-down Resistors on Digital I/O Lines
The 8255 programmable peripheral interface provides 24 parallel TTL/CMOS compatible digital I/O lineswhich can be interfaced with external devices. The lines are divided into four groups: eight Port A lines, eight PortB lines, four Port C Lower lines, and four Port C Upper lines. You can install and connect pull-up or pull-downresistors for any or all of these four groups of lines. You may want to pull lines up for connection to switches. Thiswill pull the line high when the switch is disconnected. Or, you may want to pull down lines connected to relayswhich control turning motors on and off. These motors turn on when the digital lines controlling them are high.Pulling these lines down keeps them from floating high during the brief period between power-up and initialization.
To use the pull-up/pull-down feature, you must first install 10 kilohm resistor packs in any or all of the fourlocations around the 8255, labeled PA, PB, PCL, and PCH. PA (RN3) and PB (RN6) take a 10-pin pack, and PCL(RN4) and PCH (RN5) take 6-pin packs. Figure 1-11 shows these locations.
After the resistor packs are installed, you must connect them into the circuit as pull-ups or pull-downs. Locatethe three-hole pads on the board near the resistor packs. They are labeled G (for ground) on one end and V (for Vcc)on the other end. The middle hole is common. PA is for Port A, PB for Port B, PCL is for Port C Lower, and PCH isfor Port C Upper. Figure 1-11 shows a blowup of the pull-up/pull-down pads. To operate as pull-ups, solder ajumper wire between the common pin (middle pin of the three) and the V pin. For pull-downs, solder a jumper wirebetween the common pin (middle pin) and the G pin. For example, Figure 1-12 shows Port A lines with pull-ups,Port C Lower with pull-downs, and Port C Upper with no resistors.
Fig. 1-11 — Pull-up/Pull-down Resistor Circuitry
1-11
8255
PORT A(PA0-7)
V G
PA+5 V
PULL-UP
PORT CLOWER(PC0-3)
V G
CL+5 V
PULL-DOWN
10K
10K
PORT CUPPER(PC4-7)
V G
CH+5 V
Fig. 1-12 — Adding Pull-ups and Pull-downs to Some Digital I/O Lines
1-12
2-1
CHAPTER 2
BOARD INSTALLATION
The DA800 board is easy to install in your IBM PC/XT/AT orcompatible computer. This chapter tells you step-by-step how toinstall and connect the board for voltage outputs and 4-20 mAcurrent loop outputs.
After you have installed the board and made all of your con-nections, you can turn your system on and run the 800DIAG boarddiagnostics program included on your example software disk toverify that your board is working.
2-2
2-3
Board Installation
Keep the board in its antistatic bag until you are ready to install it in your computer. When removing it from thebag, hold the board at the edges and do not touch the components or connectors.
Before installing the board in your computer, check the jumper settings. Chapter 1 reviews the factory settingsand how to change them. If you need to change any settings, refer to the appropriate instructions in Chapter 1. Notethat incompatible jumper settings can result in unpredictable board operation and erratic response.
Also note that the P2 I/O connector mounting bracket has an oversized cutout to allow space for running thecable to 20-pin on-board connector P6 through the same I/O slot. If you want to run both cables through the sameslot, you must make these connections before installing the board.
To install the board:
1. Turn OFF the power to your computer.
2. Remove the top cover of the computer housing (refer to your owner’s manual if you do not already knowhow to do this).
3. Select any unused short or full-size expansion slot and remove the slot bracket.
4. Touch the metal housing of the computer to discharge any static buildup and then remove the board from itsantistatic bag.
5. Holding the board by its edges, orient it so that its card edge (bus) connector lines up with the expansion slotconnector in the bottom of the selected expansion slot.
6. After carefully positioning the board in the expansion slot so that the card edge connector is resting on thecomputer’s bus connector, gently and evenly press down on the board until it is secured in the slot.
NOTE: Do not force the board into the slot. If the board does not slide into place, remove it and try again.Wiggling the board or exerting too much pressure can result in damage to the board or to the computer.
7. After the board is installed, secure the slot bracket back into place and put the cover back on your computer.The board is now ready to be connected via the external I/O connector at the rear panel of your computer.
2-4
39 40
37 38
35 36
33 34
31 32
29 30
27 28
25 26
23 24
21 22
19 20
17 18
15 16
13 14
11 12
9 10
7 8
5 6
3 4
1 2
49 50
47 48
45 46
43 44
41 42
AOUT1
AOUT2
AOUT3
AOUT4
ANALOG GND
ANALOG GND
ANALOG GND
ANALOG GND
EXT INT
EXT GATE 0
DIGITAL GND
PA7
PA6
PA5
PA4
PA3
PA2
PA1
PA0
EXT CLK 0
EXT GATE 1
EXT CLK 1
EXT CLK 2
+12 VOLTS
-12 VOLTS
ANALOG GND
ANALOG GND
ANALOG GND
ANALOG GND
ANALOG GND
ANALOG GND
ANALOG GND
ANALOG GND
DIGITAL GND
DIGITAL GND
DIGITAL GND
PC7
PC6
PC5
PC4
PC3
PC2
PC1
PC0
T/C OUT 0
T/C OUT 1
T/C OUT 2
EXT GATE 2
+5 VOLTS
DIGITAL GND
External I/O Connections
Figure 2-1 shows the DA800’s P2 I/O connector pinout and P6 on-board I/O connector pinout. Refer to thesediagrams as you make your I/O connections.
19 20
17 18
15 16
13 14
11 12
9 10
7 8
5 6
3 4
1 2PB0
PB1
PB2
PB3
PB4
PB5
PB6
PB7
+12 VOLTS
-12 VOLTS
PC0
PC1
PC2
PC3
PC4
PC5
PC6
PC7
+5 VOLTS
DIGITAL GND
Fig. 2-1 — P2 and P6 I/O Connector Pin Assignments
P250-pin I/O connector
P620-pin on-board I/O connector
Connecting the Analog Outputs — Voltage Outputs
When the analog output is configured as a voltage output, the high side of the device receiving the output isconnected to an AOUT line and the low side is connected to the corresponding ANALOG GND. Figure 2-2 showshow to connect the DA800 voltage outputs to a load.
Connecting the Analog Outputs — 4-20 mA Current Loop Outputs
When the analog output is configured as a 4-20 mA current loop source, you can operate the loop using only the+12 volts supplied to the DA800 to power the current loop transmitters, or you can use external power supplies fordual power supply operation.
Current Loop Operation, No Loop Power Supply: Figure 2-3 shows how to connect the current looptransmitter outputs to a resistive load with no external loop supply. The AD694 current loop transmitters used on theDA800 are designed to be stable when driving resistive loads. For inductive or poorly defined loads, it is recom-mended that you add a 0.01 µF capacitor in the location provided on the board for each analog output channel. Thetable included in Figure 2-3 lists each channel and its corresponding capacitor number on the board. These capaci-tors are located with the analog output circuitry on the top half of the board. The capacitor is placed between theoutput of the AD694 and analog ground, as shown in the circled area of Figure 2-3.
2-5
PIN 7
LOAD
LOAD
OP- AMP
I/ O CONNECTORP2
8 0 0
PIN 2 ANALOG GND
PIN 1 AOUT 1
AOUT 4
PIN 8 ANALOG GND
BUFFERS
AD7 1 2
AD7 1 2
Fig. 2-2 — Voltage Output Connections
PIN 7
LOAD
LOAD
I/ O CONNECTORP2
8 0 0
PIN 2 ANALOG GND
PIN 1 AOUT 1
AOUT 4
PIN 8 ANALOG GND
AD6 9 4
AD6 9 4
CURRENT LOOPTRANSMITTERS
Fig. 2-3 — Current Output Connections, No Loop Supply
AD694
C24.01 µF
PIN 1AOUT1
Channel Capacitor
AOUT1 C24
AOUT2 C26
AOUT3 C28
AOUT4 C30
2-6
Current Loop Operation, Single Loop Power Supply: Figure 2-4 shows how to connect the current looptransmitter outputs to corresponding loads with a single external loop supply not exceeding 24 volts. The AD694current loop transmitters used on the DA800 are powered through the board by +12 volts. When operated with a+12 volt supply, the AD694 can source a current to a point as low as 24 volts below common.
WARNING!! Be sure to observe the correct polarity when connecting the externalloop supply. The positive terminal is connected to ANALOG GND, and the negativeterminal is connected to the load side, as shown in the diagram! Failure to properlyconnect the supply can damage the board.
Current Loop Operation, Multiple Loop Power Supplies: Figure 2-5 shows how to connect the current looptransmitter outputs to corresponding loads with an external loop supply not exceeding 24 volts in each loop.
WARNING!! Be sure to observe the correct polarity when connecting the externalloop supplies. The positive terminal is connected to ANALOG GND, and the negativeterminal is connected to the load side, as shown in the diagram! Failure to properlyconnect the supply can damage the board.
Connecting the Timer/Counters and Digital I/O
For all of the digital connections, the high side of an external signal source or destination device is connected tothe appropriate signal pin on the P2 or P6 I/O connector, and the low side is connected to any DIGITAL GND.
Running the 800DIAG Diagnostics Program
Now that your board is ready to use, you will want to try it out. An easy-to-use, menu-driven diagnosticsprogram, 800DIAG, is included with your example software to help you verify your board’s operation. You can alsouse this program to make sure that your current base address setting does not contend with another device.
2-7
PIN 7
I/ O CONNECTORP2
8 0 0
PIN 2
PIN 1 AOUT 1
AOUT 4
PIN 8 ANALOG GND
AD6 9 4
AD6 9 4
CURRENT LOOPTRANSMITTERS
-+SUPPLYLOOP
2 4 V MAX
LOAD
LOAD
Fig. 2-4 — Current Output Connections, Single Loop Supply
Fig. 2-5 — Current Output Connections, Multiple Loop Supplies
PIN 7
I/ O CONNECTORP2
8 0 0
PIN 2 ANALOG GND
PIN 1 AOUT 1
AOUT 4
PIN 8 ANALOG GND
AD6 9 4
AD6 9 4
CURRENT LOOPTRANSMITTERS
LOAD
LOAD
2 4 V MAX
LOOPSUPPLY
+ -
-+SUPPLYLOOP
2 4 V MAX
2-8
3-1
CHAPTER 3
HARDWARE DESCRIPTION
This chapter describes the features of the DA800 . The threemajor circuits are the D/A, the timer/counters, and the digital I/O.This chapter also describes the hardware-selectable interrupts.
3-2
3-3
+5 VOLTS
±12 VOLTS
9
ADDRESSDECODE
INTERRUPTSELECT
ADDRESS
DATA
CONTROL
PC
BU
S
EXTINT
TIMER/COUNTER
I/OSELECT
8254PIT
8255PPI
12-BITD/A
CONVERTER V/I SELECT
V/I SELECT
12-BITD/A
CONVERTERV/I SELECT
V/I SELECTAOUT1
AOUT2
AOUT3
AOUT4
I/O
CO
NN
EC
TO
R
BUFFERSAND
PULL-UP/DOWNRESISTORS
8 MHzOSC
24ON BOARD CONNECTOR8
168
3
2
The DA800 provides four analog output channels with voltage or 4-20 mA current loop outputs, three 16-bittimer/counters, and 24 TTL/CMOS digital I/O lines, as shown Figure 3-1. This chapter describes the hardwarewhich makes up the major circuits and hardware-selectable interrupts.
D/A Conversion
The DA800 board performs digital-to-analog conversions on four independent analog output channels. Theoutput of each conversion channel is jumper-selectable for ±5, ±10, 0 to +5, or 0 to +10 volts, or as a 4-20 mAcurrent loop source.
The AD7237 12-bit D/A converter contains two independent D/A converter channels in a single CMOSpackage. The data to be converted is double buffered at the D/A input, which allows simultaneous updating of alleight D/A output channels.
For voltage outputs, the AD712 precision operational amplifier provides complete coverage of the outputvoltage ranges. The exceptionally low offset voltage and drift ensure an accurate analog output on each channel.
For current loop outputs, the AD694 current loop transmitter converts the voltage output of the D/A converter toa corresponding current between 4 and 20 mA.
Digital I/O, 8255 Programmable Peripheral Interface
The 8255 programmable peripheral interface (PPI) can be easily configured to solve a wide range of digitalreal-world problems. This high-performance TTL/CMOS compatible chip has 24 parallel programmable digital I/Olines divided into two groups of 12 lines each:
Group A — Port A (8 lines) and Port C Upper (4 lines);Group B — Port B (8 lines) and Port C Lower (4 lines).
Fig. 3-1 — DA800 Block Diagram
3-4
Each group can be programmed for one of three modes of operation. When operating in Mode 1, the on-boardbuffers must be removed from the Port C lines. When operating in Mode 2, both Port A and Port C buffering mustbe removed. This procedure is described in Chapter 1 in the S2 and S3 DIP switch discussion. The three operatingmodes are:
Mode 0 — Basic input/output. Lets you use simple input and output operation for a port. Data is written to orread from the specified port.
Mode 1 — Strobed input/output. Lets you transfer I/O data from Port A in conjunction with strobes or hand-shaking signals.
Mode 2 — Strobed bidirectional input/output. Lets you communicate bidirectionally with an external devicethrough Port A. Handshaking is similar to Mode 1.
These modes are detailed in the 8255 Data Sheet, reprinted from Intel in Appendix C.
The bidirectional buffers on the 8255’s I/O lines monitor the 8255 control word to automatically set theirdirection. Hardware changes to the buffer circuitry are required only when using Mode 1 or Mode 2, where the PortA and/or Port C buffers must be removed as described in Chapter 1.
Timer/Counters
An 8254 programmable interval timer provides three 16-bit, 8 MHz timer/counters to support a wide range oftiming and counting functions. These timer/counters can be cascaded or used individually for many applications.
Each timer/counter has two inputs, CLK in and GATE in, and one output, timer/counter OUT. The clocksources for the timer/counters can be selected using jumpers on header connector P5 (see Chapter 1). The timer/counters can be programmed as binary or BCD down counters by writing the appropriate data to the command word,as described in Chapter 4. The command word also lets you set up the mode of operation. The six programmablemodes are:
Mode 0 Event Counter (Interrupt on Terminal Count)Mode 1 Hardware-Retriggerable One-ShotMode 2 Rate GeneratorMode 3 Square Wave ModeMode 4 Software-Triggered StrobeMode 5 Hardware Triggered Strobe (Retriggerable)
These modes are detailed in the 8254 Data Sheet, reprinted from Intel in Appendix C.
Interrupts
The DA800 can use any one of six signal sources to generate interrupts. These sources are: OT0, OT1, andOT2, which are the three 8254 timer/counter outputs; PC3, which is the INTRA signal from the 8255 PPI; PC0,which is the INTRB signal from the 8255 PPI; and EXT, an external interrupt you can route onto the board throughthe P2 I/O connector. Chapter 1 tells you how to set the jumpers on interrupt header connectors P3 and P4, andChapter 4 provides some programming information.
4-1
CHAPTER 4
BOARD OPERATION AND PROGRAMMING
This chapter shows you how to program and use your DA800board. It provides a complete description of the I/O map andprogramming operations to aid you in programming. The exampleprograms included on the disk in your board package are listed atthe end of this chapter. These programs, written in Turbo C, TurboPascal, and BASIC, include source code to simplify yourapplications programming.
4-2
4-3
Defining the I/O Map
The I/O map for the DA800 is shown in Table 4-1 below. As shown, the board occupies 20 consecutive I/O portlocations. The base address (designated as BA) can be selected using DIP switch S1 as described in Chapter 1,Board Settings. This switch can be accessed without removing the board from the connector. The following sectionsdescribe the register contents of each address used in the I/O map.
Table 4-1: DA800 I/O Map
Register Description Read Function Write FunctionAddress *(Decimal)
8255 PPI Port A Read Port A digital input linesProgram Port A digital outputlines BA + 0
8255 PPI Port B Read Port B digital input linesProgram Port B digital outputlines BA + 1
8255 PPI Port C Read Port C digital input linesProgram Port C digital outputlines BA + 2
8255 PPI Control Word Reserved Program PPI configuration BA + 3
D/A Converter 1 LSB Reserved Program DAC1 LSB BA + 4
D/A Converter 1 MSB Reserved Program DAC1 MSB BA + 5
D/A Converter 2 LSB Reserved Program DAC2 LSB BA + 6
D/A Converter 2 MSB Reserved Program DAC2 MSB BA + 7
D/A Converter 3 LSB Reserved Program DAC3 LSB BA + 8
D/A Converter 3 MSB Reserved Program DAC3 MSB BA + 9
D/A Converter 4 LSB Reserved Program DAC4 LSB BA + 10
D/A Converter 4 MSB Reserved Program DAC4 MSB BA + 11
Update All DACs ReservedUpdates the outputs of allDACs BA + 12
Reserved Reserved Reserved BA + 13
IRQ Enable ReservedEnable and disable interruptgeneration BA + 14
Interrupt Status/Clear Read status of interrupt Clear interrupt BA + 15
8254 Timer/Counter 0 Read TC0 count value Load TC0 count register BA + 16
8254 Timer/Counter 1 Read TC1 count value Load TC1 count register BA + 17
8254 Timer/Counter 2 Read TC2 count value Load TC2 count register BA + 18
8254 Control Word Reserved Program control register BA + 19
* BA = Base Address
4-4
BA + 0: PPI Port A — Digital I/O (Read/Write)
Transfers the 8-bit Port A digital input and digital output data between the board and an external device. A readtransfers data from the external device, through P2, and into PPI Port A; a write transfers the written data fromPort A through P2 to an external device.
BA + 1: PPI Port B — Digital I/O (Read/Write)
Transfers the 8-bit Port B digital input and digital output data between the board and an external device. A readtransfers data from the external device, through on-board I/O connector P6, and into PPI Port B; a write transfers thewritten data from Port B through P6 to an external device.
BA + 2: PPI Port C — Digital I/O (Read/Write)
Transfers the two 4-bit Port C digital input and digital output data groups (Port C Upper and Port C Lower)between the board and an external device. A read transfers data from the external device, through P2 and on-boardI/O connector P6, and into PPI Port C; a write transfers the written data from Port C through P2 and P6 to anexternal device.
BA + 3: 8255 PPI Control Word (Write Only)
When bit 7 of this word is set to 1, a write programs the PPI configuration. The table at the top of the next pageshows the control words for the 16 possible Mode 0 Port I/O combinations.
D7 D6 D5 D4 D3 D2 D1 D0
Port C Lower0 = output1 = input
Port B0 = output1 = input
Mode Set Flag1 = active
Port C Upper0 = output1 = input
Port A0 = output1 = input
Group B
Mode Select0 = mode 01 = mode 1
Group A
Mode Select00 = mode 001 = mode 11x = mode 2
4-5
When bit 7 of this word is set to 0, a write can be used to individually program the Port C lines.
D7 D6 D5 D4 D3 D2 D1 D0
Set/ResetFunction Bit0 = active
Bit Set/Reset0 = set bit to 01 = set bit to 1
Bit Select000 = PC0001 = PC1010 = PC2011 = PC3100 = PC4101 = PC5110 = PC6111 = PC7
8255 Port I/O Flow Direction and Control Words, Mode 0Group A Group B Control Word
Port A Port C Upper Port B Port C Lower Binary Decimal Hex
Output Output Output Output 1 0 0 0 0 0 0 0 128 80
Output Output Output Input 1 0 0 0 0 0 0 1 129 81
Output Output Input Output 1 0 0 0 0 0 1 0 130 82
Output Output Input Input 1 0 0 0 0 0 1 1 131 83
Output Input Output Output 1 0 0 0 1 0 0 0 136 88
Output Input Output Input 1 0 0 0 1 0 0 1 137 89
Output Input Input Output 1 0 0 0 1 0 1 0 138 8A
Output Input Input Input 1 0 0 0 1 0 1 1 139 8B
Input Output Output Output 1 0 0 1 0 0 0 0 144 90
Input Output Output Input 1 0 0 1 0 0 0 1 145 91
Input Output Input Output 1 0 0 1 0 0 1 0 146 92
Input Output Input Input 1 0 0 1 0 0 1 1 147 93
Input Input Output Output 1 0 0 1 1 0 0 0 152 98
Input Input Output Input 1 0 0 1 1 0 0 1 153 99
Input Input Input Output 1 0 0 1 1 0 1 0 154 9A
Input Input Input Input 1 0 0 1 1 0 1 1 155 9B
4-6
D7 D6 D5 D4 D3 D2 D1 D0
For example, if you want to set Port C bit 0 to 1, you would set up the control word so that bit 7 is 0; bits 1, 2,and 3 are 0 (this selects PC0); and bit 0 is 1 (this sets PC0 to 1). The control word is set up like this:
Set/ResetFunction Bit
Set PC0X = don’t care
Sets PC0 to 1:(written to BA +3)
0 X X X 0 0 0 1
Bit Select000 = PC0
BA + 4: D/A Converter 1 LSB (Write Only)
Programs the DAC1 LSB (eight bits).
BA + 5: D/A Converter 1 MSB (Write Only)
Programs the DAC1 MSB (four bits) into D0 through D3; D4 through D7 are irrelevant.
BA + 6: D/A Converter 2 LSB (Write Only)
Programs the DAC2 LSB (eight bits).
BA + 7: D/A Converter 2 MSB (Write Only)
Programs the DAC2 MSB (four bits) into D0 through D3; D4 through D7 are irrelevant.
BA + 8: D/A Converter 3 LSB (Write Only)
Programs the DAC3 LSB (eight bits).
BA + 9: D/A Converter 3 MSB (Write Only)
Programs the DAC3 MSB (four bits) into D0 through D3; D4 through D7 are irrelevant.
BA + 10: D/A Converter 4 LSB (Write Only)
Programs the DAC4 LSB (eight bits).
BA + 11: D/A Converter 4 MSB (Write Only)
Programs the DAC4 MSB (four bits) into D0 through D3; D4 through D7 are irrelevant.
D7 D6 D5 D4 D3 D2 D1 D0DAC LSB
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
D7 D6 D5 D4 D3 D2 D1 D0DAC MSB
X X X X Bit 11 Bit 10 Bit 9 Bit 8
BA + 12: Update DAC Outputs (Write Only)
A write simultaneously starts a D/A conversion in all eight channels (data written is irrelevant). If the data hasnot been updated since the last conversion, the output of the DAC will not change.
BA + 13: Reserved
4-7
BA + 14: IRQ Enable (Write Only)
Enables and disables interrupt generation. Writing a “1” enables interrupt generation; writing a “0” disablesinterrupt generation.
D7 D6 D5 D4 D3 D2 D1 D0
Interrupt Enable/Disable0 = interrupt disabled1 = interrupt enabled
0 0 0 0 0 0 0
BA + 15: Interrupt Status/Clear (Read/Write)
A read shows the status of the interrupt (bit 0 only) as defined below. A write clears the interrupt (data written isirrelevant). Each time the interrupt status bit goes high, a write should follow to clear the bit.
D7 D6 D5 D4 D3 D2 D1 D0
Interrupt Status0 = no interrupt1 = interrupt has occurred
X X X X X X X
BA + 16: 8254 Timer/Counter 0 (Read/Write)
A read shows the count in the counter, and a write loads the counter with a new value. Counting begins as soonas the count is loaded.
BA + 17: 8254 Timer/Counter 1 (Read/Write)
A read shows the count in the counter, and a write loads the counter with a new value. Counting begins as soonas the count is loaded.
BA + 18: 8254 Timer/Counter 2 (Read/Write)
A read shows the count in the counter, and a write loads the counter with a new value. Counting begins as soonas the count is loaded.
BA + 19: 8254 Control Word (Write Only)
Accesses the 8254 control register to directly control the three timer/counters.
D7 D6 D5 D4 D3 D2 D1 D0
Counter Select00 = Counter 001 = Counter 110 = Counter 211 = read back setting
BCD/Binary0 = binary1 = BCD
Counter Mode Select000 = Mode 0, event count001 = Mode 1, programmable 1-shot010 = Mode 2, rate generator011 = Mode 3, square wave rate generator100 = Mode 4, software-triggered strobe101 = Mode 5, hardware-triggered strobe
Read/Load00 = latching operation01 = read/load LSB only10 = read/load MSB only11 = read/load LSB, then MSB
4-8
Programming the DA800
This section gives you some general information about programming and the DA800 board, and then walks youthrough the major DA800 programming functions. These descriptions will help you as you use the example pro-grams included with the board. All of the program descriptions in this section use decimal values unless otherwisespecified.
The DA800 is programmed by writing to and reading from the correct I/O port locations on the board. TheseI/O ports were defined in the previous section. Most high-level languages such as BASIC, Pascal, C, and C++, andof course assembly language, make it very easy to read/write these ports. The table below shows you how to readfrom and write to I/O ports using some popular programming languages.
In addition to being able to read/write the I/O ports on the DA800, you must be able to perform a variety ofoperations that you might not normally use in your programming. The table below shows you some of the operatorsdiscussed in this section, with an example of how each is used with Pascal, C, and BASIC. Note that the modulusoperator is used to retrieve the least significant byte (LSB) of a two-byte word, and the integer division operator isused to retrieve the most significant byte (MSB).
Many compilers have functions that can read/write either 8 or 16 bits from/to an I/O port. For example, TurboPascal uses Port for 8-bit port operations and PortW for 16 bits, Turbo C uses inportb for an 8-bit read of a portand inport for a 16-bit read. Be sure to use only 8-bit operations with the DA800!
/DQJXDJH 5HDG :ULWH
%$6,& 'DWD ,13�$GGUHVV� 287�$GGUHVV�'DWD
7XUER�& 'DWD LQSRUWE�$GGUHVV� RXWSRUWE�$GGUHVV�'DWD�
7XUER�3DVFDO 'DWD� 3RUW>$GGUHVV@ 3RUW>$GGUHVV@� 'DWD
$VVHPEO\PRY�G[�$GGUHVVLQ�DO�G[
PRY�G[�$GGUHVVPRY�DO�'DWDRXW�G[�DO
/DQJXDJH 0RGXOXV ,QWHJHU�'LYLVLRQ $1' 25
&�
D� �E���F�
D� �E���F
D� �E��F_
D� �E�_�F
3DVFDO02'
D�� �E�02'�F',9
D�� �E�',9�F$1'
D�� �E�$1'�F25
D�� �E�25�F
%$6,&02'
D� �E�02'�F?
D� �E�?�F$1'
D� �E�$1'�F25
D� �E�25�F
4-9
Clearing and Setting Bits in a Port
When you clear or set one or more bits in a port, you must be careful that you do not change the status of theother bits. You can preserve the status of all bits you do not wish to change by proper use of the AND and ORbinary operators. Using AND and OR, single or multiple bits can be easily cleared in one operation.
To clear a single bit in a port, AND the current value of the port with the value b, where b = 255 - 2bit.
Example: Clear bit 5 in a port. Read in the current value of the port, AND it with 223(223 = 255 - 25), and then write the resulting value to the port. In BASIC, this is programmed as:
V = INP(PortAddress)V = V AND 223OUT PortAddress, V
To set a single bit in a port, OR the current value of the port with the value b, where b = 2bit.
Example: Set bit 3 in a port. Read in the current value of the port, OR it with 8 (8 = 23), and thenwrite the resulting value to the port. In Pascal, this is programmed as:
V := Port[PortAddress];V := V OR 8;Port[PortAddress] := V;
Setting or clearing more than one bit at a time is accomplished just as easily. To clear multiple bits in a port,AND the current value of the port with the value b, where b = 255 - (the sum of the values of the bits to be cleared).Note that the bits do not have to be consecutive.
Example: Clear bits 2 ,4, and 6 in a port. Read in the current value of the port, AND it with 171(171 = 255 - 22 - 24 - 26), and then write the resulting value to the port. In C, this is programmedas:
v = inportb(port_address);v = v & 171;outportb(port_address, v);
To set multiple bits in a port, OR the current value of the port with the value b, where b = the sum of theindividual bits to be set. Note that the bits to be set do not have to be consecutive.
Example: Set bits 3, 5, and 7 in a port. Read in the current value of the port, OR it with 168(168 = 23 + 25 + 27), and then write the resulting value back to the port. In assembly language, thisis programmed as:
mov dx, PortAddressin al, dxor al, 168out dx, al
Often, assigning a range of bits is a mixture of setting and clearing operations. You can set or clear each bitindividually or use a faster method of first clearing all the bits in the range then setting only those bits that must beset using the method shown above for setting multiple bits in a port. The following example shows how this two-step operation is done.
Example: Assign bits 3, 4, and 5 in a port to 101 (bits 3 and 5 set, bit 4 cleared). First, read in theport and clear bits 3, 4, and 5 by ANDing them with 199. Then set bits 3 and 5 by ORing themwith 40, and finally write the resulting value back to the port. In C, this is programmed as:
v = inportb(port_address);v = v & 199;v = v | 40;outportb(port_address, v);
4-10
A final note: Don’t be intimidated by the binary operators AND and OR and try to use operators for which youhave a better intuition. For instance, if you are tempted to use addition and subtraction to set and clear bits in placeof the methods shown above, DON’T! Addition and subtraction may seem logical, but they will not work if you tryto clear a bit that is already clear or set a bit that is already set. For example, you might think that to set bit 5 of aport, you simply need to read in the port, add 32 (25) to that value, and then write the resulting value back to the port.This works fine if bit 5 is not already set. But, what happens when bit 5 is already set? Bits 0 to 4 will be unaffectedand we can’t say for sure what happens to bits 6 and 7, but we can say for sure that bit 5 ends up cleared instead ofbeing set. A similar problem happens when you use subtraction to clear a bit in place of the method shown above.
Now that you know how to clear and set bits, we are ready to look at the programming steps for the DA800board functions.
D/A Conversions
D/A conversions are performed on the four analog output channels, AOUT1 through AOUT4, by writing data tothe D/A converter registers and then issuing an update command (BA + 12) which simultaneously updates theoutputs of all four channels.
The 12-bit digital data for each channel is loaded in a two step process, LSB followed by MSB. After the datahas been loaded for all desired channels, the channels are simultaneously updated by issuing the update command. Ifa channel’s data has not been updated since the last conversion, the output of the DAC will not change. The digitaldata is converted to a corresponding voltage or 4-20 mA current loop value which is present at the output until newdata is loaded and another update command is issued.
The output voltage ranges or current loop operation are determined by the settings of the AOUT channeljumpers on P7 through P10. The following tables show key digital inputs and their corresponding outputs forunipolar and bipolar voltage ranges and for 4-20 mA current loop transmission. The resolution for 0 to +5 volts is1.22 millivolts; for 0 to +10 and ±5 volts, 2.44 millivolts; for ±10 volts, 4.88 millivolts, and for 4-20 mA currentloop, .0039 mA.
D/A Converter Unipolar Calibration Table
D/A Bit Weight
Ideal Output Voltage (in millivolts)
0 to +5 V 0 to +10 V
4095 (Max. Output) 4998.8 9997.6
2048 2500.0 5000.0
1024 1250.0 2500.0
512 625.00 1250.0
256 312.50 625.00
128 156.250 312.50
64 78.125 156.250
32 39.063 78.125
16 19.5313 39.063
8 9.7656 19.5313
4 4.8828 9.7656
2 2.4414 4.8828
1 1.2207 2.4414
0 0.0000 0.0000
4-11
D/A Converter Bipolar Calibration Table
D/A Bit Weight
Ideal Output Voltage (in millivolts)
±5 V ±10 V
4095 (Max. Output) +4997.6 +9995.1
2048 0.0 0.0
1024 -2500.0 -5000.0
512 -3750.0 -7500.0
256 -4375.0 -8750.0
128 -4687.5 -9375.0
64 -4843.8 -9687.5
32 -4921.9 -9843.8
16 -4960.9 -9921.9
8 -4980.5 -9960.9
4 -4990.2 -9980.5
2 -4995.1 -9990.2
1 -4997.6 -9995.1
0 -5000.0 -10000.0
D/A Converter 4-20 mA Current Loop CalibrationTable
D/A Bit WeightIdeal Output Current
(in millamperes)
4095 (Max. Output) 19.9961
2048 12.0000
1024 8.0000
512 6.0000
256 5.0000
128 4.5000
64 4.2500
32 4.1250
16 4.0625
8 4.0313
4 4.0156
2 4.0078
1 4.0039
0 4.0000
4-12
Initializing the 8255 PPI
Before you can use the 24 8255 based digital I/O lines on your DA800, the 8255 must be initialized. This stepmust be executed every time you start up, reset, or reboot your computer.
The 8255 is initialized by writing the appropriate control word to I/O port BA + 3. The contents of your controlword will vary, depending on how you want to configure your I/O lines. Use the control word description in theprevious I/O map section to help you program the right value. In the example below, a decimal value of 128 sets upthe 8255 so that all I/O lines are Mode 0 outputs.
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 0 0 0 0 0
Digital I/O Operations
Once the 8255 is initialized, you can use the digital I/O lines to control or monitor external devices.
Timer/Counters
An 8254 programmable interval timer provides three 16-bit, 8-MHz timer/counters for timing and countingfunctions such as frequency measurement, event counting, and interrupts. All three timer/counters are cascaded atthe factory. Figure 4-1 shows the timer/counter circuitry.
Each timer/counter has two inputs, CLK in and GATE in, and one output, timer/counter OUT. They can beprogrammed as binary or BCD down counters by writing the appropriate data to the command word, as described inthe I/O map section at the beginning of this chapter.
One of two clock sources, the on-board 8-MHz crystal or an external clock routed through I/O connector P2 canbe selected as the clock input to each timer/counter. In addition, the timer/counters can be cascaded by connectingTC0’s output to TC1’s clock input and TC1’s output to TC2’s clock input. The diagram shows how these clocksources are connected to the timer/counters.
CLK1
CLK2
CLK0
8 00I/O CONNECTOR
P2
PIN 46
PIN 43
PIN 42
8254
TIMER/COUNTER
0CLK
GATE
OUT
TIMER/COUNTER
1CLK
GATE
OUT
TIMER/COUNTER
2CLK
GATE
OUT
PIN 39
PIN 44
OSC (8 MHz)
P5
+5 V
+5 V
+5 V
PIN 19
PIN 40
PIN 41
PIN 45
T/C OUT 0
OUT0
OUT1
EXT CLK 0
T/C OUT 1
EXT CLK 1
EXT GATE 2
T/C OUT 2
EXT CLK 2
EXT GATE 0
EXT GATE 1
Fig. 4-1 — 8254 Timer/Counter Circuit Block Diagram
4-13
An external gate source can be connected to each timer/counter through P2. When a gate is disconnected, an on-board pull-up resistor automatically pulls the gate high, enabling the timer/counter.
The output from each timer/counter is available at P2, where it can be used for interrupt generation or forcounting functions.
The timer/counters can be programmed to operate in one of six modes, depending on your application. Thefollowing paragraphs briefly describe each mode. The 8254 data sheet included in Appendix C provides moredetailed information.
Mode 0, Event Counter (Interrupt on Terminal Count). This mode is typically used for event counting.While the timer/counter counts down, the output is low, and when the count is complete, it goes high. The outputstays high until a new Mode 0 control word is written to the timer/counter.
Mode 1, Hardware-Retriggerable One-Shot. The output is initially high and goes low on the clock pulsefollowing a trigger to begin the one-shot pulse. The output remains low until the count reaches 0, and then goes highand remains high until the clock pulse after the next trigger.
Mode 2, Rate Generator. This mode functions like a divide-by-N counter and is typically used to generate areal-time clock interrupt. The output is initially high, and when the count decrements to 1, the output goes low forone clock pulse. The output then goes high again, the timer/counter reloads the initial count, and the process isrepeated. This sequence continues indefinitely.
Mode 3, Square Wave Mode. Similar to Mode 2 except for the duty cycle output, this mode is typically usedfor baud rate generation. The output is initially high, and when the count decrements to one-half its initial count, theoutput goes low for the remainder of the count. The timer/counter reloads and the output goes high again. Thisprocess repeats indefinitely.
Mode 4, Software-Triggered Strobe. The output is initially high. When the initial count expires, the outputgoes low for one clock pulse and then goes high again. Counting is “triggered” by writing the initial count.
Mode 5, Hardware Triggered Strobe (Retriggerable). The output is initially high. Counting is triggered bythe rising edge of the gate input. When the initial count has expired, the output goes low for one clock pulse andthen goes high again.
Interrupts
- What Is an Interrupt?
An interrupt is an event that causes the processor in your computer to temporarily halt its current process andexecute another routine. Upon completion of the new routine, control is returned to the original routine at the pointwhere its execution was interrupted.
Interrupts are very handy for dealing with asynchronous events (events that occur at less than regular intervals).Keyboard activity is a good example; your computer cannot predict when you might press a key and it would be awaste of processor time for it to do nothing while waiting for a keystroke to occur. Thus, the interrupt scheme isused and the processor proceeds with other tasks. Then, when a keystroke does occur, the keyboard ‘interrupts’ theprocessor, and the processor gets the keyboard data, places it in memory, and then returns to what it was doingbefore it was interrupted. Other common devices that use interrupts are modems, disk drives, and mice.
Your DA800 board can interrupt the processor when one of the six interrupt sources is enabled. By using theseinterrupts, you can write software that effectively deals with real world events.
- Interrupt Request Lines
To allow different peripheral devices to generate interrupts on the same computer, the PC bus has eight differentinterrupt request (IRQ) lines. A transition from low to high on one of these lines generates an interrupt requestwhich is handled by the PC’s interrupt controller. The interrupt controller checks to see if interrupts are to beacknowledged from that IRQ and, if another interrupt is already in progress, it decides if the new request shouldsupersede the one in progress or if it has to wait until the one in progress is done. This prioritizing allows aninterrupt to be interrupted if the second request has a higher priority. The priority level is based on the number of the
4-14
IRQ; IRQ0 has the highest priority, IRQ1 is second-highest, and so on through IRQ7, which has the lowest. Many ofthe IRQs are used by the standard system resources. IRQ0 is used by the system timer, IRQ1 is used by the key-board, IRQ3 by COM2, IRQ4 by COM1, and IRQ6 by the disk drives. Therefore, it is important for you to knowwhich IRQ lines are available in your system for use by the DA800 board.
- 8259 Programmable Interrupt Controller
The chip responsible for handling interrupt requests in the PC is the 8259 Programmable Interrupt Controller.To use interrupts, you will need to know how to read and set the 8259’s interrupt mask register (IMR) and how tosend the end-of-interrupt (EOI) command to the 8259.
- Interrupt Mask Register (IMR)
Each bit in the interrupt mask register (IMR) contains the mask status of an IRQ line; bit 0 is for IRQ0, bit 1 isfor IRQ1, and so on. If a bit is set (equal to 1), then the corresponding IRQ is masked and it will not generate aninterrupt. If a bit is clear (equal to 0), then the corresponding IRQ is unmasked and can generate interrupts. TheIMR is programmed through port 21H.
- End-of-Interrupt (EOI) Command
After an interrupt service routine is complete, the 8259 interrupt controller must be notified. This is done bywriting the value 20H to I/O port 20H.
- What Exactly Happens When an Interrupt Occurs?
Understanding the sequence of events when an interrupt is triggered is necessary to properly write softwareinterrupt handlers. When an interrupt request line is driven high by a peripheral device (such as the DA800), theinterrupt controller checks to see if interrupts are enabled for that IRQ, and then checks to see if other interrupts areactive or requested and determines which interrupt has priority. The interrupt controller then interrupts the proces-sor. The current code segment (CS), instruction pointer (IP), and flags are pushed on the stack for storage, and a newCS and IP are loaded from a table that exists in the lowest 1024 bytes of memory. This table is referred to as theinterrupt vector table and each entry is called an interrupt vector. Once the new CS and IP are loaded from theinterrupt vector table, the processor begins executing the code located at CS:IP. When the interrupt routine iscompleted, the CS, IP, and flags that were pushed on the stack when the interrupt occurred are now popped from thestack and execution resumes from the point where it was interrupted.
- Using Interrupts in Your Programs
Adding interrupts to your software is not as difficult as it may seem, and what they add in terms of performanceis often worth the effort. Note, however, that although it is not that hard to use interrupts, the smallest mistake willoften lead to a system hang that requires a reboot. This can be both frustrating and time-consuming. But, after a fewtries, you’ll get the bugs worked out and enjoy the benefits of properly executed interrupts.
- Writing an Interrupt Service Routine (ISR)
The first step in adding interrupts to your software is to write the interrupt service routine (ISR). This is theroutine that will automatically be executed each time an interrupt request occurs on the specified IRQ. An ISR isdifferent than standard routines that you write. First, on entrance, the processor registers should be pushed onto thestack BEFORE you do anything else. Second, just before exiting your ISR, you must clear the interrupt status of theDA800 and write an end-of-interrupt command to the 8259 controller. Finally, when exiting the ISR, in addition topopping all the registers you pushed on entrance, you must use the IRET instruction and not a plain RET. The IRETautomatically pops the flags, CS, and IP that were pushed when the interrupt was called.
For all bits:0 = IRQ unmasked (enabled)1 = IRQ masked (disabled)
I/O Port 21H,54� ,54� ,54� ,54� ,54� ,54� ,54� ,54�
4-15
If you find yourself intimidated by interrupt programming, take heart. Most Pascal and C compilers allow youto identify a procedure (function) as an interrupt type and will automatically add these instructions to your ISR, withone important exception: most compilers do not automatically add the end-of-interrupt command to the procedure;you must do this yourself. Other than this and the few exceptions discussed below, you can write your ISR just likeany other routine. It can call other functions and procedures in your program and it can access global data. If you arewriting your first ISR, we recommend that you stick to the basics; just something that will convince you that itworks, such as incrementing a global variable.
NOTE: If you are writing an ISR using assembly language, you are responsible for pushing and poppingregisters and using IRET instead of RET.
There are a few cautions you must consider when writing your ISR. The most important is, do not use anyDOS functions or routines that call DOS functions from within an ISR. DOS is not reentrant; that is, a DOSfunction cannot call itself. In typical programming, this will not happen because of the way DOS is written. Butwhat about when using interrupts? Then, you could have a situation such as this in your program. If DOS function Xis being executed when an interrupt occurs and the interrupt routine makes a call to DOS function X, then functionX is essentially being called while it is already active. Such a reentrancy attempt spells disaster because DOSfunctions are not written to support it. This is a complex concept and you do not need to understand it. Just makesure that you do not call any DOS functions from within your ISR. The one wrinkle is that, unfortunately, it is notobvious which library routines included with your compiler use DOS functions. A rule of thumb is that routineswhich write to the screen, or check the status of or read the keyboard, and any disk I/O routines use DOS and shouldbe avoided in your ISR.
The same problem of reentrancy exists for many floating point emulators as well, meaning you may have toavoid floating point (real) math in your ISR.
Note that the problem of reentrancy exists, no matter what programming language you are using. Even if youare writing your ISR in assembly language, DOS and many floating point emulators are not reentrant. Of course,there are ways around this problem, such as those which involve checking to see if any DOS functions are currentlyactive when your ISR is called, but such solutions are well beyond the scope of this discussion.
The second major concern when writing your ISR is to make it as short as possible in terms of execution time.Spending long periods of time in your ISR may mean that other important interrupts are being ignored. Also, if youspend too long in your ISR, it may be called again before you have completed handling the first run. This often leadsto a hang that requires a reboot.
Your ISR should have this structure:
• Push any processor registers used in your ISR. Most C and Pascal interrupt routines automatically do this foryou.
• Put the body of your routine here.
• Clear the interrupt bit on the DA800 by writing any value to BA + 15.
• Issue the EOI command to the 8259 interrupt controller by writing 20H to port 20H.
• Pop all registers pushed on entrance. Most C and Pascal interrupt routines automatically do this for you.
The following C and Pascal examples show what the shell of your ISR should be like:
In C:
void interrupt ISR(void){
/* Your code goes here. Do not use any DOS functions! */outportb(BaseAddress + 15, 0); /* Clear DA800 interrupt */outportb(0x20, 0x20); /* Send EOI command to 8259 */
}
4-16
In Pascal:
Procedure ISR; Interrupt;begin
{ Your code goes here. Do not use any DOS functions! }Port[BaseAddress + 15] := 0; { Clear DA800 interrupt }Port[$20] := $20; { Send EOI command to 8259 }
end;
- Saving the Startup Interrupt Mask Register (IMR) and Interrupt Vector
The next step after writing the ISR is to save the startup state of the interrupt mask register and the interruptvector that you will be using. The IMR is located at I/O port 21H. The interrupt vector you will be using is locatedin the interrupt vector table which is simply an array of 256-bit (4-byte) pointers and is located in the first 1024bytes of memory (Segment = 0, Offset = 0). You can read this value directly, but it is a better practice to use DOSfunction 35H (get interrupt vector). Most C and Pascal compilers provide a library routine for reading the value of avector. The vectors for the hardware interrupts are vectors 8 through 15, where IRQ0 uses vector 8, IRQ1 usesvector 9, and so on. Thus, if the DA800 will be using IRQ3, you should save the value of interrupt vector 11.
Before you install your ISR, temporarily mask out the IRQ you will be using. This prevents the IRQ fromrequesting an interrupt while you are installing and initializing your ISR. To mask the IRQ, read in the current IMRat I/O port 21H and set the bit that corresponds to your IRQ (remember, setting a bit disables interrupts on that IRQwhile clearing a bit enables them). The IMR is arranged so that bit 0 is for IRQ0, bit 1 is for IRQ1, and so on. Seethe paragraph entitled Interrupt Mask Register (IMR) earlier in this chapter for help in determining your IRQ’s bit.After setting the bit, write the new value to I/O port 21H.
With the startup IMR saved and the interrupts on your IRQ temporarily disabled, you can assign the interruptvector to point to your ISR. Again, you can overwrite the appropriate entry in the vector table with a direct memorywrite, but this is a bad practice. Instead, use either DOS function 25H (set interrupt vector) or, if your compilerprovides it, the library routine for setting an interrupt vector. Remember that vector 8 is for IRQ0, vector 9 is forIRQ1, and so on.
If you need to program the source of your interrupts, do that next. For example, if you are using the program-mable interval timer to generate interrupts, you must program it to run in the proper mode and at the proper rate.
Finally, clear the bit in the IMR for the IRQ you are using. This enables interrupts on the IRQ.
– Restoring the Startup IMR and Interrupt Vector
Before exiting your program, you must restore the interrupt mask register and interrupt vectors to the state theywere in when your program started. To restore the IMR, write the value that was saved when your program startedto I/O port 21H. Restore the interrupt vector that was saved at startup with either DOS function 35H (get interruptvector), or use the library routine supplied with your compiler. Performing these two steps will guarantee that theinterrupt status of your computer is the same after running your program as it was before your program startedrunning.
- Common Interrupt Mistakes
• Remember that hardware interrupts are numbered 8 through 15, even though the corresponding IRQs arenumbered 0 through 7.
• Two of the most common mistakes when writing an ISR are forgetting to clear the interrupt status of theDA800 and forgetting to issue the EOI command to the 8259 interrupt controller before exiting the ISR.
4-17
Example Programs
Included with the DA800 is a set of example programs that demonstrate the use of many of the board’s features.These examples are in written in C, Pascal, and BASIC. Also included is an easy-to-use menu-driven diagnosticsprogram, 800DIAG, which is especially helpful when you are first checking out your board after installation.
Before using the software included with your board, make a backup copy of the disk. You may make as manybackups as you need.
C and Pascal Programs
These programs are source code files so that you can easily develop your own custom software for your DA800board.
DAC Simple program that shows how to program the D/A converters.TIMER A short program demonstrating how to use the 8254 timer/counter.DIGITAL Simple program that shows how to read and write the digital I/O lines.
BASIC Programs
These programs are source code files so that you can easily develop your own custom software for your DA800board.
DAC Simple program that shows how to program the D/A converters.TIMER A short program demonstrating how to use the 8254 timer/counter.DIGITAL Simple program that shows how to read and write the digital I/O lines.
4-18
5-1
CHAPTER 5
CALIBRATION
This chapter tells you how to calibrate the DA800 using the800DIAG calibration program included in the example softwarepackage and eight trimpots on the board. These trimpots calibratethe D/A X2 multiplier output and 4-20 mA current loop output.
5-2
5-3
Fig. 5-1 — Board Layout
This chapter tells you how to calibrate the D/A converter X2 voltage multiplier and the 4-20 mA current loop.The X1 range does not have to be calibrated. All D/A ranges are factory-calibrated before shipping. Any time yoususpect inaccurate readings, you can check the accuracy of your conversions using the procedure below, and makeadjustments as necessary. Using the 800DIAG diagnostics program is a convenient way to monitor conversionswhile you calibrate the board.
Calibration is done with the board installed in your system. You can access the trimpots along the top edge ofthe board. Power up the system and let the board circuitry stabilize for 15 minutes before you start calibrating.
Required Equipment
The following equipment is required for calibration:
• Digital Multimeter: 5-1/2 digits• Small Screwdriver (for trimpot adjustment)
While not required, the 800DIAG diagnostics program (included with example software) is helpful whenperforming calibrations. Figure 5-1 shows the board layout with the eight trimpots located along the top edge of theboard (TR5 through TR8 and TR1 through TR4, left to right).
82C54
82C55
Made in U
SA
DA800
5V 5V X1
X2
VE
N
IEN
VO
UT
IOU
T
+ --+ IOU
T
VO
UT
IEN
VE
N
X2
X15V5V
AO
UT
4A
OU
T3
AO
UT
2A
OU
T1
IRQ2 3 4 5 6 7 G
OT
0
OT
1
OT
2
EX
T
PC
3
PC
0
AD694 AD694
AD694AD694
74HC
T08
PAL
74LS244
PAL
74HCT245
74HC
T245
74LS125
74HCT688
74HCT243
AD7237
AD712
74HCT138
74HCT367
++
74HCT243
74HCT245
SWITCH
SWITCH
AD7237
AD712
Real Time Devices, Inc. State College, PA 16804
XTAL
+
SWITCH
+C20
C43
C22
C8U8S3
C1
U1
C13U13
S2
C10
U10
RN5V G PC
H
PA
V G
RN3PB
VGPBC11
U11
P6
RN4
U9
C9
C4
U4
U3
C3
R1
V
G
PC
L
P3
U2
U14
C14
C2
C21
U12
U6
P5
RN2
P4RN15
U15
C6
U5
C5C19
U19C7
Y1
RN1
S1 BASE ADDRESS TR1 TR2 TR3 TR4TR5 TR6 TR7 TR8
P2
C30 C29 C24
C39
C37
C36
C41
C35
C42
C34
C31
C32
C33
C38
C40
C28C27C16 C17C26 C15C23 C25
P7
P8
RN8C18RN7
RN
10
P9
P10
RN9
U17U19
U16
U20
U23
U18
U21
U22PA
PCH
PCL
CLK
2C
LK1
CLK
0
OSC
OSC
OSC
EC0
EC2
EC1
OT1
OT0
R
,, ,,Accessing the Analog World
D/A Calibration
X2 Voltage Multiplier
The D/A converter requires no calibration for the X1 ranges (0 to +5 and ±5 volts). The following paragraphdescribes the calibration procedure for the X2 multiplier ranges.
To calibrate for X2 (0 to +10 or ±10 volts), set the DAC output voltage range to 0 to +10 volts (jumpers on 5V,X2, VEN and VO on the corresponding header connector which configures the DAC output for the channel you arecalibrating). Then, program the D/A converter of the channel you are calibrating with the digital value 2048. Theideal DAC output for 2048 at X2 (0 to +10 volt range) is 5.0000 volts. Adjust the appropriate trimpot as listed inTable 5-1 until an output of 5.0000 volts is obtained. Repeat this procedure for all channels. Table 5-2 lists the idealoutput voltages for all bit weights in the unipolar ranges, and Table 5-3 lists the ideal output voltages for the bipolarranges.
5-4
Table 5-1: X2 Voltage Adjustment
Channel 1 TR1
Channel 2 TR2
Channel 3 TR3
Channel 4 TR4
Table 5-2: D/A Converter Unipolar Calibration Table
D/A Bit Weight
Ideal Output Voltage (in millivolts)
0 to +5 V 0 to +10 V
4095 (Max. Output) 4998.8 9997.6
2048 2500.0 5000.0
1024 1250.0 2500.0
512 625.00 1250.0
256 312.50 625.00
128 156.250 312.50
64 78.125 156.250
32 39.063 78.125
16 19.5313 39.063
8 9.7656 19.5313
4 4.8828 9.7656
2 2.4414 4.8828
1 1.2207 2.4414
0 0.0000 0.0000
5-5
Fig. 5-2 — 4-20 mA Current Loop Calibration Connections
Table 5-3: D/A Converter Bipolar Calibration Table
D/A Bit Weight
Ideal Output Voltage (in millivolts)
±5 V ±10 V
4095 (Max. Output) +4997.6 +9995.1
2048 0.0 0.0
1024 -2500.0 -5000.0
512 -3750.0 -7500.0
256 -4375.0 -8750.0
128 -4687.5 -9375.0
64 -4843.8 -9687.5
32 -4921.9 -9843.8
16 -4960.9 -9921.9
8 -4980.5 -9960.9
4 -4990.2 -9980.5
2 -4995.1 -9990.2
1 -4997.6 -9995.1
0 -5000.0 -10000.0
4-20 mA Current Loop
To calibrate the 4-20 mA current loop, first set up the output of the channel you are calibrating as shown inFigure 5-2. Then, program the D/A converter of the channel you are calibrating with the digital value 2048. Theideal DAC current loop output for 2048 is 12 mA. Adjust the appropriate trimpot as listed in Table 5-4 until anoutput of 12 mA is obtained. Repeat this procedure for all channels. Table 5-5 list the ideal output currents for all bitweights.
mA
250 ohms
+ -AOUT
GND
Output to DAC = 2048
Adjust Potentiometer = 12 mA
5-6
Table 5-4: 4-20 mA Adjustment
Channel 1 TR5
Channel 2 TR6
Channel 3 TR7
Channel 4 TR8
Table 5-5: D/A Converter 4-20 mACurrent Loop Calibration Table
D/A Bit WeightIdeal Output Current
(in millamperes)
4095 (Max. Output) 19.9961
2048 12.0000
1024 8.0000
512 6.0000
256 5.0000
128 4.5000
64 4.2500
32 4.1250
16 4.0625
8 4.0313
4 4.0156
2 4.0078
1 4.0039
0 4.0000
A-1
APPENDIX A
DA800 SPECIFICATIONS
A-2
A-3
DA800 Characteristics Typical @ 25° C
InterfaceSwitch-selectable base address, I/O mappedJumper-selectable interrupts
D/A Converter ......................................................................................... AD7237Analog outputs ............................................................................................. 4 channelsResolution ........................................................................................................... 12 bitsOutput ranges ............................................ 0 to +5, ±5, 0 to +10, or ±10 volts, 4-20 mA4-20 mA ......................................................................................................... transmitterRelative accuracy ...................................................................................... ±1 LSB, maxFull-scale accuracy .................................................................................... ±5 LSB, maxNon-linearity .............................................................................................. ±1 LSB, maxSettling time .................................................................................................. 5 µsec, typ
Digital I/O ........................................................................................ CMOS 82C55Number of lines ..........................................................................................................24Logic compatibility ....................................................................................... TTL/CMOS
(Configurable with optional I/O pull-up/pull-down resistors)Operating modes ..........................................................................................................3High-level output voltage ................................................................................ 4.2V, minLow-level output voltage .............................................................................. 0.45V, maxHigh-level input voltage ................................................................ 2.2V, min; 5.5V, maxLow-level input voltage ................................................................ -0.3V, min; 0.8V, maxHigh-level output current, Isource ..................................... CMOS buffer: -12 mA, max;
TTL buffer: -16 mA, maxLow-level output current, Isink ............................................ CMOS buffer: 24 mA, max;
TTL buffer: 64 mA, maxInput load current ............................................................................................... ±10 µAInput capacitance ................................................................................................. 10 pFInput capacitance, C(IN)@F=1MHz ................................................................................................. 10 pFOutput capacitance, C(OUT)<@F=1MHz .......................................................................................... 20 pF
Timer/Counters .............................................................................. CMOS 82C54Three 16-bit down counters6 programmable operating modesCounter input source .................................................... External clock (8 MHz, max) or
on-board 8 MHz clockCounter outputs .......................................... Available externally; used as PC interruptsCounter gate source ................................................... External gate or always enabled
Current Requirements125 mA @ +5V; 50 mA @ +12V; 15 mA @ –12V
ConnectorsP2 — 50-pin right angle shrouded box headerP6 — 20-pin box header
Size 3.875"H x 5.25"W (99mm x 133mm)
A-4
B-1
APPENDIX B
I/O CONNECTOR PIN ASSIGNMENTS
B-2
B-3
I/O Connector P2:
On-board Connector P6:
39 40
37 38
35 36
33 34
31 32
29 30
27 28
25 26
23 24
21 22
19 20
17 18
15 16
13 14
11 12
9 10
7 8
5 6
3 4
1 2
49 50
47 48
45 46
43 44
41 42
AOUT1
AOUT2
AOUT3
AOUT4
ANALOG GND
ANALOG GND
ANALOG GND
ANALOG GND
EXT INT
EXT GATE 0
DIGITAL GND
PA7
PA6
PA5
PA4
PA3
PA2
PA1
PA0
EXT CLK 0
EXT GATE 1
EXT CLK 1
EXT CLK 2
+12 VOLTS
-12 VOLTS
ANALOG GND
ANALOG GND
ANALOG GND
ANALOG GND
ANALOG GND
ANALOG GND
ANALOG GND
ANALOG GND
DIGITAL GND
DIGITAL GND
DIGITAL GND
PC7
PC6
PC5
PC4
PC3
PC2
PC1
PC0
T/C OUT 0
T/C OUT 1
T/C OUT 2
EXT GATE 2
+5 VOLTS
DIGITAL GND
19 20
17 18
15 16
13 14
11 12
9 10
7 8
5 6
3 4
1 2PB0
PB1
PB2
PB3
PB4
PB5
PB6
PB7
+12 VOLTS
-12 VOLTS
PC0
PC1
PC2
PC3
PC4
PC5
PC6
PC7
+5 VOLTS
DIGITAL GND
B-4
APPENDIX C
COMPONENT DATA SHEETS
C-1
Intel 82C55A Programmable Peripheral InterfaceData Sheet Reprint
Intel 82C54 Programmable Interval TimerData Sheet Reprint
D-1
APPENDIX D
WARRANTY
D-2
D-3
LIMITED WARRANTY
Real Time Devices, Inc. warrants the hardware and software products it manufactures and produces to be freefrom defects in materials and workmanship for one year following the date of shipment from REAL TIME DE-VICES. This warranty is limited to the original purchaser of product and is not transferable.
During the one year warranty period, REAL TIME DEVICES will repair or replace, at its option, any defectiveproducts or parts at no additional charge, provided that the product is returned, shipping prepaid, to REAL TIMEDEVICES. All replaced parts and products become the property of REAL TIME DEVICES. Before returning anyproduct for repair, customers are required to contact the factory for an RMA number.
THIS LIMITED WARRANTY DOES NOT EXTEND TO ANY PRODUCTS WHICH HAVE BEEN DAM-AGED AS A RESULT OF ACCIDENT, MISUSE, ABUSE (such as: use of incorrect input voltages, improper orinsufficient ventilation, failure to follow the operating instructions that are provided by REAL TIME DEVICES,“acts of God” or other contingencies beyond the control of REAL TIME DEVICES), OR AS A RESULT OFSERVICE OR MODIFICATION BY ANYONE OTHER THAN REAL TIME DEVICES. EXCEPT AS EX-PRESSLY SET FORTH ABOVE, NO OTHER WARRANTIES ARE EXPRESSED OR IMPLIED, INCLUDING,BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR APARTICULAR PURPOSE, AND REAL TIME DEVICES EXPRESSLY DISCLAIMS ALL WARRANTIES NOTSTATED HEREIN. ALL IMPLIED WARRANTIES, INCLUDING IMPLIED WARRANTIES FORMECHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE LIMITED TO THE DURATIONOF THIS WARRANTY. IN THE EVENT THE PRODUCT IS NOT FREE FROM DEFECTS AS WARRANTEDABOVE, THE PURCHASER’S SOLE REMEDY SHALL BE REPAIR OR REPLACEMENT AS PROVIDEDABOVE. UNDER NO CIRCUMSTANCES WILL REAL TIME DEVICES BE LIABLE TO THE PURCHASEROR ANY USER FOR ANY DAMAGES, INCLUDING ANY INCIDENTAL OR CONSEQUENTIAL DAM-AGES, EXPENSES, LOST PROFITS, LOST SAVINGS, OR OTHER DAMAGES ARISING OUT OF THE USEOR INABILITY TO USE THE PRODUCT.
SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSE-QUENTIAL DAMAGES FOR CONSUMER PRODUCTS, AND SOME STATES DO NOT ALLOW LIMITA-TIONS ON HOW LONG AN IMPLIED WARRANTY LASTS, SO THE ABOVE LIMITATIONS OR EXCLU-SIONS MAY NOT APPLY TO YOU.
THIS WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS, AND YOU MAY ALSO HAVE OTHERRIGHTS WHICH VARY FROM STATE TO STATE.
D-4
DA800 Board User-Selected Settings
Base I/O Address:
(hex) (decimal)
Interrupts:
OT0 IRQ Channel:
OT1 IRQ Channel:
OT2 IRQ Channel:
EXT IRQ Channel:
PC3 IRQ Channel:
PC0 IRQ Channel: