COM-2(PC)F
RS-232C (2ch) Serial I/O Board
User’s Guide
Product Configuration
- COM-2(PC)F Board…1
- Sample Program Diskette (3.5inch/1.44MB)…1
- User's Guide (This Booklet)…1
Unpacking:
This board is specially packed in an anti-static bag to prevent
damage in shipping.
Check the contents to make sure that you have everything listed
above. If you do not have all the items, contact your distributor
or CONTEC group office where you purchased.
Note!
Do not remove the board from its protective packaging until the
computer case is open and ready for installation. Electrical static
can cause damage to electrical components.
ii
COM-2(PC)F
Table of Contents
Copyright............................................................................i
Trademarks ........................................................................i
Product Configuration ..................................................... ii
1. Introduction ............................................................. 1
About the COM-2(PC)F Board.....................................1
Support Software of Option..........................................1
Features.........................................................................1
Limited Three-Year Warranty......................................2
How to Obtain Service..................................................2
Liability .........................................................................2
About the Manual.........................................................3
2. How to Use the Board ............................................... 5
Compatible Mode and Enhanced Mode ...........................5
Compatible Mode ..........................................................5
Enhanced Mode.............................................................5
Operating under Windows Me/98.....................................6
Procedure.......................................................................6
Operating under Windows 95.........................................10
Procedure.....................................................................10
Operating under Windows 2000.....................................14
Procedure.....................................................................14
Operating under Windows NT .......................................18
Procedure.....................................................................18
Operating under Windows 3.1........................................19
Procedure.....................................................................19
Operating under MS-DOS..............................................20
Procedure.....................................................................20
3. Hardware Setup ..................................................... 23
Names of Board Components .........................................23
I/O Address Setting.........................................................24
Setting Procedure .......................................................25
Interrupt Level Setting...................................................26
Setting Procedure .......................................................26
COM-2(PC)F
iii
Mounting Method............................................................28
Connecting the External Devices...................................31
Connecting the Cable......................................................32
4. System Reference.................................................... 33
Specifications...................................................................33
Circuitry Diagrams.........................................................34
Block Diagram.................................................................34
5. Troubleshooting ...................................................... 35
QUESTIONS: ..................................................................35
Is the pilot light on?....................................................35
Did the system boot up? .............................................35
Does your program work?...........................................35
Does the sample program work?................................36
Is the input data accurate?.........................................36
Still have a probrem?..................................................36
6. Appendix ................................................................ 39
A. Sample Programs (for MS-DOS)................................39
COM-2(PC)F Diskette ................................................39
Sample Programs........................................................40
Switch and Jumper Settings......................................42
Cable Connection........................................................44
B. Notes on Developing Driver Software.......................56
Internal Registers.......................................................56
Baud Rate Selection....................................................57
LSI Recovery Time......................................................58
Various Aspects of Interrupt Handling in Enhanced
Mode and Compatible Mode.......................................60
C. The Details on NS16550 ............................................62
D. Difference Between the COM-2(PC)F
and COM-2(PC)V.......................................................64
7. Index ..................................................................... 65
iv
COM-2(PC)F
List of Figures
Figure 3.1. Names of Board Components and Default Factory
Settings ..................................................................... 23
Figure 3.2. I/O Address DIP Switch............................................ 25
Figure 3.3. Interrupt Level Settings............................................. 26
Figure 3.4. Rear Panel of IBM-PC/AT......................................... 28
Figure 3.5. Removing the Cover.................................................. 28
Figure 3.6. Expansion Slot Cover................................................ 29
Figure 3.7. Anchoring the COM-2(PC)F..................................... 30
Figure 3.8. Interface Connectors (CN1 and CN2)........................ 31
Figure 3.9. CN1 and CN2 Pin Assignments ................................ 31
Figure 3.10.Example Connection to a Modem ............................. 32
Figure 3.11.Example Connection to a PC..................................... 32
Figure 3.12.Example Connection to a Device............................... 32
Figure 4.1. Circuitry Diagrams.................................................... 34
Figure 4.2. COM-2(PC)F Block Diagram.................................... 34
Figure 6.1. Floppy Disk Files...................................................... 40
Figure 6.2. 9-pin Connector Diagram.......................................... 44
Figure 6.3. Flowchart of Sample Program 1................................ 45
Figure 6.4. Flowchart of Sample Program 2................................ 46
Figure 6.5. Flowchart of Sample Program 3................................ 47
Figure 6.6. Flowchart of Sample Program 4................................ 48
Figure 6.7. Flowchart of Sample Program 5................................ 49
Figure 6.8. Flowchart of Sample Program 6................................ 50
Figure 6.9. Flowchart of Sample Program 7................................ 51
Figure 6.10.Flowchart of Sample Program 8................................ 52
COM-2(PC)F
v
Figure 6.11.Flowchart of Sample Program 9................................ 53
Figure 6.12.Flowchart of Sample Program10............................... 54
Figure 6.13.Flowchart of Sample Program 11 .............................. 55
Figure 6.14. IVR Bit Function in Enhanced Mode........................ 61
Figure 6.15.Difference in Jumpers (JP1~JP3)............................... 64
vi
COM-2(PC)F
List of Tables
Table 2.1. COM Port Support for Various Programming
Languages................................................................. 21
Table 3.1. I/O Address Settings ................................................. 25
Table 3.2. Example Compatible Mode Settings ......................... 27
Table 4.1. Specifications............................................................ 33
Table 6.1. Data Format .............................................................. 40
Table 6.2. Switch and Jumper Settings of Sample Program 1, 2,
and 5......................................................................... 42
Table 6.3. Switch and Jumper Settings of Sample Program 3, 4, 6,
and 10....................................................................... 42
Table 6.4. Switch and Jumper Settings of Sample Program 7 .... 43
Table 6.5. Switch and Jumper Settings of Sample Program 11... 43
Table 6.6. Function Selection through Internal Registers........... 56
Table 6.7. Baud Rate and Divisors............................................. 57
Table 6.8. Number of Times the IN Instruction Must be Executed
for the 2EFh Port after Accessing the LSI................. 58
Table 6.9. NS16550's Register (Short from National
Semiconductor's data book) < 1 / 2 > .................... 62
Table 6.9. NS16550's Register (Short from National
Semiconductor's data book) < 2 / 2 > .................... 63
Table 6.10. Specifications Differences....................................... 64
COM-2(PC)F
vii
viii
COM-2(PC)F
Introduction
1. Introduction
About the COM-2(PC)F Board
The COM-2(PC)F is an IBM PC/AT ISA-Bus add-on interface
board for multi-channel RS-232C asynchronous communications.
It features two serial communication ports and a programmable
communication rate ranging from 50 to 115,200 bps for
communication or modem control.
Support Software of Option
- For Windows
- For Windows 3.1
- For MS-DOS
API-PAC(W32)
API-SIO(PC)WIN
SUPPORT-PAC(PC)103
Features
- 2-channel asynchronous communication
- Supports RS-232C protocol
- Programmable communication rate from 50 to 115,200 bits per
second
- Two operational modes : Enhanced and Compatible
(COM1, COM2, COM3, and COM4)
For more information, see System Reference.
COM-2(PC)F
1
Introduction
Limited Three-Year Warranty
CONTEC Interface boards are warranted by CONTEC Co., LTD to
be free from defects in material and workmanship for up to three
years from the date of purchase by the original purchaser.
Repair will be free of charge only when this device is returned
freight prepaid with a copy of the original invoice and a Return
Merchandise Authorization to the distributor or the CONTEC group
office, from which it was purchased.
This warranty is not applicable for scratches or normal wear, but
only for the electronic circuitry and original boards. The warranty
is not applicable if the device has been tampered with or damaged
through abuse, mistreatment, neglect, or unreasonable use, or if the
original invoice is not included, in which case repairs will be
considered beyond the warranty policy.
How to Obtain Service
For replacement or repair, return the device freight prepaid, with a
copy of the original invoice. Please obtain a Return Merchandise
Authorization Number (RMA) from the CONTEC group office
where you purchased before returning any product.
*No product will be accepted by CONTEC group without the
RMA number.
Liability
The obligation of the warrantor is solely to repair or replace the product.
In no event will the warrantor be liable for any incidental or
consequential damages due to such defect or consequences that arise
from inexperienced usage, misuse, or malfunction of this device.
2
COM-2(PC)F
Introduction
About the Manual
This manual consists of the following chapters :
Chapter 1 Introduction
Chapter 2 How to Use the Board
Chapter 3 Hardware Setup
Chapter 4 I/O Ports and Registers
Chapter 5 System Reference
Chapter 6 Troubleshooting
Chapter 7 Index
COM-2(PC)F
3
Introduction
4
COM-2(PC)F
How to Use the Board
2. How to Use the Board
Compatible Mode and Enhanced Mode
The COM-2(PC)F supports Compatible mode and Enhanced mode.
In Compatible mode, the board channels operate as standard PC
serial ports. In Enhanced mode, the board operates under
CONTEC's proprietary control procedures. Give full
consideration to the features of each mode when selecting which
mode to use in your system.
Compatible Mode
The two channels of the COM-2(PC)F can be used as standard PC
serial ports. Channel CN1 of the COM-2(PC)F can be assigned as
COM1 or COM3, and channel CN2 can be assigned as COM2 or
COM4.
In Compatible mode, each channel uses one interrupt level.
Therefore, your PC must have at least two interrupt levels available.
The COM-2(PC)F uses the I/O addresses assigned to the standard
serial ports.
As the COM-2(PC)F channels operate as standard serial ports, the
board can be accessed using either the CONTEC driver software
(purchased separately) or some other driver software that supports
standard serial ports.
Enhanced Mode
The COM-2(PC)F operates under CONTEC's proprietary control
procedures.
In Enhanced mode, a single interrupt level is used to control both
channels. Therefore, the board can be used even if your PC has
only one free interrupt level available. The I/O address used is
specified by CONTEC.
As the board operates under CONTEC's proprietary control
procedures, you must use the CONTEC driver software (purchased
separately) or develop your own driver software. Programming
for Enhanced mode is different to programming for Compatible
mode.
COM-2(PC)F
5
How to Use the Board
Operating under Windows Me/98
This section describes the procedure for using the board under
Windows Me/98 and lists a number of points to note.
Procedure
When using the board under Windows Me/98, the OS must be set to
recognize the I/O address and interrupt level used by the
COM-2(PC)F. In Windows Me/98, this is called hardware
installation. Use the following installation procedure.
Check the Current Settings
First, check the current settings. Check which interrupt levels are
available. If using in Compatible mode, also check which COM
ports (COM1 to COM4) are already set. The COM-2(PC)F cannot
be assigned to a COM port that is already set. The procedure for
checking is as follows.
- Check the interrupt level
1. Select [System] from [Control Panel] and open [Device
Manager].
2. Select the [Computer] folder and click [Properties].
3. Display the [Interrupt request(IRQ)] list and check which
interrupt levels are available.
- Check the ports
1. Select [System] from [Control Panel] and open [Device
Manager].
2. Double click on the [Ports (COM & LPT)], [Infrared], [Modem]
folder and check which ports are already set.
6
COM-2(PC)F
How to Use the Board
Compatible Mode Installation Procedure 1
1. Set the operation mode (I/O address) and interrupt level for the
COM-2(PC)F. Set the COM-2(PC)F switch and jumpers as
described in Hardware Setup. Set an interrupt level that is not
currently used by the computer.
2. Insert the COM-2(PC)F in an expansion slot and turn on the
power to the PC.
3. After Windows Me/98 starts, select [Control Panel] from
[My Computer] and start the [Add New Hardware].
4. Click [Next >] in response to [To begin installing your new
hardware, click Next] in the Add New Hardware Wizard.
5. Select [Yes (Recommended)] in response to [Do you want
Windows to search for your new hardware ?].
6. After following the instructions and completing detection, use
[Details...] to check that the standard serial ports have been
detected.
7. Next, click [Finish] and restart your computer.
(When Windows Me is used, it doesn’t need to restart.)
8. After rebooting, use the procedure described in the "Check
Resources" section below to check the interrupt level assigned
to the COM-2(PC)F. If the value is different to the level set on
the jumper, correct the setting in the OS.
9. When installing by this method, the COM-2(PC)F channels are
installed as standard serial ports (COM*).
COM-2(PC)F
7
How to Use the Board
Compatible Mode Installation Procedure 2
1. Turn on the power to the PC without inserting the COM-2(PC)F
in an expansion slot.
2. After Windows Me/98 starts, select [Control Panel] from [My
Computer] and start the [Add New Hardware].
3. Click [Next >] in response to [To begin installing your new
hardware, click Next] in the Add New Hardware Wizard.
4. Select [No] in response to [Do you want Windows to search for
your new hardware ?].
5. Select the [Ports (COM & LPT)] folder from the [Hardware
types:] screen.
6. Select [Communication Port] from [Models:] and click on [Have
Disk...] in the screen.
7. When the [Install From Disk] screen appears, place the floppy
disk in the drive, enter the drive name in [Copy manufacturer's
file from:], then click [OK].
8. The next screen displays the board type. Select [CONTEC Co.,
Ltd. - COM-2(PC)F, V, H Compatible] from [Models:].
9. Next, the resource items and settings are displayed. Take a
note of the displayed I/O address and interrupt level.
10. End the operation as instructed. This completes the installation
of one port. When using both ports in Compatible mode,
repeat the procedure from step 2. If the interrupt level used by
a COM-2(PC)F port is already used on the PC, change the
interrupt level to an available level.
11. Turn off the power, then set the operation mode (I/O address)
and interrupt level on the COM-2(PC)F to the values set in steps
9 and 10 above. Set the COM-2(PC)F switch and jumpers as
described in Hardware Setup.
8
COM-2(PC)F
How to Use the Board
Enhanced Mode Installation Procedure
When it is used with Enhanced Mode, API-PAC(W32) of the option
is necessary. Refer to Help "HWINSTE.HLP" of the way of
registering the hardware being attached to API-PAC(W32) for the
way of installing it.
Check Resources
Always check the PC resources (I/O address and interrupt level)
assigned to the COM-2(PC)F before actually using the board. Use
the following procedure to check the resources managed by the OS.
1. Select [System] from [Control Panel] and click [Hardware]
property sheet, then open [Device Manager].
2. For Compatible mode, double click on the [Ports (COM &
LPT)] folder. For Enhanced mode, double click on the
[Multi-function adapters] folder.
3. Double click on the [CONTEC Co., Ltd. - COM-2(PC)F] or
[COM*] folder to display the properties screen.
4. Select [Resources]. Check the resource items and settings, and
look for any conflicts.
5. Disable [Use automatic settings] first if changing the settings.
If changing an I/O address, change the Basic configuration from
the [Setting based on:]. To change an interrupt level, click on
[Change setting...]. After checking the resources, check again
that the interrupt level value on the COM-2(PC)F board match
the settings in the OS.
COM-2(PC)F
9
How to Use the Board
Operating under Windows 95
This section describes the procedure for using the board under
Windows 95 and lists a number of points to note.
Procedure
When using the board under Windows 95, the OS must be set to
recognize the I/O address and interrupt level used by the
COM-2(PC)F. In Windows 95, this is called hardware installation.
Use the following installation procedure.
Check the Current Settings
First, check the current settings. Check which interrupt levels are
available. If using in Compatible mode, also check which COM
ports (COM1 to COM4) are already set. The COM-2(PC)F cannot
be assigned to a COM port that is already set. The procedure for
checking is as follows.
- Check the interrupt level
1. Select [System] from [Control Panel] and open [Device
Manager].
2. Select the [Computer] folder and click [Properties].
3. Display the [Interrupt request(IRQ)] list and check which
interrupt levels are available.
- Check the ports
1. Select [System] from [Control Panel] and open [Device
Manager].
2. Double click on the [Ports (COM & LPT)] folder and check
which ports are already set.
10
COM-2(PC)F
How to Use the Board
Compatible Mode Installation Procedure 1
1. Set the operation mode (I/O address) and interrupt level for the
COM-2(PC)F. Set the COM-2(PC)F switch and jumpers as
described in Hardware Setup. Set an interrupt level that is not
currently used by the computer.
2. Insert the COM-2(PC)F in an expansion slot and turn on the
power to the PC.
3. After Windows 95 starts, select [Control Panel] from
[My Computer] and start the [Add New Hardware].
4. Click [Next >] in response to [To begin installing your new
hardware, click Next] in the Add New Hardware Wizard.
5. Select [Yes (Recommended)] in response to [Do you want
Windows to search for your new hardware ?].
6. After following the instructions and completing detection, use
[Details...] to check that the standard serial ports have been
detected.
7. Next, click [Finish] and restart your computer.
8. After rebooting, use the procedure described in the "Check
Resources" section below to check the interrupt level assigned
to the COM-2(PC)F. If the value is different to the level set on
the jumper, correct the setting in the OS.
9. When installing by this method, the COM-2(PC)F channels are
installed as standard serial ports (COM*).
COM-2(PC)F
11
How to Use the Board
Compatible Mode Installation Procedure 2
1. Turn on the power to the PC without inserting the COM-2(PC)F
in an expansion slot.
2. After Windows 95 starts, select [Control Panel] from [My
Computer] and start the [Add New Hardware].
3. Click [Next >] in response to [To begin installing your new
hardware, click Next] in the Add New Hardware Wizard.
4. Select [No] in response to [Do you want Windows to search for
your new hardware ?].
5. Select the [Ports (COM & LPT)] folder from the [Hardware
types:] screen.
6. Select [Communication Port] from [Models:] and click on [Have
Disk...] in the screen.
7. When the [Install From Disk] screen appears, place the floppy
disk in the drive, enter the drive name in [Copy manufacturer's
file from:], then click [OK].
8. The next screen displays the board type. Select [CONTEC Co.,
Ltd. - COM-2(PC)F, V, H Compatible] from [Models:].
9. Next, the resource items and settings are displayed. Take a
note of the displayed I/O address and interrupt level.
10. End the operation as instructed. This completes the installation
of one port. When using both ports in Compatible mode,
repeat the procedure from step 2. If the interrupt level used by
a COM-2(PC)F port is already used on the PC, change the
interrupt level to an available level.
11. Turn off the power, then set the operation mode (I/O address)
and interrupt level on the COM-2(PC)F to the values set in steps
9 and 10 above. Set the COM-2(PC)F switch and jumpers as
described in Hardware Setup.
12
COM-2(PC)F
How to Use the Board
Enhanced Mode Installation Procedure
When it is used with Enhanced Mode, API-PAC(W32) of the option
is necessary. Refer to Help "HWINSTE.HLP" of the way of
registering the hardware being attached to API-PAC(W32) for the
way of installing it.
Check Resources
Always check the PC resources (I/O address and interrupt level)
assigned to the COM-2(PC)F before actually using the board. Use
the following procedure to check the resources managed by the OS.
1. Select [System] from [Control Panel] and open [Device
Manager].
2. For Compatible mode, double click on the [Ports (COM &
LPT)] folder. For Enhanced mode, double click on the
[Multi-function adapters] folder.
3. Double click on the [CONTEC Co., Ltd. - COM-2(PC)F] or
[COM*] folder to display the properties screen.
4. Select [Resources]. Check the resource items and settings, and
look for any conflicts.
5. Disable [Use automatic settings] first if changing the settings.
If changing an I/O address, change the Basic configuration from
the [Setting based on:]. To change an interrupt level, click on
[Change setting...]. After checking the resources, check again
that the interrupt level value on the COM-2(PC)F board match
the settings in the OS.
COM-2(PC)F
13
How to Use the Board
Operating under Windows 2000
This section describes the procedure for using the board under
Windows 2000 and lists a number of points to note.
Procedure
When using the board under Windows 2000, the OS must be set to
recognize the I/O address and interrupt level used by the
COM-2(PC)F. In Windows 2000, this is called hardware
installation. Use the following installation procedure.
Check the Current Settings
First, check the current settings. Check which interrupt levels are
available. If using in Compatible mode, also check which COM
ports (COM1 to COM4) are already set. The COM-2(PC)F cannot
be assigned to a COM port that is already set. The procedure for
checking is as follows.
- Check the interrupt level
1. Select [System] from [Control Panel] and click [Hardware]
property sheet, then open [Device Manager].
2. Select the [View] and click [Resource by type].
3. Display the [Interrupt request(IRQ)] list and check which
interrupt levels are available.
- Check the ports
1. Select [System] from [Control Panel] and click [Hardware]
property sheet, then open [Device Manager].
2. Double click on the [Ports (COM & LPT)] [Infrared], [Modem]
folder and check which ports are already set.
14
COM-2(PC)F
How to Use the Board
Compatible Mode Installation Procedure 1
It can’t be used with Compatible Mode when API-SIO(98/PC)NT
of packing together is used for API-PAC(W32).
1. Set the operation mode (I/O address) and interrupt level for the
COM-2(PC)F. Set the COM-2(PC)F switch and jumpers as
described in Hardware Setup. Set an interrupt level that is not
currently used by the computer.
2. Insert the COM-2(PC)F in an expansion slot and turn on the
power to the PC.
3. After Windows 2000 starts, select [Control Panel] from
[My Computer] and start the [Add/Remove Hardware].
4. Click [Next >] in response to [Welcome to the Add/Remove
Hardware Wizard] in the Add/Remove Hardware Wizard.
5. Select [Add/Troubleshoot a device] in response to [Choose a
Hardware Task].
6. The next, select [Add a New Device] and click [Next].
7. Select [Yes] in response to [Do you want Windows to search for
your new hardware ?], and click [Next].
8. It confirms that two [Install Communications Port] sentences are
indicated on the [Detected Hardware], and click [Next].
9. After rebooting, use the procedure described in the "Check
Resources" section below to check the interrupt level assigned
to the COM-2(PC)F. If the value is different to the level set on
the jumper, correct the setting in the OS.
10. When installing by this method, the COM-2(PC)F channels are
installed as standard serial ports (COM*).
COM-2(PC)F
15
How to Use the Board
Compatible Mode Installation Procedure 2
It can’t be used with Compatible Mode when API-SIO(98/PC)NT
of packing together is used for API-PAC(W32).
1. Turn on the power to the PC without inserting the COM-2(PC)F
in an expansion slot.
2. After Windows 2000 starts, select [Control Panel] from [My
Computer] and start the [Add/Remove Hardware].
3. Click [Next >] in response to [Welcome to the Add/Remove
Hardware Wizard] in the Add/Remove Hardware Wizard.
4. Select [Add/Troubleshoot a device] in response to [Choose a
Hardware Task].
5. The next, select [Add a New Device] and click [Next].
6. Select [No] in response to [Do you want Windows to search for
your new hardware ?], and click [Next].
7. Select the [Ports (COM & LPT)] folder from the [Hardware
types:] screen.
8. Click [Hard Disk], and the [Install From Disk] screen appears,
place the floppy disk in the drive, enter the drive name in [Copy
manufacturer's file from:], then click [OK].
9. The next screen displays the board type. Select [CONTEC Co.,
Ltd. - COM-2(PC)F, V, H Compatible] from [Models:].
10. Next, the resource items and settings are displayed. Take a
note of the displayed I/O address and interrupt level.
11. End the operation as instructed. This completes the installation
of one port. When using both ports in Compatible mode,
repeat the procedure from step 2. If the interrupt level used by
a COM-2(PC)F port is already used on the PC, change the
interrupt level to an available level.
12. Turn off the power, then set the operation mode (I/O address)
and interrupt level on the COM-2(PC)F to the values set in steps
10 and 11 above. Set the COM-2(PC)F switch and jumpers as
described in Hardware Setup.
16
COM-2(PC)F
How to Use the Board
Enhanced Mode Installation Procedure
When it is used with Enhanced Mode, API-PAC(W32) of the option
is necessary. Refer to Help "HWINSTE.HLP" of the way of
registering the hardware being attached to API-PAC(W32) for the
way of installing it.
Check Resources
Always check the PC resources (I/O address and interrupt level)
assigned to the COM-2(PC)F before actually using the board. Use
the following procedure to check the resources managed by the OS.
1. Select [System] from [Control Panel] and click [Hardware]
property sheet, then open [Device Manager].
2. For Compatible mode, double click on the [Ports (COM &
LPT)] folder. For Enhanced mode, double click on the
[Multi-function adapters] folder.
3. Double click on the [CONTEC Co., Ltd. - COM-2(PC)F] or
[COM*] folder to display the properties screen.
4. Select [Resources]. Check the resource items and settings, and
look for any conflicts.
5. Disable [Use automatic settings] first if changing the settings.
If changing an I/O address, change the Basic configuration from
the [Setting based on:]. To change an interrupt level, click on
[Change setting...]. After checking the resources, check again
that the interrupt level value on the COM-2(PC)F board match
the settings in the OS.
COM-2(PC)F
17
How to Use the Board
Operating under Windows NT
This section describes the procedure for using the board under
Windows NT and lists a number of points to note.
Procedure
First, set the operation mode (I/O address) and interrupt level for
the COM-2(PC)F. Set the COM-2(PC)F switch and jumpers as
described in Hardware Setup.
When using the board in compatible mode, the OS must be set to
recognize the I/O address and interrupt level used by the
COM-2(PC)F. Use the Ports icon in Control Panel to set the I/O
address and interrupt level.
The I/O address and interrupt level used by the COM-2(PC)F do not
need to be set for the OS when using the board in enhanced mode.
18
COM-2(PC)F
How to Use the Board
Operating under Windows 3.1
This section describes the procedure for using the board under
Windows 3.1 and lists a number of points to note.
Procedure
First, set the operation mode (I/O address) and interrupt level for
the COM-2(PC)F. Set the COM-2(PC)F switch and jumpers as
described in Hardware Setup.
When using the board in Compatible mode, the OS must be set to
recognize the I/O address and interrupt level used by the
COM-2(PC)F. Use the Ports icon in Control Panel to set the I/O
address and interrupt level.
The I/O address and interrupt level used by the COM-2(PC)F do not
need to be set for the OS when using the board in Enhanced mode.
COM-2(PC)F
19
How to Use the Board
Operating under MS-DOS
This section describes the procedure for using the board under
MS-DOS and lists a number of points to note.
Procedure
First, set the operation mode (I/O address) and interrupt level for
the COM-2(PC)F. Set the COM-2(PC)F switch and jumpers as
described in Hardware Setup.
When using the board in Compatible mode, the system area of the
PC must be set to recognize the I/O address used by the
COM-2(PC)F. If a system configuration program or the
MODE.COM command is available on the PC, use the program to
set the I/O addresses for the standard serial ports. If neither a
system configuration program nor the MODE.COM command is
available, use the SETCOM.EXE program provided on the floppy
disk to set the I/O addresses for the standard serial ports as shown
below. Set the I/O address to "NONE" for unused serial ports.
C>SETCOM
[COM1 I/O address] [COM2 I/O address]
[COM3 I/O address] [COM4 I/O address]
Example:
C>SETCOM 3F8 2F8 NONE NONE
COM-2(PC) series compatible mode setting software by CONTEC
I/O address data: COM1:[3F8] COM2:[2F8] COM3:[NONE] COM4:[NONE]
C>
The I/O addresses used by the COM-2(PC)F do not need to be set
for the system area of the PC when using the board in Enhanced
mode.
20
COM-2(PC)F
How to Use the Board
Note!
When used in Compatible mode, COM3 and COM4 are not
supported by some programming languages. Check the
specifications of the language you are using. Table 2.1. lists the
COM ports supported by a number of common programming
languages.
Table 2.1. COM Port Support for Various Programming
Languages
Language
Microsoft C
Quick BASIC
GW-BASIC
Turbo Pascal
COM1
COM2
COM3
COM4
O
O
O
O
O
O
O
O
O
×
O
×
×
×
O
O
If writing your own driver software, see "Appendix B : Notes on
Developing Driver Software".
COM-2(PC)F
21
How to Use the Board
22
COM-2(PC)F
Hardware Setup
3. Hardware Setup
Names of Board Components
Figure 3.1. shows the names of various board components.
The switch and jumper settings shown in the figure are the default
factory settings.
Figure 3.1. Names of Board Components and Default
Factory Settings
COM-2(PC)F
23
Hardware Setup
I/O Address Setting
The board is an I/O device controlled by I/O instructions from the
PC. I/O devices include expansion boards and devices inside the
PC. The various devices are identified by their I/O addresses.
I/O addresses are represented as four digit hexadecimal values
(e.g. 02A0H) and act as the ID number for each I/O device.
Most expansion boards are controlled via a range of consecutive I/O
addresses. The address of the first I/O address in the range is
called the base I/O address.
When using Enhanced mode, either 1A0H or 2A0H is selected as
the base I/O address. In Compatible mode, the fixed address for
the PC system is used.
Notes!
1. When using more than one expansion board, set each board so
that their I/O addresses do not overlap.
2. If the PC already has COM1 to COM4 ports, those ports cannot
be set for the board.
24
COM-2(PC)F
Hardware Setup
Setting Procedure
The I/O address is set using a DIP switch (SW1) on the board.
SW1
MODE
1
3
2
4
Figure 3.2. I/O Address DIP Switch
Table 3.1. I/O Address Settings
SW1
Interrupt Vector
Function
I/O Address
Bit 1
ON
Bit 2
ON
Register Address
Enhanced
Enhanced
COM3
1A0~1A7
2A0~2A7
3E8~3EF
3F8~3FF
1BF
2BF
---
C
N
1
OFF
ON
OFF
OFF
COM1
---
SW1
Interrupt Vector
Function
I/O Address
Bit 3
ON
Bit 4
ON
Register Address
Enhanced
Enhanced
COM4
1A8~1AF
2A8~2AF
2E8~2EF
2F8~2FF
1BF
2BF
---
C
N
2
OFF
ON
OFF
OFF
COM2
---
Figure 3.2 shows the CN1 bace I/O address set to 2A0H and the
CN2 bace I/O address set to 2A8H.
COM-2(PC)F
25
Hardware Setup
Interrupt Level Setting
The signal from the LSI (NS16550 equivalent) on the board can be
used as an interrupt request signal based on the JP1, JP2, and JP3
settings.
Note!
When using interrupts, set an interrupt level that is not used by any
other device.
Setting Procedure
When not Using Interrupts
Place a short connector on the NC pin of each jumper (JP1, JP2, and
JP3).
When Using Interrupts
Connect the interrupt level using the short connector on each
jumper (JP1, JP2, and JP3). Available interrupt levels are IRQ3 to
7, 9 to 12, 14, and 15.
JP1
Enhanced
15
15
15
3
3
3
4
4
4
5
5
5
7 10 11
1214
6
6
NC
NC
9
9
JP2
COM CN1
7 10 111214
JP3
COM CN2
7 10 111214
6
NC
9
Figure 3.3. Interrupt Level Settings
If SW1 selects Enhanced mode, the settings in Figure 3.3. specify
that CN1 and CN2 both use IRQ5. If Compatible mode is set, the
settings specify that CN1 uses IRQ4 and CN2 uses IRQ3.
Note!
Jumper of the mode which isn’t used is to connect a short connector
to the NC pin.
26
COM-2(PC)F
Hardware Setup
Table 3.2. lists the I/O address and standard interrupt level settings
for COM1 to COM4 (Compatible mode).
Table 3.2. Example Compatible Mode Settings
Interrupt Level
Port
I/O Address
3F8~3FF
2F8~2FF
3E8~3EF
2E8~2EF
COM1
COM2
COM3
COM4
IRQ4
IRQ3
IRQ4
IRQ3
*1 *1 On the IBM PS/55Z and similar,
COM3 uses IRQ3.
Note!
If using the PC's RS-232C ports as COM 1 and COM 2 at the same
time as using the CONTEC board as COM3 and COM4, COM3 and
COM4 must be set to interrupt levels other than IRQ3 and IRQ4
because COM1 uses IRQ4 and COM2 uses IRQ3.
COM-2(PC)F
27
Hardware Setup
Mounting Method
There are many kinds of boards that can be mounted in a computer's
extension slots, however the mounting method is identical for any
slot.
Before starting
(1) Set the Power switch to OFF.
(2) Unplug the power cable from the AC outlet.
Mounting the board
(1) Remove the screws from the rear of the computer. When
removing screws, use a screwdriver that matches the screw
heads.
Cover mounting screws
Cover mounting screws
Figure 3.4. Rear Panel of IBM-PC/AT
(2) Hold the left and right sides of the front cover and remove it
from the computer's chassis by sliding it to the front.
Figure 3.5. Removing the Cover
28
COM-2(PC)F
Hardware Setup
(3) Remove the screw retaining the cover of the slot where the
board is to be mounted, and remove the cover from the rear
panel.
Figure 3.6. Expansion Slot Cover
Caution!
To prevent a discharge of static electricity from damaging the board,
it is important to ground yourself. Hold the packaged board in
one hand and touch an unpainted, grounded metal surface with the
other hand. Then, hold the non-conductive part of the board and
remove it from the bag. Don't touch the underside side of the
board with the exposed pins and solder. Place the board on a
clean, non-conductive surface.
(4) Remove the board from the anti-static packaging.
(5) Inspect the board. Check the board for any visible damage or
loose parts. If you notice any problems with the board,
contact CONTEC. Don't attempt to fix the board yourself.
CONTEC does not warranty boards damaged or worked-on by
the customers.
(6) Insert the board into the expansion slot and press in firmly.
Make sure the board is fully seated in the support bracket.
COM-2(PC)F
29
Hardware Setup
(7) Anchor the board with the screw. Use the screw set aside in
step 3. Tighten so that the board is held in place.
Figure 3.7. Anchoring the COM-2(PC)F
(8) Replace the computer cover.
(9) Connect the power cord.
30
COM-2(PC)F
Hardware Setup
Connecting the External Devices
Connecting the COM-2(PC)F board to external devices is via two
9-pin D-SUB connector (male) on the board.
5
9
6
9
6
CN1
1
5
CN2
1
On-board Connector : DELC-J9PAF-20L9 (Male)
[mfd. by JAE]
Application Connector : 17JE-13090-02 (D8C) (Female) [mfd. by DDK]
Figure 3.8. Interface Connectors (CN1 and CN2)
(Signal Ground) SG
(Data Terminal Ready) DTR
(Transmit Data) TXD
5
4
3
2
1
9
8
7
6
RI (Ring Indicator)
CTS (Clear to Send)
RTS (Request to Send)
DSR (Data Set Ready)
(Receive Data) RXD
(Data Carrier Detect) DCD
CN1/CN2
Figure 3.9. CN1 and CN2 Pin Assignments
COM-2(PC)F
31
Hardware Setup
Connecting the Cable
The RS-232C interface requires that you use a different type of
cable depending on the type of device being connected. For
example, modem connections and computer (PC) connections
require different cables. Accordingly, check the specifications of
the external device to which you are connecting and select the
appropriate type of cable. The two types of cable are "straight-
through" and "crossed". Also, if the signal lines require
conditioning in the connector, provide conditioning in accordance
with the specifications.
(Transmit Data)
(Receive Data)
TXD
TXD
RXD
RTS
RXD
RTS
(Request to Send)
(Clear to Send)
CTS
DTR
DSR
CTS
DTR
(Data Terminal Ready)
DSR (Data Set Ready)
(Signal Ground)
External Device
SG
SG
Board
Figure 3.10. Example Connection to a Modem
TXD
RXD
TXD
RXD
RTS
CTS
RTS
CTS
DTR
DSR
SG
DTR
DSR
SG
External Device
Board
Figure 3.11. Example Connection to a PC
TXD
TXD
RXD
RTS
RXD
RTS
CTS
DTR
DSR
CTS
DTR
DSR
SG
SG
Board
External Device
Figure 3.12. Example Connection to a Device
32
COM-2(PC)F
System Reference
4. System Reference
Specifications
Table 4.1. Specifications
Item
Specification
Number of Channels
Input Type
2
RS-232C
External connectors
Transfer Method
Baud Rate
Two 9-pin D-SUB connector (Male)
Asychronous serial transfer
50~115,200bps *1
5, 6, 7, 8 bits
Data Length
1, 1.5, 2 stop bits *1
Even, Odd, Non-parity *1
NS16550 or equivalent
15m Max.
Parity heck
Controller Chip
Distance
Enhanced mode : 1 level
Compatible mode : 2 levels
8 bits x 16 ports
Interrupt Requests
I/O Address
+5VDC, 420mA Max.
+12VDC, 60mA Max.
-12VDC, 50mA Max.
Power Consumption
Operating Temperature 0~50°C
Storage Temperature
Relative Humidity
-20~60°C
20~90% non-condensing
160.0 x 107.0 x 18.5mm
(6.3inch x 4.2inch x 0.7inch)
130g
Dimensions
Weight
*1 : Software programmable.
For details, see "Appendix B Notes on Developing Driver Software" or refer to
the data sheet of the NS16550 or the equivalent chip.
Board Dimensions
160.0
[mm]
COM-2(PC)F
33
System Reference
Circuitry Diagrams
SN75188
TXD, RTS, DTR
SN75189
RXD, CTS, DSR
15pF
Figure 4.1. Circuitry Diagrams
Block Diagram
The following is a block diagram of the COM-2(PC)F interface
board.
Addr. Bus
(A9~A3)
AEN
ADDRESS
DECODER
CLOCK
Addr. Bus
(A2~A0)
IOR
IOW
RESET
CNTROL
BUFFER
CN1
RS-232C
DRIVER &
RECEIVER
NS16550
NS16550
Serial Port
Data Bus
(D7~D0)
DATA
BUFFER
RS-232C
DRIVER &
RECEIVER
CN2
Serial Port
INTERRUPT
VECTOR
REGISTER
IRQ3~7,
IRQ9~12,
IRQ14, 15
INTERRUPT
JUMPER
COM-2(PC)F
Figure 4.2. COM-2(PC)F Block Diagram
34
COM-2(PC)F
Troubleshooting
5. Troubleshooting
If you are having trouble with your board or program, answer the
following questions to see if you can find the problem.
QUESTIONS:
STEPS TO TAKE
Is the pilot light on?
The system must be turned on and the power supply must be
working. Check the main power switch and the power supply.
Did the system boot up?
If the board has been installed and the system did not boot, check
the following:
- Make sure the board has been inserted firmly. Pull it out and try
to reboot. If your system reboots, then re-insert the board and
try to boot again.
- Check that cables attached to your other boards fit tightly.
Does your program work?
If the system booted and your program does not work, check the
following:
- DIP switches have been set correctly for the desired base address.
- Selected base address doesn't conflict with another peripheral
device or card installed in the computer.
- Selected interrupt levels don't conflict with interrupts required by
other devices or cards.
- Try one of the sample programs provided on the disk and see if it
works.
COM-2(PC)F
35
Troubleshooting
Does the sample program work?
Check the following:
- Signals are connected to the correct pins.
- Pin connections on the I/O cables are secure.
- Signals are present at the external connectors.
- Try using the COM-2(PC)F board with other non-essential boards
removed. Remove other boards one by one, checking the
COM-2(PC)F for successful operation after each board is
removed.
Is the input data accurate?
If you believe something is wrong with either the input data or the
output data, check the following:
- Environmental noise. Move the equipment and cables away
from sources of electrical noise. Try an isolated power source.
- Dirty connector edge. Clean the edge.
- External connectors fit tightly. Separate and reattach external
cables.
Still have a probrem?
Contact CONTEC group office where you purchased as shown in
the last page of this manual.
Note!
Before you call, make a list of the following information. Our
technical representatives will need the following information to help
you.
1. Your name, company, and phone number.
2. The brand and type of computer you are using (e.g. IBM-AT,
Compaq 386).
36
COM-2(PC)F
Troubleshooting
3. DOS Version.
4. Name of the CONTEC board that you are using.
5. Names of other boards in the computer.
6. I/O addresses for the CONTEC board and all other boards.
7. Interrupt levels for the CONTEC board and all other boards.
8. DMA channels for the CONTEC board and all other boards
(if applicable).
9. The programming language that you are using
(and the version number).
COM-2(PC)F
37
Troubleshooting
10. Different I/O addresses you have tried.
11. Are you using your own program or a CONTEC sample
program.
12. List AUTOEXEC.BAT.
13. List CONFIG.SYS.
38
COM-2(PC)F
Appendix
6. Appendix
A. Sample Programs (for MS-DOS)
This section covers the sample programs that are supplied on the
floppy disk included with this board.
COM-2(PC)F Diskette
CONTEC supplies a sample program diskette with each
COM-2(PC)F board. This diskette contains sample programs to
help you get started.
Use the DOS DIR command to see a list of files on the
COM-2(PC)F diskette.
A> dir
Backup Copy
Make a backup of the COM-2(PC)F diskette before use. This will
protect you if the original copy becomes damaged or destroyed.
Use the DOS DISKCOPY command.
A> diskcopy a: b:
Keep the original in a safe place and use the backup copy for the
following procedures.
Copy Files to Hard Disk
If a hard disk drive is available on your PC, then installing and
executing the sample programs from the hard disk drive will be
faster than using a floppy drive. To run sample programs from the
hard drive, create a subdirectory named COM2F on your C drive
and copy the files from A: to C: with the following commands.
A:> c:
C:> md com2f
C:> xcopy A:¥*.* c:¥com2f /s
COM-2(PC)F
39
Appendix
Sample Programs
The programs are written in GW-BASIC and Microsoft C.
The sample programs transmit data entered from the keyboard and
display received data on the screen. Table 6.1. lists the
communications data format.
The sample programs listed in Figure 6.1. are included on the
floppy disk.
Table 6.1. Data Format
Parameter
Data bits
Stop bits
Parity
Data Format
8 bits
2 bits
None
BAS
(1) H103HD01.BAS Data transmission (Enhanced mode)
(2) H103HD02.BAS Data reception (Enhanced mode)
(3) H103HD03.BAS Data transmission (COM1 mode)
(4) H103HD04.BAS Data reception (COM1 mode)
(5) H103HD05.BAS Data transmission and reception (Enhanced mode)
(6) H103HD06.BAS Data transmission and reception (COM1, COM2 mode)
(7) H103HD07.BAS Interrupt-driven data transmission and reception
H103HD.ASM
H103HD.BIN
(8) H103HD08.BAS Half-duplex data transmission (Enhanced mode)
(9) H103HD09.BAS Half-duplex data reception (Enhanced mode)
(10)COM21_1.C
COM21_1.EXE
Data transmission and reception (COM1, COM2 mode)
Data transmission and reception (COM3, COM4 mode)
(Address setting file for Compatible mode)
MSC
(11)COM34_1.C
COM34_1.EXE
COM2V
SETCOM.EXE
Figure 6.1. Floppy Disk Files
40
COM-2(PC)F
Appendix
Notes!
- All the sample programs must be run on a PC operating under
MS-DOS.
- Sample programs 3, 4, 6, and 10 cannot be used on a PC that
already has COM1 and COM2 ports. Similarly, sample
programs 11 cannot be used on a PC that already has COM3 and
COM4 ports.
- As sample programs 8 and 9 use half-duplex mode, they can only
be used with the COM-2PD(PC) board.
COM-2(PC)F
41
Appendix
Switch and Jumper Settings
Table 6.2. Switch and Jumper Settings of Sample Program 1,
2, and 5
Item
Settings
SW1
I/O Address
(SW1)
Interrupt Level
(JP1, JP2, JP3)
JP1
JP2
JP3
9
9
9
3
3
3
4
4
4
5
5
5
6
6
6
7 10 1112 14 15 NC
7 10 1112 14 15 NC
7 10 1112 14 15 NC
Table 6.3. Switch and Jumper Settings of Sample Program 3,
4, 6, and 10
Item
Settings
SW1
I/O Address
(SW1)
Interrupt Level
(JP1, JP2, JP3)
JP1
JP2
JP3
9
9
9
3
3
3
4
4
4
5
5
5
6
6
6
7 10 1112 14 15NC
7 10 1112 14 15NC
7 10 1112 14 15NC
42
COM-2(PC)F
Appendix
Table 6.4. Switch and Jumper Settings of Sample Program 7
Item
Settings
SW1
I/O Address
(SW1)
Interrupt Level
(JP1, JP2, JP3)
JP1
JP2
JP3
9
9
3
3
4
4
5
5
6
6
7 10 1112 14 15 NC
7 10 1112 14 15 NC
7 10 1112 14 15 NC
9
3
4
5
6
Table 6.5. Switch and Jumper Settings of Sample Program 11
Item
Settings
SW1
I/O Address
(SW1)
Interrupt Level
(JP1, JP2, JP3)
JP1
JP2
JP3
9
9
9
3
3
3
4
4
4
5
5
5
6
6
6
7 10 1112 14 15 NC
7 10 1112 14 15 NC
7 10 1112 14 15 NC
COM-2(PC)F
43
Appendix
Cable Connection
When running the sample programs 1 to 11 (except 8 and 9), use the
interconnection cable as shown in Figure 6.2. for connection with
the mating device in the Compatible mode. For use in the
Enhanced mode, on the other hand, use the cross cable or the
interconnection configuration diagram in Figure 6.2.
Signal
Pin No.
Pin No. Signal
TXD
RXD
DTR
DSR
SG
3
2
4
6
5
1
2
3
6
4
5
7
8
RXD
TXD
DSR
DTR
SG
RTS
CTS
DCD
RTS
CTS
7
8
1
DCD
CH1
External device or CH2
Figure 6.2. 9-pin Connector Diagram
44
COM-2(PC)F
Appendix
Sample Program 1
This GW-BASIC sample program demonstrates the transmit-data
capability of COM-2(PC)F in Enhanced mode. First, it initializes
the Asynchronous Communication Element (ACE), then it
transmits the data input from the keyboard to the external device
through channel 1 (CN1).
1
START
Read
Set Baud Rate
Generator
Interrupt ID Register
Set
Interrupt Enable Register
Read
Modem Status Register
Set Transmission Format
(Line Control Register)
Wait Time
(After Initialization)
A$=INKEY$
1
None Key
In Key
Set Modem Control
Output
Line Status
D5 bit = 1
Yes
No
Read
Line Status Register
Data Transmission
Read
Received Data Register
1
Data Length
Baud Rate
(sec)
1
Wait Time =
Note:
Figure 6.3. Flowchart of Sample Program 1
COM-2(PC)F
45
Appendix
Sample Program 2
This GW-BASIC sample program demonstrates the receive-data
capability of COM-2(PC)F in Enhanced mode. First, it initializes
the ACE, then it transmits the data input from the external device to
CRT through CN1.
START
1
Set Baud Rate
Generator
Read
Interrupt ID Register
Set
Interrupt Enable Register
Read
Modem Status Register
Set Transmission Format
(Line Control Register)
Wait Time
(After Initialization)
Line Status
D0 bit = 1
1
No
Yes
Set Modem Control
Output
Display Receiver Buffer's
Data On CRT
Read
Line Status Register
Read
Received Data Register
1
Data Length
Wait Time =
(sec)
1
Note:
Baud Rate
Figure 6.4. Flowchart of Sample Program 2
46
COM-2(PC)F
Appendix
Sample Program 3
This GW-BASIC sample program demonstrates the transmit-data
capability of COM-2(PC)F in Compatible mode. Using this
[OPEN "COM1 : 9600, N, 8, 2, DS" AS #1] command opens the
RS-232C communication file (COM1). It then writes the data
input from the keyboard to COM1 through CN1.
START
Set
Communication File
A$=INKEY$
None Key
In Key
Data Transmission
Figure 6.5. Flowchart of Sample Program 3
COM-2(PC)F
47
Appendix
Sample Program 4
This GW-BASIC sample program demonstrates the receive-data
capability of COM-2(PC)F in Compatible mode. Using this
[OPEN "COM1 : 9600, N, 8, 2, DS" AS #1] command opens the
RS-232C communication file (COM1). It then reads the data from
COM1 and outputs to CRT through CN1.
START
Set
Communication File
File Buffer = 0
Yes
No
Display File Buffer's
Data On CRT
Figure 6.6. Flowchart of Sample Program 4
48
COM-2(PC)F
Appendix
Sample Program 5
This GW-BASIC sample program demonstrates the
receive/transmit-data capability of COM-2(PC)F in Enhanced mode.
First, it initializes the ACE, it then receives the data input from the
keyboard through CN1. Finally it outputs the data to CRT through
CN2.
START
1
2
Channel 2
Channel 1
Set Baud Rate
Generator
Set Baud Rate
Generator
A$=INKEY$
Set
Set
None Key
No
Interrupt Enable Register
In Key
Interrupt Enable Register
Line Status
D5 bit = 1
Set Transmission Format
(Line Control Register)
Set Transmission Format
(Line Control Register)
Yes
Wait Time
(After Initialization)
Wait Time
(After Initialization)
1
1
Data Transmission
Set Modem Control
Output
Set Modem Control
Output
Line Status
D0 bit = 1
Read
Read
Line Status Register
Line Status Register
No
Yes
Read
Read
Received Data Register
Received Data Register
Display File Buffer's Data
On CRT
Read
Read
Interrupt ID Register
Interrupt ID Register
Read
Read
Modem Status Register
Modem Status Register
1
2
Data Length
Baud Rate
(sec)
1
Wait Time =
Note:
Figure 6.7. Flowchart of Sample Program 5
COM-2(PC)F
49
Appendix
Sample Program 6
This GW-BASIC sample program demonstrates the
receive/transmit-data capability of COM-2(PC)F in Compatible
mode. Using the [OPEN "COM1 : 9600, N, 8, 2, DS" AS #1]
command and the [OPEN "COM2 : 9600, N, 8, 2, DS" AS #2]
command opens two RS-232C communication files (COM1 and
COM2). The program sends the keyboard input data from COM1
to COM2 and displays the data received from COM2 to CRT.
START
Set COM1
Set COM2
A$=INKEY$
None Key
In Key
Data Transmission
File Buffer = 0
Yes
No
Display File Buffer's Data
On CRT
Figure 6.8. Flowchart of Sample Program 6
50
COM-2(PC)F
Appendix
Sample Program 7
This GW-BASIC sample program demonstrates the
receive/transmit-data capability of COM-2(PC)F in Enhanced mode
with interrupt input. It calls a machine language program to
register and handle interrupt input. One channel's receive/transit-
data routine is processed in the interrupt handler. The received
data is stored in the data buffer. Data to be transmitted is read
from the data buffer.
START
1
Register
Machine Language Area
None Key
A$=INKEY$
Set Segment
In Key
Line Status
D5 bit = 1
Load Interrupt
Handling Program
No
No
Yes
Set Baud Rate
Generator
Data Transmission
Set
Interrupt Enable Register
Line Status
D0 bit = 1
Set Transmission Format
(Line Control Register)
Yes
Wait Time
(After Initialization)
1
Receive Data
Set Modem Control
Output
Read
Line Status Register
Read
Received Data Register
Read
Interrupt ID Register
Read
Modem Status Register
Interrupt Control Port
D7 bit ON
1
Data Length
Baud Rate
(sec)
1
Wait Time =
Note:
Figure 6.9. Flowchart of Sample Program 7
COM-2(PC)F
51
Appendix
Sample Program 8
[Half-duplex data transmission (Enhanced mode)]
The sample program 8 enables initialization on ACE, data
transmission in the transmission mode, and waits for the receive
data in the receive mode.
START
1
Set Baud Rate
Generator
Line Status
D6 bit = 1
No
Set Interrupt Enable
Register
Yes
Data Transmission
Set Transmission Format
(Line Control Register)
WAIT Time
1
(After Initialization)
5 bytes Tramsmit
Yes
No
No
Set Modem
Control Output
Read
Transmit end
Yes
Line Status Register
Read
Received Data Register
Modem Control
RTS to High
Read
Interrupt ID Register
Line Status
D0 bit = 1
Read
No
No
Modem Status register
Yes
Modem Control
RTS to LOW
Display Receiver Buffer's
Data 0n CRT
1
5 bytes Receive
Yes
Data Length
Wait Time =
END
(sec)
1
Note:
Baud Rate
Figure 6.10. Flowchart of Sample Program 8
52
COM-2(PC)F
Appendix
Sample Program 9
[Half-duplex data reception (Enhanced mode)]
The sample program 9 enables initialization on ACE, receives
5-byte data; after transmission, the program enters the transmission
mode for data transmission.
START
1
Set Baud Rate
Generator
Line Status
D0 bit = 1
No
Set Interrupt Enable
Register
Yes
Display Receiver Buffer's
Data 0n CRT
Set Transmission Format
(Line Control Register)
WAIT Time
1
(After Initialization)
5 bytes Receive
Yes
No
Set Modem
Control Output
Modem Control
RTS to LOW
Read
Line Status Register
Read
Received Data Register
Line Status
D6 bit = 1
No
Read
Yes
Interrupt ID Register
Data Transmittion
Read
Modem Status Register
5 bytes Transmit
Yes
No
No
1
Transmit end
Yes
Data Length
Wait Time =
(sec)
1
Note:
Modem Control
RTS to High
Baud Rate
END
Figure 6.11. Flowchart of Sample Program 9
COM-2(PC)F
53
Appendix
Sample Program 10
[Data transmission and reception (COM1, COM2 mode)]
Sample program 10 uses the bios_serialcom( ) function for MS-C.
It first receives the data transmitted from COM1, and then receives
the data at COM1 transmitted from COM2. Received data is
displayed on the CRT.
START
1
COM1
COM1
Initialization
Initialization
COM2
COM2
Initialization
Initialization
Transmit 1-byte
Data from COM2
Transmit 1-byte
Data from COM1
COM2 status check
ready to receive?
COM1 status check
ready to receive?
No
No
Yes
Yes
COM2
Data Reception
COM1
Data Reception
Data reception A to K
from COM1 completed?
Data reception a to k
from COM2 completed?
No
No
Yes
Yes
1
END
Figure 6.12. Flowchart of Sample Program10
54
COM-2(PC)F
Appendix
Sample Program 11
[Data transmission and reception (COM3, COM4 mode)]
Sample program 11 uses the bios_serialcom( ) function for MS-C.
It first receives the data transmitted from COM3, and then receives
the data at COM3 transmitted from COM4. Received data is
displayed on the CRT.
START
1
COM3
COM3
Initialization
Initialization
COM4
COM4
Initialization
Initialization
Transmit 1-byte
Data from COM4
Transmit 1-byte
Data from COM3
COM3 status check
ready to receive?
COM4 status check
ready to receive?
No
No
Yes
Yes
COM3
Data Reception
COM4
Data Reception
Data reception a to k
from COM4 completed?
Data reception A to K
from COM3 completed?
No
No
Yes
Yes
1
END
Figure 6.13. Flowchart of Sample Program 11
COM-2(PC)F
55
Appendix
B. Notes on Developing Driver Software
Internal Registers
COM-2(PC)F uses the NS16550 (National Semiconductor) as the
Asynchronous Communication Element (ACE). Within the
address range of each channel, the offset addresses 0 through 7
furnish access to the internal registers of each of the two ACE's.
Table 6.6. shows how functions relate to the internal registers. To
access the baud rate generator (defined on the next page), the
DLAB signal must be set high. For more details on NS16550,
refer to the National Semiconductor Data Book.
Table 6.6. Function Selection through Internal Registers
I/O Port Address
"Base Address" +0H
"Base Address" +0H
"Base Address" +1H
"Base Address" +2H
"Base Address" +2H
"Base Address" +3H
"Base Address" +4H
"Base Address" +5H
"Base Address" +6H
"Base Address" +7H
"Base Address" +0H
"Base Address" +1H
DLAB *1
ACE Register (NS16550)
Receiver (Buffer register)
Transmitter (Holding register)
Interrupt Enable Register
Interrupt ID
Note *2
0
0
0
x
x
x
x
x
x
x
1
1
R
W
R
FIFO Control
W
Line Control
Modem Control
Line Status
Modem Status
Scratchpad Register
Baud Rate Divider Register LSB
Baud Rate Divider Register MSB
*1 DLAB: Divisor Latch Access Bit in the Modem Status Register.
*2 R=Read only; W=Write only.
56
COM-2(PC)F
Appendix
Baud Rate Selection
The COM-2(PC)F board has one programmable baud rate generator
for each of the two ACEs. The ACEs use a 1.8432MHz crystal
oscillator as clock input. The baud rate generator takes the
1.8432MHz clock and divides it by a divisor from 1 to (216 - 1).
The output frequency of the baud rate generator equals 16 times the
baud rate.
Based on the originating clock frequency, the baud rate is derived
as:
Divisor = clock frequency/(baud rate x 16)
Two eight-bit divisor registers on the ACEs store the divisor in a
16-bit binary format. These divisors must be loaded during
initialization into Divider registers (see Table 6.6.). Table 6.7.
provides frequently used baud rates and their divisors. The
percent error is the difference between actual and desired value.
Table 6.7. Baud Rate and Divisors
Desired Baud Rate
50
Divisor
2304
1536
1047
857
768
384
192
96
Percent Error
---
---
75
110
0.026
0.058
---
134.5
150
300
---
600
---
1200
---
1800
64
---
2000
58
0.680
---
2400
48
3600
32
---
4800
24
---
7200
16
---
9600
12
---
19200
38400
57600
115200
6
---
3
---
2
---
1
---
COM-2(PC)F
57
Appendix
LSI Recovery Time
Due to the ever higher CPU clock rates used in PCs, restrictions
apply when controlling a peripheral LSI device by software.
Table 6.8. lists the LSIs used on CONTEC boards which require
special consideration when accessing. Take note of the following
point when accessing these LSIs.
In PCs using i386 or earlier CPUs, software waits (JMP $+2) can be
used to provide a recovery time when accessing the LSI. However,
software waits cannot be used to provide a recovery time in PCs
with a i486 or later CPU because of the CPU cache memory
function.
The following describes one method of providing the recovery time
when using an i486 or later CPU.
In the PC/AT and compatible computers, executing an IN
instruction for the port at I/O address 2EFh (COM4 scratch register)
takes a minimum of 0.5ms. As this time does not depend on the
CPU type or clock rate, the time can be used to provide the
recovery time. After accessing any of the devices listed in
Table 6.8., execute the IN instruction for the 2EFh port the required
number of times to provide the recovery time.
Table 6.8. Number of Times the IN Instruction Must be
Executed for the 2EFh Port after Accessing the LSI
LSI Device
Output
None
Once
Once
Once
Once
Once
Input
None
Once
Once
Once
Once
None
i8237 or equivalent
i8254 or equivalent
i8255 or equivalent
i8259 or equivalent
NS16550 or equivalent
PD7210C
m
58
COM-2(PC)F
Appendix
Example program (for accessing an i8254 or equivalent)
- Microsoft Macro Assembler
OUT DX, AL
; Access to the i8254
IN AL, 2EFH
; Execute IN AL, 2EFH once to provide
the recovery time
- Microsoft C/C++
outp(port, byte);
rt=inp(0x2ef);
/* Access to the i8254 */
/* Execute rt=inp(0x2ef); once to
provide the recovery time */
COM-2(PC)F
59
Appendix
Various Aspects of Interrupt Handling in Enhanced Mode
and Compatible Mode
Enhanced Mode
When in Enhanced mode, two channels of the COM-2(PC)F share
the same interrupt request line. The interrupt levels can be set
from IRQ3~IRQ7, IRQ9~IRQ12, IRQ14, and IRQ15 by setting JP1
before installing this board. Each channel's interrupt signal will be
latched in the Interrupt Vector Register (IVR).
Therefore, when the CPU receives an interrupt requirement, the
interrupt service routine can check the IVR to determine which
channel is requesting interrupt service. After finishing the
interrupt service process, the interrupt service routine has to check
IVR again to see if a Pending interrupt request has occurred.
ACE (Asynchronous Communication Element) has its own internal
register for enabling interrupts and identifying the interrupt service
requesting channel. Refer to National Semiconductor's data book
for additional details on NS16550 and its operation.
When turning on the PC's main power, the ACE's master reset
function sets OUT1 to "High". This status automatically enables
the interrupt. If one of the two channels is not allowed to generate
the interrupt, set the OUT1 bit to "Low".
In addition to being able to enable/disable interrupt by channel, the
board also has a global interrupt enable function. This global
interrupt enable function determines whether the IRQ line is active
or not. When turning on the power, this function sets to the
disable status. To enable the PC bus to accept an interrupt, this
function has to be programmed to enable status. To enable this
function, write "1" to IVR's D7 bit; to disable this function, write
"0" to IVR's D7 bit.
Figure 6.14. describes the bit function of IVR in Enhanced mode.
The I/O address of IVR is either 2BF or 1BF.
60
COM-2(PC)F
Appendix
Output Port
D7 D6 D5 D4 D3 D2 D1 D0
2BF/1BF
Not Used
Global Interrupt
0: Disable
1: Enable
Input Port
2BF/1BF
D7 D6 D5 D4 D3 D2 D1 D0
Not Used
CH1 Interrupt
0: Occurred
1: Not Occurred
CH2 Interrupt
0: Occurred
1: Not Occurred
Global Interrupt
0: Enable
1: Disable
Figure 6.14. IVR Bit Function in Enhanced Mode
Compatible Mode
When in the Compatible mode, CN1 of the interface board is
compatible with COM1 or COM3 and CN2 is compatible with
COM2 or COM4. By using JP2 and JP3, interrupt levels can be
selected from IRQ3~IRQ7, IRQ9~IRQ12, IRQ14, and IRQ15 for
CN1 and CN2. Normally, COM1/COM3 uses IRQ4 and
COM2/COM4 uses IRQ3.
COM-2(PC)F
61
Appendix
C. The Details on NS16550
Table 6.9. NS16550's Register
(Short from National Semiconductor's data book)
< 1 / 2 >
Register
1 DLAB = 0
0 DLAB = 0
Receiver
Buffer
0 DLAB = 0
Transmitter
Holding
2
2
FIFO
3
Bit
Interrupt
Enable
Interrupt
Ident.
Line
No.
Control
Register
(Write Only)
FCR
Control
Register
Register
Register
Register
Register
(Read Only)
IIR
(Read Only)
RBR
(Write Only)
THR
IER
Enable
LCR
Word
0
Data Bit 0
Data Bit 0
"0" if
FIFO
Received
Data
Interrupt
Pending
Enable
Length
Select
Bit 0
Available
Interrupt
(ERBFI)
Enable
(WLS0)
1
Data Bit 1
Data Bit 1
Interrupt
ID
RCVR
FIFO
Reset
Word
Length
Select
Bit 1
Transmitter
Holding
Register
Empty
Bit (0)
(WLS1)
Interrupt
(ETBEI)
Enable
2
3
Data Bit 2
Data Bit 2
Interrupt
ID
XMIT
FIFO
Reset
Number of
Stop Bits
(STB)
Receiver
Line Status
Interrupt
(ELSI)
Bit (1)
Data Bit 3
Data Bit 3
Enable
Interrupt
ID
DMA
Mode
Select
Parity
Enable
(PEN)
MODEM
Status
Bit (2)
Interrupt
(EDSSI)
0
4
5
Data Bit 4
Data Bit 5
Data Bit 4
Data Bit 5
0
0
Reserved
Reserved
Even
Parity
Select
(EPS)
Stick
0
Parity
6
7
Data Bit 6
Data Bit 7
Data Bit 6
Data Bit 7
0
0
FIFOs
RCVR
Trigger
(LSB)
Set
Enabled
Break
FIFOs
RCVR
Trigger
(MSB)
Divisor
Latch
Enabled
Access Bit
(DLAB)
62
COM-2(PC)F
Appendix
Table 6.9. NS16550's Register
(Short from National Semiconductor's data book)
< 2 / 2 >
Register
4
5
6
7
0 DLAB = 1
Divisor
Latch
1 DLAB =1
Bit
MODEM
Control
Register
Line
MODEM
Status
Scratch
Register
Divisor
Latch
(MS)
No.
Status
Register
Register
(LS)
MCR
Data
LSR
Data
Ready
(DR)
MSR
Delta
SCR
Bit 0
DLL
Bit 0
DLM
Bit 8
0
Terminal
Ready
(DTR)
Clear
to Send
(DCTS)
1
Request
to Send
(RTS)
Overrun
Error
Delta
Data
Bit 1
Bit 1
Bit 9
(OE)
Set Ready
(DDSR)
2
3
Out 1
Parity
Error
(PE)
Trailing
Edge Ring
Indicator
(TERI)
Bit 2
Bit 2
Bit 10
Out 2
Framing
Error
Delta
Data
Bit 3
Bit 3
Bit 11
(FE)
Carrier
Detect
(DDCD)
Clear
4
5
Loop
Break
Interrupt
(BI)
Bit 4
Bit 5
Bit 4
Bit 5
Bit 12
Bit 13
to Send
(CTS)
0
Transmitter
Holding
Register
(THRE)
Transmitter
Empty
Data
Set
Ready
(DSR)
Ring
6
7
0
0
Bit 6
Bit 7
Bit 6
Bit 7
Bit 14
Bit 15
Indicator
(RI)
(TEMT)
Error in
RCVR
Data
Carrier
Detect
(DCD)
FIFO
COM-2(PC)F
63
Appendix
D. Difference Between the COM-2(PC)F
and COM-2(PC)V
The COM-2(PC)F is an upgrade of the previous COM-2(PC)V
board and is upwardly compatible. Therefore, the board can
generally be used in the same way as the COM-2(PC)V.
However, as the bus specification has changed from the XT bus to
the AT bus and the board sizes are different, the COM-2(PC)F may
not fit in some PCs. Check the size of board that can be mounted
in your PC before selecting the COM-2(PC)F. The two boards
also differ in their specifications and hardware setup. The
differences are described below.
Table 6.10. Specifications Differences
COM-2(PC)V
COM-2(PC)F
Bus
XT Bus
AT Bus
Baud Rate
Interrupt Level
50~38,400bps
50~115,200bps
IRQ3~7, 9
IRQ3~7, 9~12, 14, 15
(Jumper Selectable)
160.0 x 107.0 x 18.5mm
(Jumper Selectable)
120.0 x 107.0 x 18.5mm
Dimensions
COM-2(PC)V
JP1~JP3
COM-2(PC)F
JP1~JP3
Interrupt
setting
6
9
3
4
5
7 10 11 12 1415 NC
2
3
4
5
6
7 NC
(Jumper Selectable)
(Jumper Selectable)
Figure 6.15. Difference in Jumpers (JP1~JP3)
64
COM-2(PC)F
Index
7. Index
B
M
Baud Rate, 57
Mounting Method, 28
Block Diagram, 34
Board Setup, 25
MS-DOS, 20
N
NS16550's Register, 62
C
Circuitry Diagrams, 34
O
Compatible Mode, 5
Connectors, 31
Obtain Service, 2
S
E
Sample Programs, 39
Enhanced Mode, 5
Setup, 23
External Connection, 31
Specifications, 33
Support Software of Option, 1
System Reference, 33
F
Features, 1
I
T
I/O Address, 24
Troubleshooting, 35
Internal Registers, 56
Interrupt Level, 26
L
Liability, 2
LSI Recovery Time, 58
COM-2(PC)F
65
Index
W
Warranty, 2
Windows 2000, 14
Windows 3.1, 19
Windows 95, 10
Windows Me/98, 6
Windows NT, 18
66
COM-2(PC)F
A-41-606
LZU2821
021025 [961015]
CONTECGroup
JAPAN
:
Headquarters
CONTEC Co., LTD.
3-9-31, Himesato, Nishiyodogawa-ku, Osaka 555-0025, Japan
Tel
E-mail
:
:
+81 (6) 6477-5219
Fax : +81 (6) 6477-1692
U.S.A.
:
:
:
CONTEC MICROELECTRONICS U.S.A. INC.
744 South Hillview Drive, Milpitas, CA 95035 U.S.A.
Tel
E-mail
:
:
+1 (408) 719-8200
Fax : +1 (408) 719-6750
EUROPE
CONTEC MICROELECTRONICS EUROPE B.V.
Binnenweg 4, 2132 CT, Hoofddorp, The Netherlands
Tel
E-mail
:
:
+31 (23) 567-3030
Fax : +31 (23) 567-3035
KOREA
CHINA
HYOJIN CONTEC Co., LTD.
Ki-im Bldg. #399, Shindolim-Dong, Kuro-ku, Seoul, Korea
Tel
E-mail
:
:
+82 (2) 2636-4277/8
Fax : +82 (2) 2636-4279
:
INTERNATIONAL CONTEC TECHNOLOGY CO., LTD.
B-8F, Hua Tong Building, No. B19, Che Gong Zhuang West Road,
Hai Dian District, Beijing 100044, China
Tel
E-mail
:
:
+86(10)8801-8228
Fax : +86 (10)8801-8209
SHANGHAI CONTEC MICROELECTRONICS CORP.
No. 481 Gui Ping Road, Cao He Jing Hi-Tech Park Shanghai, 200233, China
Tel
E-mail
:
:
+86 (21) 6485-1907
Fax : +86 (21) 6485-0330
SHENYANG CONTEC MICROELECTRONICS Co., LTD.
No. 169, Qingnian Street, Shenhe District, Shenyang 110015, China
Tel
:
+86 (24) 2392-9771
Fax : +86 (24) 2392-9773
TAIWAN
:
MACROMATE CORP.
8F, Universal Center, No.179, Ta-Tung Rd., Sec.1 Hsi-Chih, Taipei Hsien, Taiwan,
R.O.C
Tel
E-mail
:
:
+886 (2) 2647-9353
Fax : +886 (2) 2647-9373
A-46-368 Ver. 2001. 02. 06
|