You are on page 1of 6

Design and Implementation of a Fast DIO (Digital I/O)

and Motion Control System


Gyusang Cho1, Jinkyung Ryeu2,*, and Jongwoon Lee3
1
Dept. of Computer Eng., Dongyang Univ., Youngju, Korea
Dept. of IT Electronic Eng., Dongyang Univ., Youngju, Korea
3
Dept. of Railway Control Eng., Dongyang Univ., Youngju, Korea
{gyusang, jkryeu, jwlee}@dyu.ac.kr
2

Abstract. High speed PC-based DIO (Digital I/O) system that consists of a
master device and slave I/O devices is developed. The master device, which has
PCI interface to a PC, controls all of serial communications, reducing the load
on the CPU to a minimum. And the slave I/O devices, which are used as 16 bits
input, 16 bits output, and 8bits input-output each, are connected from the master
device to one slave, from the slave to the next slave, and to a maximum 64
slaves repeatedly. The master device has 2 rings which can take 64 slaves each.
Therefore, total I/O points covered by the master are 2048 points. The slave features 3 types of input/output function interchangeability by DIP switch settings.
Library, application, and device driver software for the DIO system that have a
secure and a convenient functionality are developed.

1 Introduction
Many Digital I/Os such as switch input, AC input, relay output and TR output are
required in the field of industrial machine, high-accuracy semiconductor instruments,
chemical factory and steel factory. PLC (Programmable Logic Controller) [1] is used
mostly in these types of I/O processes. In this case, there are some defects such as
additional cost fir instruments and the necessities of another OS and of large space for
implementing. Moreover, it is difficult to communicate with PC and the length of
cable is getting longer. Because of these defects, PC-based I/O cards are used widely.
But there also exist some problems such as using limited slots for many I/O cards [2].
Recently, PC-based I/O system using PC as main controller is used widely [3],[4].
Many merits of this method such as real-time controllability, development facility,
reliability and scalability make the cost lower. The key criteria of performance in
this type of system are wiring between the master device and the slave device, data
transfer speed and interfacing PC with the master device.
One-to-one wiring between the master device and the slave device is general, but
many I/O cards must be equipped on limited PC slots. In a study using USB for overcoming the defect [5], maximum 64 points can be used by connecting 4 slaves per one
USB master port. But the above method has a problem that an additional USB master
*

Corresponding author.

D.-S. Huang, K. Li, and G.W. Irwin (Eds.): ICIC 2006, LNCS 4113, pp. 1133 1138, 2006.
Springer-Verlag Berlin Heidelberg 2006

1134

G. Cho, J. Ryeu, and J. Lee

device is needed for many points. To overcome this demerit the USB HSIO (High
Speed I/O) system which can distribute master and slave by adopting the structure
having very high transfer speed and reduced routing was developed[6]. Continued on
this research the PCI HSIO system which is more stable and faster than the existing
systems and guarantees fixed access time was implemented [7].
In this research, we designed and implemented a DIO (Digital I/O) system which is
much better in speed, number of available points and design facility than PCI HSIO
[7]. In the body of this paper there are specific methods of design and implementation. The overview of the overall DIO system and the description about the method
of hardware implementation for the master and slave devices having simple wiring
structure and high operating speed are in Chap 2.

2 Overview of DIO System


2.1 Features of the System
Master device considers I/O of slaves just like accessing memory, so this helps to
reduce the burden of CPU and to enhance the communication speed. And it is possible that make the system configuration in a simple form. By using RS-485 communication, it is possible to cut down wiring cost and simplify wiring problem [8].
System is consists of Master and Slave devices as shown in Fig. 1. Master device is
installed on PC with PCI interface. The slaves are connected from the master device
to one slave, from that slave to next slave, and to other slave, etc. PLX9030 [9] chip is
used for PCI communication, and G9001 is used for master device, and G9002 is used
for DIO slave devices.
The master device equipped with two G9001 chip can connect maximum 64 slaves
each. One is called ring 0 and the other is called ring 1. So the maximum 128 slave can
be used. RS-485 communications between the master and slaves have half-duplex way.
With 20Mbps communication, the communication time for a slave is about 15.1 microseconds and 64 slaves (1024 points of I/O) can be updated within 1 millisecond.
2.2 Wiring and Scalability
The slave device is connected from the master device and another slave device is co
nnected to the slave device, it can be repeated to maximum 64 slave devices in one rin
g, in case of two rings the master can take 128 slaves. In general, a parallel I/O metho
d has a strong point in a fast response, but the method has a weak point in wring all sl
ave devices to a mater device. A serial I/O method takes advantages in a long distanc
e communication and in total numbers of wire connection, but has disadvantages
in the communication speed and load of computation time. Adoption of RS-485 com
munication method gives a strong point of the serial and the parallel method, and it gi
ves the system an enhancement of communication speed and simplicity in wring.
And, in our system, the way of slave connection is extensible. Several slave types,
for example, DIO slave device for I/O device with G9002 chip, motion control slave
device for CPU emulation device with G9004 and PCL device with G9003 chip, are
operated on a master device. It is possible that, on the one hand, the system communicates with DIO devices, on the other hand, communicates with motion control devices.

Design and Implementation of a Fast DIO (Digital I/O) and Motion Control System

1135

Fig. 1. Configuration of DIO system

3 Control of DIO System


3.1 Command and the Memory Map
On the master device the information for controlling the slave devices is document.
Having the information about slave makes the master device easier to control slave.
Slave device is not holds the information itself but take in charge of only input and
output function. The every information on slave is documented on the master device
memory. Table 1 show the information which are documented on the master.
Commands to control the master device and the slave device are can be documented on the master device's commands' data in 16 bits of 000-001h. #0100h is for
make it have software reset, #1000h is for make it have all system communication, 1100h is for make it have all system communication except the allotted slave.,
1200h-123Fh is for make it have assigned device's communication work by bit( 0001
0010 00## ####(#ID assign bit) ), 3000h I/O is for make it have start for communication, 3100h I/O is for make it have end the communication.
3.2 Slave Information
The information which is documented in the master device's memory is recorded after
test communication for each slave devices. Upon response to the slaves the information about the type of device, the connection status and the I/O port are periodically
renewed. The type of slave can be in four formats as shown in Table 2. The number of
type is decided by the setting value. Each setting is organized to be set by the deep
switch. According to this the port which is used in the control is decided and functioning input or output by the deep switch. When the slaves are connected to the master
device the 8 bit information is saved in the memory slot 078h-0B7h as the value corresponding to the slave setting in Table 2.
Fig. 2 is the actual master device. Fig. 3 is the slave devices that are on operation.
LED shows the condition of input and output.

1136

G. Cho, J. Ryeu, and J. Lee


Table 1. Memory map of the master device

Address

Write

Read

000-001

Command

status

002-003

Invalid

Interrupt status

Device Info. 8bit for each device.


Device #0-#63
I/O communication error flag
1bit for each device

Device Info. 8bit for each device.


Device #0-#63
I/O communication error flag
1bit for each device

Input port change Interrupt settings


4bit for each device
I/O port data
8bit for each device

Input port change Interrupt settings


4bit for each device
I/O port data
8bit for each device

078-0B7
0B8-0BF
0C0-0FF
100-1FF

Table 2. Type number settings by DIP switch


Type NO.

Setting

Port0

Port1

type0

00

type1

01

Input

Output

type2

10

Input

Output

type3

11

Fig. 2. PCI master device

Input

Port2

Port3

Output

Fig. 3. Slave devices for (a) DIO (b) motion


control

4 Library Software for DIO System


Library routines for the DIO system are categorized to 4 groups, such as PCI setup
and master initialization DIO, slave control, I/O, and ring setting.
PCI setup and master initialization category is consists of five functions. - InitializePCI() is used to prepare communication to open device driver DIO.sys, and
FinishPCI() closes the communication to the driver. After initialization procedure,
StartComm() and StopComm() start and stop I/O communication between the master

Design and Implementation of a Fast DIO (Digital I/O) and Motion Control System

1137

Table 3. Library functions for DIO system


Category
PCI settings and
initialization

Functions
InitializePCI(), FinishPCI(), StartIOComm(), StopIOComm(), Reset()

Slave Control

GetDeviceType(),GetAllDeviceType(),GetConnectedDevice(),
ClearAllSlave()

Input/Output

WriteWord(),WriteByte(),WriteWordBitwise(),WriteByteBitwise(),
ReadWord(),ReadByte(),ReadWordBitwise(),ReadByteBitwise()

Ring Control

SetRing(), GetRing()

and the slave devices. Reset() is to reset the master device so that all the register of the
master can be reset and all slave information can be reset.
Four functions are presented to slave control. GetDeviceType() returns the slave type
value when the slave ID is assigned in the argument. GetAllDeviceType() write the
type information of all connected slaves(#0-#63) to the slave type information array.
GetConncetionDevice() returns the slave number and slave type that are currently connected. ClearAllSlave() clears the all slave information in the master devices.
Eight functions that are used to input and output are presented. That functions operates in word, byte, and bitwise. WriteWord() and WriteByte() writes in a word and
in a byte to a specified slave respectively. WriteWordBitwise() and WriteByteBitwise()
writes in a word and a byte to only specified bit to set 0 or 1 respectively. Each ReadWord( ) and ReadByte() returns word and byte data for input. ReadWordBitwise() and
ReadByteBitwise() reads the bit data in word and byte from the specified slave.
SetRing() is used to set ring number to 0 or 1, and GetRing() returns a current ring
number.

5 Conclusions
In this study, we designed and implemented high speed DIO (Digital I/O) system
which has master-slave type structure. Master device is PC-based I/O system with
PCI interface. Slave devices can be distributed by using wiring the mater to a slave
and a slave to another slave, hence long and complex cabling problem of the existing
systems can be solved.
Very fast I/O and simple structure can be accomplished in out system by storing
I/O and attribute information of a slave into the master device. As shown in Table 1,
our system is superior to the existing methods in communication speed, number of
slaves I/O points and applicability of the slave. In our system, the port of a slave can
be used for input or output selectively. Therefore the cost of designing and implementing is reduced and the users facility is improved.
Software is programmed to operate on Windows XP in this study. We fabricated a
device driver with WDM type and programmed a library software having some functions such as PCI initialization of DIO system, initialization of the master device,
slave control, I/O and ring selection/reset. And also we implemented an application
program of dialogue type as an application example.

1138

G. Cho, J. Ryeu, and J. Lee

Under the situation that generalization of PC-based I/O controller and the design of
software PLC are going on, high performance with low cost can be accomplished by
adopting out system to accurate equipments, control instruments and process control
in which digital I/O is required. Moreover, high performance program for controlling
I/O which is suited to users circumstances can be implemented by using the functions
provided as library forms. Commercialization is anticipated by applying one up technique of our DIO system..

References
1. Kelvin, E. T.: Programmable Logic Controller, IEEE Potential, 3 (1996)14-17
2. Juniper, M.: PC vs. PLC-The Debate Rages On Control Systems -Tonbridge, 13 (6) (1996)
33-34
3. Agostino, C.: Automation of Direct Reduction Plant Using PLC/PC. IFAC Symposium on
Intelligent Components and Instruments for Control Applications, New York (2001)
341-346
4. Hankoo, P.: Application of PC-based Control System to Steel Manufacturing Process, Rolling 2001 : 4th Symposium, Japan (2001)
5. Jong W. L.: Distributed Industrial I/O Control System with USB. IEEK Summer Conference Proceeding, Vol. D. (2001) 2362-2364
6. Cho, G. S.: Distributed I/O Control System with USB. 2004 IEEK Summer Conference
Proceeding Vol.V. (2004) 1477-1480
7. Cho, G. S.: Development of HSIO (High Speed I/O) System with PCI Interface. 2004 KIEE
Summer Conference Proceeding, Vol. D. (2004)2628-2630
8. Motionnet User's Manual, Chapter 1~IV-4, NPM (2004)
9. PCI 9030 Data Book Version 1.4, PLX Technology, New York (2002) 1-198

You might also like