Você está na página 1de 127

Remote I/O

Developed by Advantech IAG Training Center


2

(Internal Use Only)


I

Table of Contents

Chapter 1........................................................................Introduction

1.1 Industry Introduction..................................................................................1

1.2 Application Stories.....................................................................................3

1.2.1 Continuous Emissions Monitoring System....................................3

1.2.2 Fire Monitoring System in a Steel Factory....................................6

1.2.3 Military Ammunition Depot Monitoring System.........................10

1.3 Learning Purpose.....................................................................................13

1.4 Structure of the Textbook.........................................................................13

Chapter 2 Essential Concepts..............................................................................17


2.1 Serial Communication..............................................................................17

2.1.1 Communication Mode..................................................................17

2.1.2 Communication Interface.............................................................19

2.1.3 Communication Interface RS-232.............................................20

2.1.4 Communication Interface RS-485.............................................24

2.1.5 Communication Interface RS-422.............................................26

2.1.6 Communication Interface Comparison Table............................26

2.1.7 Topology.......................................................................................27

2.1.8 Termination Resistor....................................................................28

2.2 Ethernet Communication.........................................................................29

2.2.1 What is Ethernet...........................................................................29

2.3 Introduction to Modbus............................................................................30

2.3.1 Modbus Frame Format.................................................................31

2.4 Summary..................................................................................................36
II

2.4.1 Architecture for Serial modules...................................................36

2.4.2 Architecture for Ethernet modules...............................................36

2.5 Quiz..........................................................................................................37

Chapter 3 Product Introduction.........................................................................39


3.1 Serial-Based Modules..............................................................................39

3.1.1 Converter and Repeater................................................................39

3.1.2 Robust Family..............................................................................41

3.2 Ethernet-Based Modules..........................................................................43

3.2.1 Built-in WebServer.......................................................................44

3.2.2 Intelligent I/O...............................................................................44

3.2.3 Peer-to-Peer & GCL.....................................................................47

3.3 Product Selection.....................................................................................48

3.4 Quiz..........................................................................................................51

Chapter 4 Getting Started...................................................................................53


4.1 Resource on the WebSite..........................................................................53

4.2 ADAM-4000 Configuration and Utility...................................................54

4.2.1 Hardware Wiring..........................................................................54

4.2.2 Initial Modules.............................................................................55

4.2.3 Search Modules............................................................................56

4.2.4 IO Configuration..........................................................................58

4.2.5 Advanced Setting--Trend and Data Logging...............................60

4.2.6 Advanced Setting--Calibration.....................................................62

4.2.7 Practice.........................................................................................64

4.3 ADAM-6000 Configuration and Utility...................................................67

4.3.1 Hardware Wiring..........................................................................67

4.3.2 Search Modules............................................................................67

4.3.3 Advanced Search Modules...........................................................69

4.3.4 Network Setting...........................................................................70


III

4.3.5 IO Configuration..........................................................................71

4.3.6 Advanced Setting--Password.......................................................80

4.3.7 Advanced Setting--Access Control..............................................81

4.3.8 Advanced Setting--Firmware Update..........................................82

4.3.9 Practice.........................................................................................82

4.4 ADAM-6000 Powerful Function(Advanced)..........................................86

4.4.1 Data Stream..................................................................................86

4.4.2 Peer to Peer..................................................................................87

4.4.3 GCL Function...............................................................................92

4.4.4 Practice.........................................................................................98

4.5 Communication Protocols......................................................................104

4.5.1 ASCII commands for Serial Modules........................................104

4.5.2 Modbus/RTU for Serial Modules...............................................105

4.5.3 ASCII commands for Ethernet Modules....................................107

4.5.4 Modbus/TCP for Ethernet Modules...........................................108

4.6 Quiz........................................................................................................109

Chapter 5 Host PC Connection(Advanced).....................................................113


5.1 OPC Sever..............................................................................................113

5.1.1 Modbus/TCP OPC Server..........................................................114

5.1.2 Using OPC Client ( ADAM OPC Browser)...............................116

5.2 Programming--ADAM .NET Class Library...........................................120

5.2.1 COMPortTest Example for Serial Modules...............................123

5.2.2 ModbusRTU Example for Serial Modules.................................125

5.2.3 ModbusTCP Example for Ethernet Modules.............................128

5.3 Quiz........................................................................................................131
Host PC Connection(Advanced)1

Chapter 1 Introduction

1.1 Industry Introduction

Industrial automation contains a lot of types of automation, like building

automation, machine automation, environment monitoring system automation, and

etc. The overview is shown in Figure 1 -1.

Figure 1-1 eAutomation Overview

Because the environment of industrial applications is always tough, some

specifications such as the temperature tolerance and vibration protection are getting

Advantech IAG Training Center (Internal Use Only)


2 Host PC Connection(Advanced)

important. For this reason, the companies which develop the industrial equipments

focus on the way to make the industrial computer and devices more stable and

flexible. For example, the industrial computer has more PCI slots so that the

customers can install more PCI cards to extend their applications. Or in building

automation system, there should be an industrial computer (ex: UNO series) with

remote IO modules (ex: ADAM-4000, 6000 series modules) to monitor whole

building status for security.

Advantech Remote IO modules provide I/O, data acquisitions, and

networking Ethernet Serial COMPort in one module to build a cost-effective,

distributed monitoring and control solution for a wide variety of applications.

Through standard Ethernet or RS-485, Advantech Remote IO modules retrieve I/O

values from sensors, and can publish them as a real-time I/O values to PC. Advantech

Remote IO modules build up a cost-effective DA&C system for Building Automation,

Environmental Monitoring, Facility Management and eManual-facturing applications.

This textbook will focus on the base knowledge about Data Acquisition system so that

the users will know how to use Advantech Remote IO modules.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)3

1.2 Application Stories

1.2.1 Continuous Emissions Monitoring System

(Environmental & Facility Management Systems )

Project Introduction :

Environmental protection is one of the important current topics in the industrial

community. In 2007 China established the Polluting Prevention Regulation to limit its

emissions, control pollution, and raise the standard of pollution monitoring. This

regulation mandated that every power and industrial plant must adopt higher

standards for pollution monitoring, which directly increased the demand for

Advantechs ADAM-5000 Series.

System Requirements :

CEMS stands for the Continuous Emissions Monitoring System regulation,

which was proclaimed by the National Environment Protection Bureau in China. It

uses advanced and reliable technologies for photoelectric measurement and Ethernet

Advantech IAG Training Center (Internal Use Only)


4 Host PC Connection(Advanced)

communications to monitor and transmit data of the exhaust gases and emission

volume.

In these investments, the CEMS system is designed to acquire and manage real-

time data in exhaust gas discharged from the chambers of the fire power plants,

thermal power plants, incinerator plants and the industrial kilns.

System Diagram :

Figure 1-2 System Diagram--Continuous Emissions Monitoring System

System Description :

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)5

CEMS is adapted to all kinds of boilers in Continues Emission Monitoring,

which includes real time monitoring of the exhaust gas and emissions volume, and

transmits the data to a central station in the Environmental Protection Bureau. The

CEMS project adopts Advantech products, including: Embedded Automation

Computers (UNO) and Ethernet I/O Modules (ADAM-5000). The specialty of the

fanless and anti-vibration design guarantees stable operation even in the harshest

environment. MTBF is up to 60,000 hours to greatly save maintenance costs. Gas

analyzer, dust analyzer and data acquisition processor are the 3 primary parts of

CEMS. They are adopted of real-time continuous monitoring for the chroma of the

primary pollutant, such as dust, SO2, NOx, in industrial boiler, industrial kilns and

electric boiler. They also provide the parameters of gas temperature, pressure, flow,

and O2 cube. The system collects the data automatically and transmits it to the central

station and environment management division through internet. The staff also can get

the real-time data and report through internet. This ensures that the national pollutant

emission volume control project and acid rain control project are on the track, and

provides the measurement for charging the polluters.

Conclusion :

The data acquisition processor collects the parameters of gas temperature,

Advantech IAG Training Center (Internal Use Only)


6 Host PC Connection(Advanced)

pressure, flow, and O2 cube and so on. At the same time, it needs some digital I/O to

process the data automatically as well as save the data. This customer also needed a

PLC which could collect more simulation data, had bigger memory, and had more

COM ports to connect to gas and dust analyzers. Furthermore, Advantech provides

convenience, compatibility, and time saving to customers. Customers can have one-

stop shopping instead of having to outsource a lot of the works. Compatibility will not

be an issue between any of Advantechs hardware and software components, saving

the time it usually takes to integrate various products across multiple brands.

1.2.2 Fire Monitoring System in a Steel Factory

( Environmental & Facility Management Systems )

Project Introduction :

Steel mills are industrial plants for turning molten steel into ingots, billets, and

plates. These mills are high temperature, high risk environments prone to outbursts of

fire. Since the factory area is too large for the workers to monitor at all times, its very

difficult to enforce safety measures in the event of a fire or other accident. These

types of accidents can lead to loss of life, production time, revenue and more. The

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)7

third largest steel mill in the world is in Korea, and they were experiencing a high

volume of accidents each year. In order to improve safety, they tried implementing

various new systems, to no effect. Therefore, they called in Advantech to help them

establish a proper monitoring system to increase safety and improve production.

System Requirements :

Safety is the first priority in steel mills, where large risk factors are always

present. A fire monitoring system needed to be applied for strict monitoring of the

equipment and working environment. The largest problem found was that the quality

of wiring within the mill was old and very poor quality. Compounding this issue was

the fact that the existing system was dependant on sensors and cables only. The

system should be stable, reliable, and be able to send signals to the central monitoring

room in the event of an accident, so appropriate safety actions can be taken.

System Diagram :

Advantech IAG Training Center (Internal Use Only)


8 Host PC Connection(Advanced)

Figure 1-3 System Diagram--Fire Monitoring System in a Steel Factory

System Description :

Since the factory area is so large, the transmission route between fire annunciator

and receiver cant be changed. A control module is applied to transmit messages

between the receiver and all disaster monitoring departments. Advantechs ADAM-

5000/TCP is a distributed control module which uses the existing network backbone

as the basis of the new system. The disaster monitoring departments use the ADAM-

5051D digital input module to input alarm messages while all the fire equipment

(water sprinklers, fire extinguishers and alarms) use the ADAM-5068 digital output

module. The existing communication port employs ADAM-4571 and other modules

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)9

to transmit the messages to the disaster monitoring departments in each factory, so

real-time communication is accomplished between the departments in each factory

and the central disaster monitoring department.

Conclusion:

After implementing this fire monitoring system, factory workers can work hard

in a safe environment and have the peace of mind that corrective actions can be taken

in case of an unexpected accident. This ADAM-based system contributes a lot to

decrease the fire rate and increase the production capacity. The mill was very satisfied

in the respect that the system was constructed

at a low price point while still solving the large issue of the existing wiring problem.

The new system contributed to the improvement of overall safety, and endeavors are

being made to apply Advantechs disaster monitoring system to other mills currently

under construction.

1.2.3 Military Ammunition Depot Monitoring System

( Environmental & Facility Management Systems )

Advantech IAG Training Center (Internal Use Only)


10 Host PC Connection(Advanced)

Project Introduction :

A military institute in Taiwan wanted to monitor their ammunition depot against

illegal access or break-ins. When the window or door of the ammunition depot is

opened, an alarm will be activated and a message will be sent to the server (a

computer) in the central control room. While traditionally the job of a PLC, this

customer chose to apply the ADAM-6000 series with new GCL (Graphic Condition

Logic) functionality, saving them money and allowing more employees to customize

the logic programming software.

System Requirements :

The following requirements were needed for complete this system:

One remote I/O device to receive signals.

All data can be transferred to the server via Ethernet, so an Ethernet I/O device is

also needed.

The customer didnt want to write programs on the server to control the EthernetI/O

device, so the Ethernet I/O device should have the ability to operate as astandalone

module.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)11

The customer also wanted the Ethernet I/O device to be able to actively

sendmessages to the server when an event occurs (illegal break-in), so that the

serverdoesnt need to periodically poll the status of the Ethernet I/O device.

System Diagram :

Figure 1-4 System Diagram--Military Ammunition Depot Monitoring System

System Description :

There are alarm detectors installed in the doors & windows of the ammunition

depot which will generate digital output signal when the door (window) is opened.

Since this is an ammunition depot, every entrance should be monitored and notified.

ADAM-6050 modules are located near the door (window) detectors and connect to

Advantech IAG Training Center (Internal Use Only)


12 Host PC Connection(Advanced)

the detectors. The GCL utility is running on the ADAM-6050 and will continuously

check if the value of the digital inputs from the detectors has changed. In the event of

a change, it will automatically generate a digital output signal to activate the alarm

(power the buzzer). At the same time, ADAM-6050 modules will also send predefined

message through Internet or Intranet to the remote server in the central control room.

Then the guard in the central control room can take related action.

Conclusion :

Advantechs ADAM-6000 with GCL solution is perfect for this application. Not

only is this a very simple system, but only one ADAM-6050 module is needed.The

developer can build the system in a very short time, and they dont need to write a

detailed program on the server to read DI or DO status on the module. They only

needed to complete the program in the graphical configuration environment, which

actually took them less than 10 minutes to complete.

1.3 Learning Purpose

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)13

The purpose of this Remote IO textbook is to assist the users to learn the basic

concept of Remote Data acquisition and know how to use Advantech Remote IO

modules. In advance, if you are already familiar with this, Chapter 5 will be described

the software programming in depth. After that, the users should know more about the

architecture of the Remote IO system and learn the skills of using Advantech utility

and examples to control the Modules. If possible, the users also can refer to the

examples and modify them to be the unique application to satisfy their needs.

1.4 Structure of the Textbook

This textbook will be separate into five chapters. In Chapter 1, the overview of

industry, the application story of the Remote Data acquisition and whats the rule of

the Remote IO Modules will be introduced. In Chapter2, the essential basic concept

will be described in more detail. The communication interface for Remote data

acquisition, RS-232RS-485RS-422Ethernet, will be introduced. And what are the

differences between serial communication interface, RS-232 RS-485 RS-422.

Because all Advantech Serial Modules use RS-485 to communicate, the topology of

Advantech IAG Training Center (Internal Use Only)


14 Host PC Connection(Advanced)

RS-485 will be shown in 2.1.7. Finally, because both Serial and Ethernet Remote IO

modules support Modbus protocol, we will show you the Modbus Frame format. In

Chapter3, it will guide the users how to select the most suitable products for their

application. We will introduce you the RS-232 & RS-485 converter and the RS-485

Repeater. And introduce when you need RS-485 Repeater. Then we will show you the

features of Serial Remote IO modules and the powerful features of Ethernet Remote

IO modules. In Chapter4, the startup of the Remote data acquisition systems will be

introduced. And we will show you how to use Advantech ADAM .NET Utility to

configure Remote IO modules. And use utility to set the powerful function of Ethernet

Remote IO modules, Peer to Peer & GCL. Finally, we will show you the

communication protocol of Advantech Remote IO modules. In Chapter5, the software

for Advantech Remote IO modules will be introduced. We will show you what is OPC

Server and how to use Advantech OPC Server. Advantech supports an ADAM Class

Library for users to develop their application to communicate with Remote IO

modules. In this Chapter, we will introduce how to use this library and examples.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)15

Advantech IAG Training Center (Internal Use Only)


16 Host PC Connection(Advanced)

Chapter 2 Essential Concepts

Before learning about the Advantech Remote IO modules, you need to have

some basic knowledge of serial communication. In this chapter, you will learn what is

serial communication and the differences between RS-232/422/485.

2.1 Serial Communication

2.1.1 Communication Mode

Now, we will introduce 3 types of communication operation types Simplex,

Half-Duplex, and Full-Duplex communication.

Simplex Communication:

Figure 1-5 Simplex Communication

Data flow in a simplex channel is always in one way. Simplex channels are not

often used because it is not possible to send back error or control signals to the

transmit end. The examples of simplex are broadcasting, or Radio.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)17

Half-Duplex Communication:

Figure 1-6 Half-Duplex Communication

Half-duplex Mode provides for communication in both directions, sending and

receiving, but the two-way transmission can not take place simultaneously. Only one

end transmits at a time, the other end receives. The examples of half-duplex are talk-

back radio, RS-485.

Full-Duplex Communication:

Figure 1-7 Full-Duplex Communication

Full-duplex Mode allows communication in both directions, and unlike half-

duplex, allows this to happen simultaneously. In other words, the data can be

transmitted in two-way at the same time. There is no need to switch from transmit

mode to receive mode as in half duplex. The examples of full-duplex are RS-232, RS-

422, and telephone.

Advantech IAG Training Center (Internal Use Only)


18 Host PC Connection(Advanced)

2.1.2 Communication Interface

In the traditional way, for measuring the temperature, use DAC card and put a

sensor in the remote place. And use T/C wire to transmit dataFigure 1-1. Because

the distance between the sensor and DAC Card is too far and the data is transmitted

by analog signal, the signal will be interfered with noises or decay easily. Therefore,

users cannot measure the precise value as they wish.

Figure 1-8 Measure with a DAC Card

To solve the distance issue, we can utilize the Remote I/O modules nearby the

sensor. And between remote IO modules and PC, use some kind of communication

interface in which data is transmitted by digital signal.Figure 1-2

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)19

Figure 1-9 Measuring with a remote I/O module

The next section will show you three kinds of communication interface, RS-232

& RS-422 & RS-485. And explain why Advantech Serial Remote IO modules use RS-

485 to do the communication.

2.1.3 Communication Interface RS-232

The features of RS-232

No noise rejectionSingle-ended

Full-duplex Mode

Short transmission distancewithin 15m

Low transmission speedwithin 115.2kbps

Connected deviceonly 1

Advantech IAG Training Center (Internal Use Only)


20 Host PC Connection(Advanced)

Figure 1-10 RS-232


Single-ended is a method by which logic signals are transmitted over one Line.

One wire carries a varying voltage that represents the signal. The standard RS-232

uses one Line for Transmit and another Line for Receive. So RS-232 can transmit and

receive data at the same time. It is Full-duplex Mode.

Pin Assignment of RS-232 :

Basically, the pin assignment of RS-232 is standardized. Most of the

manufactories follow this standard to design their RS-232 serial COM ports.

Figure 3.1: RS-232 Pin Assignment

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)21

Transmitted Data (TxD): Data sent from DTE to DCE

Received Data (RxD): Data sent from DCE to DTE

Request To Send (RTS): DTE informs DCE of preparing for receiving data. DTE

will send RTS signal to DCE that it has data to send. DCE will take action to send

CTS (Clear To Send) signal or to reverse the direction of a half-duplex channel. For

the modern usage of RTS, please refer to the below RTS/CTS handshaking part.

Ready To Receive (RTR): The same ping with RTS. Asserted by DTE to indicate

DCE that DTE is ready to receive data.

Clear To Send (CTS): Claimed by DCE to inform RTS and to allow DTE

transmitting data. This signaling was originally used with half-duplex modems and by

slave terminals on multi-drop lines: The DTE would raise RTS to indicate that it had

data to send, and the modem would raise CTS to indicate that it is feasible to send.

Data Terminal Ready (DTR): Claimed by DTE to inform that it is ready to be

connected. If the DCE is a modem, this may "wake up" the modem, bringing it out of

a power saving mode. This behavior is usually applied to the modern PSTN and GSM

modems. When this signal is disclaimed, the modem will return to the standby mode,

immediately hanging up any calls in progress.

Data Set Ready (DSR): DCE will send DSR signal to indicate DCE has been

powered on and is ready to receive commands or data for transmission from the DTE.

Data Carrier Detect (DCD): Claimed by DCE when a connection has been

Advantech IAG Training Center (Internal Use Only)


22 Host PC Connection(Advanced)

established with remote equipment.

Ring Indicator (RI): Claimed by DCE when it detects a ring signal from the

telephone line.

Handshaking of RS-232 :

Two RS-232 devices can communicate with each other only by connecting Rx,

Tx, GND pins. The user can connect the rest of the pins to employ the hand-shaking

function to ensure the correction of the link between DCE and DTE. For example, by

employing RTS and CTS signals, DTE and DCE can confirm the status of each other

and then send/receive data in the correct time.

Figure 3.2: Hand-Shaking Wiring Diagram

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)23

2.1.4 Communication Interface RS-485

The features of RS-485

Noise rejection and cross wireDifferential

Half-duplex Mode

Long transmission distanceUp to 1200m

High transmission speedUp to 10Mbps

Connected device32 per segment, up to 255 totally

Figure 1-11 RS-485


Differential is a method of transmitting information electrically by means of two

complementary signals sent on two separate wires.

The main advantage of single-ended over differential is that fewer wires are

needed to transmit multiple signals.

Single-ended is less expensive to implement than differential, but its main

limitations are that. It lacks the ability to reject noise caused by differences in ground

voltage level between transmitting and receiving circuits. It lacks the ability to reject

Advantech IAG Training Center (Internal Use Only)


24 Host PC Connection(Advanced)

any noise that may be picked up on the signal wire.

Data Flow Control :

The RS-485 standard supports half-duplex communication. This means that both

two wires are needed to transmit and receive data. Handshaking signals (such as RTS,

Request To Send) are normally used to control the direction of the data flow.

However, a special I/O circuit in Advantechs RS-485 products ADAM-4520

& ADAM-4521 will automatically sense the direction of the data flow and switches

the transmission direction. No handshaking signal is necessary. So you can build an

RS-485 network with just two wires. This RS-485 control is completely transparent to

the user.

2.1.5 Communication Interface RS-422

The electrical specification of RS-422 is similar to RS-485 protocol.

The key differences between them are:

Noise rejection and cross wireDifferential

Full-duplex Mode

Long transmission distanceUp to 1200m

High transmission speed10 Mbit/s at 12 meters (40 ft)

Connected deviceup to 10

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)25

2.1.6 Communication Interface Comparison Table

The comparison table below shows the difference between RS-232RS-422RS-

485. Obviously, the advantages of RS-485 are better than RS-232 & RS-485. This is

the reason why Advantech Serial remote IO modules use RS-485.

Figure 1-12 Comparison table of RS232RS-422RS-485

2.1.7 Topology

RS-485 is industrys most widely used bidirectional, standard interface for serial

communication. It is developed for industrial multi-drop systems. Transmit and

receive data at high rates or over long distances across the differential signal line. 2-

wire transmission has some advantages : Save the wiring cost Easy to setup and

maintainCommunication is more reliable.

Advantech IAG Training Center (Internal Use Only)


26 Host PC Connection(Advanced)

Figure 1-13 RS-485 Multi-drop Connection

Data+ connects to Data+ in the next module

Data- connects to Data- in the next module

2.1.8 Termination Resistor

Figure 1-14 Termination Resistor


When the distance of RS-485 is too long or there are too many connected

modules in RS-485, it is need to put a terminal resistor ( 120 is suggested ) at the

both end of the RS-485.

Because when the data reach the end of RS-485, there will be a reflect signal,

and the reflect signal would be a noise signal which can influence the original signal.

The function of the terminal resistor is to eliminate the reflect signal.Figure 1-11

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)27

Figure 1-15 Reflect Signal

2.2 Ethernet Communication

2.2.1 What is Ethernet

Ethernet was originally developed at Xerox and then was standardized by the

DIX association. (Including DEC, Intel, and Xerox) Afterward, the DIX association

transferred the patent right to the IEEE (Institute of Electrical and Electronics

Engineers) and therefore the Ethernet was no long belong to one certain company.

Ethernet is a system consists of two or more autonomous computers/equipments

interconnected by transmission media (e.g., coaxial cable, fiber, twisted pair,

microwave, etc.). Ethernet originally used a shared coaxial cable (the shared medium)

winding around a building or campus to every attached machine. Ethernet utilizes

carrier sense multiple access with collision detection (CSMA/CD) to govern the way

the computers shared the channel. This scheme was simpler than the competing token

ring or token bus technologies. When a computer wanted to send some information, it

Advantech IAG Training Center (Internal Use Only)


28 Host PC Connection(Advanced)

used the following script:

100Mbps Ethernet :

100BaseTX uses twist pair to transmit data and requires high quality twist pair

(Cat. 5) because its signal frequency is higher than before (10Mbps). 100BaseTx is

the most common Network type so far.

2.3 Introduction to Modbus

It is 1979 when PLC manufacturer Modicon published the Modbus

communication interface for a multi-drop network based on a master/client

architecture. Communication between the Modbus nodes was achieved with

messages. It was an open standard that described the messaging structure. The

physical layer of the Modbus interface was free to choose, RS-232RS-485Ethernet.

The nice thing of the standard Modbus is the flexibility, but at the same time the

easy implementation of it. Not only intelligent devices like microcontrollers, PLCs

etc. are able to communicate with Modbus, also many intelligent sensors are equiped

with a Modbus interface to send their data to host systems. Advantech ADAM

modules also support Modbus protocol, While Modbus was previously mainly used

on wired serial communication lines, there are also extensions to the standard for

wireless communications and TCP/IP networks.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)29

2.3.1 Modbus Frame Format

It is important to understand the encapsulation of a Modbus request or response

carried. A complete command is consisted of command head and command body. The

command head is prefixed by six bytes and responded to pack Modbus format; the

command body defines target device and requested action. Following example will

help you to realize this structure quickly.

The following picture shows the Modbus Frame structure of Request command.

In the Command Body :

Byte 6 : Device Address.

Byte 7 : Modbus Function Code

Byte 8,9 : Start Address

Byte 10,11 : Request Number of read Register

Advantech IAG Training Center (Internal Use Only)


30 Host PC Connection(Advanced)

Figure 1-16 Request Structure

The following picture shows the Modbus Frame structure of Response Message.

Figure 1-17 Response Structure

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)31

In the command body, the definition of the function code as the picture below.

Figure 1-18 Modbus Function Code

For example :

Function Code 01

The function code 01 is used to read the discrete outputs ON/OFF status of a

ADAM module in a binary data format.

Request : 03 01 00 17 00 08

Read coil number 17 to 24 (Modbus Address number 00017 to 00024) from ADAM

module with Device Address =3

Figure 1-19 Request message format for function code 01

Response : 03 01 01 42

Advantech IAG Training Center (Internal Use Only)


32 Host PC Connection(Advanced)

Coils number 00018 and 00023 are on, all others are off.

In the response the status of coils status is shown as a byte value

42 hexadecimal, equal to 0100 0010 binary.

Figure 1-20 Response message format for function code 01

Function Code 03/04

The function code 03 or 04 is used to read the binary contents of input registers

Request : 01 04 00 01 00 02

Read Analog inputs #1 and #2 in Modbus Address 40001 to 40002 as floating point

value from ADAM module with Device Address=1

Figure 1-21 Request message format for function code 03 or 04

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)33

Response : 01 04 04 42 C8 AE 5D

Analog input #1 and #2 values where

AI#1=17096 ( Dec ) => 42 C8 ( Hex )

AI#2=44637 ( Dec ) => AE 5D ( Hex )

Figure 1-22 Response message format for function code 01

2.4 Summary

2.4.1 Architecture for Serial modules

In the Figure below, serial remote IO modules are placed in everywhere to do the

data acquisition and are connected by RS-485. There must be a central PC and

program running in this PC. The program controls these serial modules and monitor

data from them via RS-485.

Advantech IAG Training Center (Internal Use Only)


34 Host PC Connection(Advanced)

Figure 1-23 ADAM-4000 Serial IO modules Architecture

2.4.2 Architecture for Ethernet modules

ADVANTECH Ethernet Remote IO modules use Modbus/TCP to communicate.

The program made by users can access Advantech Ethernet modules through Ethernet

cable.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)35

Figure 1-24 ADAM-6000 Ethernet IO modules Architecture

2.5 Quiz

1. Why using Remote I/O Modules? Please write down at least 3 advantages .

2. Please make a comparison between RS-232 & RS-485?

3. Please list the feature of RS-485 communication.

4. Please draw the topology of RS-485. Daisy chain structure

5. Why using Remote I/O Modules? Please write down at least 3 advantages.

6. RS-485 uses multi-drop connection. When there is more than one device in the

RS-485 connection, how does the client identify each of the module?

7. Which situation do you need use Terminal Resistor?

8. What is the feature of Terminal Resistor ?

9. Please describe the characteristic of Half-Duplex.

Advantech IAG Training Center (Internal Use Only)


36 Host PC Connection(Advanced)

10. Please describe the characteristic of Full-Duplex.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)37

Chapter 3 Product Introduction

3.1 Serial-Based Modules

3.1.1 Converter and Repeater

ADAM-4520 : Isolated RS-232 to RS-485 converter :

It is the interface between PC RS-232 to RS-485 modules. It is Isolated between

PC and RS-485/power. Auto flow control for RS-485 communication.

Figure 3-25 RS-232 to RS-485 Converter

ADAM-4510 : RS-485 Repeater :

ADAM-4510 is needed when the number of connected modules is over 31 or the

length of RS-485 is over 1200m. It extends the RS-485 network nodes and the

distance for another 1200 m.

Advantech IAG Training Center (Internal Use Only)


38 Host PC Connection(Advanced)

Figure 3-26 RS-485 Repeater

ADAM-4521:Addressable RS-422/485 to RS-232 Converters :

If users want to connect a RS-232 Device into RS-485 network, they can use

ADAM-4521 converter as the picture below.

Because the most RS-232 device dont have address and the device on RS-485

network must have an address, use the addressable converter, ADAM-4521, to

represent the address of the RS-232 device.

The side of RS-232 and RS-485 can be set to different Baud Rate. It can be in

Addressable or non-addressable mode.

Figure 3-27 Addressable Converter

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)39

3.1.2 Robust Family

Serial Robust Family Features :

Wide Temperature Range

Wide Range Power Input

3000 VDC Isolation Protection

Power Surge Protection (500 VDC)

Robust Feature for Converters :

ADAM-4510S=> ADAM-4510I ( Robust )

ADAM-4520 => ADAM-4520I ( Robust )

ADAM-4520 ADAM-4520I

Anti-Noise Good Better

Auto-BaudRate No Yes

ADAM-4510S ADAM-4510I

Anti-Noise Good Better

RS-485 to RS-422 No Yes

Convert Ability

Auto-BaudRate No Yes

ADAM-41XX Robust Family IO Features :

Advantech IAG Training Center (Internal Use Only)


40 Host PC Connection(Advanced)

Configure Initial Mode by Switch

Channel Status Display

Node Address Display

Locate Function to Find Your Module

Firmware Updated by Utility

Dual Watchdog Timer

High Common Mode (4117, 4118)

Software Filter (4117, 4118)

Auto Optimized Working Frequency (4117, 4118)

Auto Noise Rejection @ 50/60 Hz (4117,4118)

Over Current and Temperature Shutdown (4150)

More Choice for DI and DO (4150)

Invert DI Status (4150)

Robust Family: More features for DI :

Normal On/Off Signal Input

Counter Input (32-bit, Overflow flag)

Frequency Input (3KHz)

Robust Family: More features for DO :

Normal On/Off Signal Output

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)41

Pulse Output

Delay Pulse Output (High Polarity)

Delay Pulse Output (Low Polarity)

3.2 Ethernet-Based Modules

There are some powerful functions in Ethernet IO modules, like built-in

WebServerIntelligent IOPeer to PeerGraphic Control Logic (GCL) function.

The next will introduce these powerful functions.

3.2.1 Built-in WebServer

ADAM-6000 I/O modules have built-in web server. Remote computer or devices

can monitor and control I/O status on ADAM-6000 modules remotely through web

browser. There is default built-in web page on ADAM-6000 modules.

Advantech IAG Training Center (Internal Use Only)


42 Host PC Connection(Advanced)

Figure 3-28 Web Page for Ethernet IO modules

3.2.2 Intelligent I/O

Upgraded from traditional I/O modules, the ADAM-6000 series have pre-built

intelligent mathematic functions to empower system capacity.

Intelligent I/O

DI : CounterFrequencyLow-to-High LatchHigh-to-Low Latch

DO : Pulse OuputLow-to-High DelayHigh-to-Low Delay

DI : Counter

One counter will count the pulse number of the digital signal from the selected

channel, and then record the count number in the register.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)43

DI : Frequency

ADAM-6000 digital module will calculate the frequency value of the digital

input signal from the selected channel.

DI : Low-to-High Latch

Once the digital input channel detects logic level changes from low to high, the

logic status will be keep as logic high. The logic status will remain the logic high,

until you clear latch manually. Then the logic status will back to logic low.

DI : High-to-Low Latch

Once the digital input channel detects logic level changes from high to low, the

logic status will be keep as logic low. The logic status will remain the logic low, until

you clear latch manually. Then the logic status will back to logic high.

DO : Pulse Ouput

The pulse output is the same as PWR. The DO channel can generate continuous

pulse train or finite pulses. You can define the pulse width.

DO : Low-to-High Delay

It is almost the same as choosing the DO mode. The only difference is that there

will be certain time delay when the output value changes from logic low to logic high.

Advantech IAG Training Center (Internal Use Only)


44 Host PC Connection(Advanced)

Refer to the picture below for its process. Users can define the delay time.

Figure 3-29 Low-to-High Delay

DO : High-to-Low Delay

It is almost the same as choosing the DO mode. The only difference is that there

will be certain time delay when the output value changes from logic high to logic low.

Refer to the picture below for its process. Users can define the delay time

Figure 3-30 High-to-Low Delay

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)45

3.2.3 Peer-to-Peer & GCL

In a traditional control and data acquisition system, there must be a computer

(or a controller, such as PLC) responsible to get the data from the input

modules(Ethernet modules), manipulate the data, execute logic operation and process

depending on the input data, and generate output data to the output modules(Ethernet

modules) based on the logic decision.

Peer to Peer & Graphic Logic Condition (GCL). These two features make the

ADAM-6000 modules become a smart I/O module that it can play as a standalone

control system. So it doesnt need PC controller and PLC any more. ADAM-6000

modules with these two features can do the logic operation and control other modules

directly.

Users dont need to program the logic rule into ADAM-6000 modules. The

configuration environment for Peer to Peer & GCL in ADAM.NET Utility is

completely graphical, making it very easy and intuitive to complete the logic rule

configuration.

3.3 Product Selection

Naming Rules of ADAM-4000 I/O Modules :

Advantech IAG Training Center (Internal Use Only)


46 Host PC Connection(Advanced)

41XX: Robust Family for RS-485 I/O modules

411X: Analog Input modules

415X: Digital I/O modules

416X: Relay Output modules

40XX: General purpose for RS-485 I/O modules

401X: Analog Input modules

402X: Analog Output modules

405X: Digital I/O modules

406X: Relay Output modules

4080: Counter/Freq modules

Serial Product Table :

AI ADAM-4011 1-ch Thermocouple Input Module


ADAM-4012 1-ch Analog Input Module
ADAM-4013 1-ch RTD Input Module

ADAM-4015 6-ch RTD Module with Modbus

ADAM-4017+ 8-ch Analog Input Module with Modbus

ADAM-4018+ 8-ch Thermocouple Input Module with Modbus

ADAM-4019 8-ch Universal Analog Input Module with Modbus


ADAM-4117 Robust 8-ch Analog Input Module with Modbus

ADAM-4118 Robust 8-ch Thermocouple Input Module with Modbus

AO ADAM-4021 1-ch Analog Output Module

ADAM-4024 4-ch Analog Output Module with Modbus


DI ADAM-4051 16-ch Isolated Digital Input Module with Modbus
ADAM-4052 8-ch Isolated Digital Input Module

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)47

ADAM-4053 16-ch Digital Input Module


DO ADAM-4050 15-ch Digital I/O Module

ADAM-4055 16-ch Isolated Digital I/O Module with Modbus


ADAM-4060 4-ch Relay Output Module

ADAM-4068 8-ch Relay Output Module with Modbus

ADAM-4069 4-ch Power Relay Output Module with Modbus


ADAM-4150 Robust 15-ch Digital I/O Module with Modbus
ADAM-4168 Robust 8-ch Relay Output Module with Modbus
Counter/ ADAM-4080 2-ch Counter/Frequency Module

Frequency

Naming Rules of ADAM-6000 I/O Modules :

Ethernet I/O modules

601X: Analog Input modules

602X: Analog Output modules

605X: Digital I/O modules

606X: Relay Output modules

Ethernet Product Table :

AI ADAM-6015 7-ch Isolated RTD Input Module


ADAM-6017 8-ch Analog Input with 2-ch Digital Output Module
ADAM-6018 8-ch Isolated Thermocouple Input with 8-ch DO Module
AO ADAM-6022 Ethernet-based Dual-loop PID Controlller

ADAM-6024 12-ch Isolated Universal Input/Output Module


DI/O ADAM-6050 18-ch Isolated Digital I/O Module
ADAM-6051 14-ch Isolated Digital I/O with 2-ch Counter Module

ADAM-6052 16-ch Source Type Isolated Digital I/O Module

Advantech IAG Training Center (Internal Use Only)


48 Host PC Connection(Advanced)

Relay ADAM-6060 6-ch Digital Input and 6-ch Relay Module

ADAM-6066 6-ch Digital Input and 6-ch Power Relay Module

3.4 Quiz

1. What are the features of ADAM-4100 series? Please write down at least 3

features

2. Please shortly describe what Peer to peer function is in ADAM-6000 control

mode?

3. Please shortly describe what GCLGraphical Control Logicis? Please write

down at least 3 features.

4. For a series of remote I/O modules through RS-485, Is it possible that the

number of device on RS-485 network is over 32 ? If yes, how to do it ?

5. What are the features of intelligent I/O of ADAM-6000 series modules?

6. If customers application simply used DI to trigger DO through Ethernet, which

kind of modules of which kind of function do you suggest

7. The digital input of ADAM-6050/6051/6052 does NOT have

(a) Counter (b) DI (c) Frequency (d) PWM function

8. Please write down one condition when it is need to use a repeater ADAM-

4510on RS-485 network

9. In which situation do you need ADAM-4521 rather than ADAM-4520 ?

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)49

10. In which situation do you need use RS-485 repeater, ADAM-4510 ?

Advantech IAG Training Center (Internal Use Only)


50 Host PC Connection(Advanced)

Chapter 4 Getting Started

4.1 Resource on the WebSite

For ADAM products, Advantech supports ADAM .NET Utility for users to

configure and use ADAM products. On Advantech website, you could get many

helpful things, for example, Driver Manual Utility and so on.

http://support.advantech.com.tw/support/default.aspx

Figure 4-31 Download on the web


Please install the ADAM .NET Utility first. When you got ADAM Serial or

Ethernet IO modules first time, the below will show you how to configure and use

them.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)51

4.2 ADAM-4000 Configuration and Utility

4.2.1 Hardware Wiring

You need to prepare a pin-to-pin RS-232 cable and a RS-232/485 Converter,

for example, ADAM-4520. About the wiring of ADAM serial modules, please follow

the Multi-Drop connection.

Figure 4-32 Multi-Drop in RS-485

Data+ connects to Data+ in the next module

Data- connects to Data- in the next module

Every module on RS-485 has an unique addressID. So if you got several

ADAM-4000 series modules, in order to void the address conflict, dont put all of

them on RS-485 at the same time.

1. You need put only one module in the initial mode on RS-485 and set an

address to this module and then set back to normal mode.

2. Next, you could connect another module in the initial mode on RS-485

and set an unusable address to this module and then set back to normal

Advantech IAG Training Center (Internal Use Only)


52 Host PC Connection(Advanced)

mode.

3. You could apply the procedure 2 to the other modules.

The following section will introduce you how to search modulesinitial modules

and set the address by using ADAM .NET Utility along with some utility

configuration.

4.2.2 Initial Modules

When you want to configure some settings of a module or if not knowing the

Baud Rate of the module, please let the module into the initial mode. There are two

ways to let a module into the initial mode. Once you change the switch or short the

INIT* and GND pin, remember reset the module. Whenever one module is in the

initial mode, the address will be zero. On RS-485 network, just only one module can

be set to initial mode because of the address conflict issue.

Figure 4-33 Initial Module

4.2.3 Search Modules

In the ADAM .NET Utility, you could choose one COMPort and configure the

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)53

COMPort setting and then click the search button to find modules on RS-485.

Figure 4-34 Search Modules-1

The found modules will be list under the COMPort item. You could stop

searching at any time.

Advantech IAG Training Center (Internal Use Only)


54 Host PC Connection(Advanced)

Figure 4-35 Search Modules-2

If one module is in the initial mode, there is a star sign(*) in the address section.

Some settings can be allowed to configure only when the module is in the initial

mode.

Figure 4-36 In the Initial Mode

4.2.4 IO Configuration

AI :

For AI modules, users can change the input range for every channel and get the

AI data in the utility.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)55

Figure 4-37 AI Modules Configuration

AO :

For AO modules, users can change the output range for every channel and

change the output value in the utility.

Advantech IAG Training Center (Internal Use Only)


56 Host PC Connection(Advanced)

Figure 4-38 AO Modules Configuration

DI/O :

For DI/O modules, users can read the DI status and control the DO ON/OFF.

For WDT function, take the following picture as an example. If there is no any

connection with ADAM-4055 over 10 seconds WDT Timeout the DO4 and

DO5FSV checkedwill be triggered.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)57

Figure 4-39 DIO Modules Configuration

4.2.5 Advanced Setting--Trend and Data Logging

For AI Modules, ADAM .NET Utility offers a function of drawing Trend and

logging AI data to files. You can see the graphical historical trend by clicking the

Trend Log button. Simply choose the check box of the channels you want to log in the

Channel Setting area at right side.

Advantech IAG Training Center (Internal Use Only)


58 Host PC Connection(Advanced)

Figure 4-40 Trend Function-1

And then click the Apply button. After that, click the Start button and the data

log will start. You can see the real-time historical trend. If you click the Stop button,

then you can click the Save to file to save the trend data into your computer.

Figure 4-41 Trend Function-2

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)59

4.2.6 Advanced Setting--Calibration

For AIO modules, you could use utility to calibrate the module only when the

module is in the initial mode. In the top right-hand corner of the Status Display area

is the Calibration area. The calibration procedure isZero calibrationSpan

calibrationCJC calibration. Before doing Calibration action, we suggest

preparing an accurate device first which can output accurate voltage or current.

Figure 4-42 Calibration

You can choose the Zero Calibration button to do zero calibration. After you

click the button, a pop-up dialog window will remind you. After you complete the

hardware wiring and send a signal with minimum value of full scale range (for

example, 0mV) to the Channel 0, click the Apply button to start the calibration action.

Figure 4-43 Zero Calibration

Advantech IAG Training Center (Internal Use Only)


60 Host PC Connection(Advanced)

Similarly, choose the Span Calibration button to do span calibration. For span

calibration, after you send a signal with maximum value of full scale range (for

example, 15mV) to the Channel 0, click the Apply button to start the calibration

action.

Figure 4-44 Span Calibration

The CJC Calibration is only for temperature measuring. For voltage or current

measuring, you don't need to do the CJC Calibration. The CJC Calibration helps you

to slightly tune the temperature available by the module. For example : you are

measuring the water temperature by using Channel 0 and you are supposed to get the

30. But the utility gets the temperature, 28.8 from Channel 0. In this situation,

you could use 1.2 in CJC Calibration to adjust.

Figure 4-45 CJC Calibration

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)61

4.2.7 Practice

Object :

In the same RS-485 network, use a DI channel to detect a DO status in another

module.

DI is in ADAM-4051 with Address 01.

DO is in ADAM-4055 with Address 02.

Procedure :

1. Put an ADAM-4051 to the RS-485 network.

2. Initial the module and then re-power ADAM-4051

Figure 4-46 Initial ADAM-4051

3. Use ADAM .NET Utility to search ADAM-4051 and set Address to 1.

Advantech IAG Training Center (Internal Use Only)


62 Host PC Connection(Advanced)

Figure 4-47 Set ADAM-4051 Address

4. Set ADAM-4051 back to normal mode.

ps. When you change the mode, remember to re-power the module.

5. Put an ADAM-4055 to the RS-485 network.

6. Initial the module and then re-power ADAM-4055

7. Set the Address to 2.

8. Set ADAM-4055 back to normal mode.

9. Hardware Wiring

Figure 4-48 Hardware Wiring

10. Use the utility to change DO in ADAM-4055

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)63

Figure 4-49 Change the DO

11. Use the Utility to monitor the DI Status in ADAM-4051

Figure 4-50 Monitor the DI

4.3 ADAM-6000 Configuration and Utility

4.3.1 Hardware Wiring

Connect an Ethernet cable into ADAM-6000 modules. Let ADAM-6000 modules

and your PC in the same Sub-Network.

Or you could use cross-over Ethernet cable to connect a ADAM-6000 module

and your PC directly.

Advantech IAG Training Center (Internal Use Only)


64 Host PC Connection(Advanced)

Note: If network Firewall is enabled on your computer, you may not be able to

connect with your ADAM-6000 module. Please disable the Firewall temporarily.

4.3.2 Search Modules

You can find ADAM-6000 modules by using ADAM.NET Utility. Launch

ADAM.NET Utility. Select the ADAM5000TCP_6000 item on the Module Tree

Display area. Click the Search Modules button on the Toolbar.

Figure 4-51 Search Ethernet modules

ADAM.NET Utility will then search all ADAM-6000 modules in the same

Subnet with your PC. If your ADAM-6000 modules are used first time, its IP will

be 10.0.0.1 by default. So you will find it showing on the others item under

ADAM5000TCP_6000. You need to change IP of the ADAM-6000 modules the same

subnet with the host PC. Type the correct IP address, Subnet address, and Default

gateway on the Status Display area. After complete setting, click the Apply Change

button. A dialog box appears asking you to type the password. The default password

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)65

of ADAM-6000 module is 00000000.

Figure 4-52 Default setting

When you select the IP address of the ADAM-6000 modules you want to use in

Module Tree Display area, there will be 8 tabs appearing in the Status Display area for

you to set up general configuration of that module. Refer to figure below. Once you

have changed any configuration, remember to click related Apply or Apply Change

button. You can see the Firmware Version on the selected ADAM-6000 module in this

tab. You also can change the Device Name and Device Description.

Figure 4-53 Module information

Advantech IAG Training Center (Internal Use Only)


66 Host PC Connection(Advanced)

4.3.3 Advanced Search Modules

When an ADAM-6000 module is not in the same Subnet with your PC, the

ADAM utility can not find the module automatically. If your PC still can PING the

ADAM-6000 module on Internet, in the ADAM utility, you could find the module

manually.

Figure 4-54 Add Remote Devices-1

Figure 4-55 Add Remote Devices-2

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)67

4.3.4 Network Setting

If necessary, you still can change IP Address, Subnet Address, and Default

Gateway of selected ADAM-6000 module in this tab. Any application using TCP to

communicate with the ADAM-6000 module will occupy at least one connection. The

maximum number of TCP connections of one ADAM-6000 module is 8.

The Host Idle (Timeout) text box is used for TCP connection timeout. If there is

no communication for one connection after a specific timeout interval, ADAM-6000

module will close that connection and release it to others. Without this feature, when

the number of TCP connection exceeds the maximum number (namely 8), no more

other application can connect to the ADAM-6000

Figure 4-56 Network Setting

4.3.5 IO Configuration

AI :

If you want to measure voltage or current, you need to not only set the input

Advantech IAG Training Center (Internal Use Only)


68 Host PC Connection(Advanced)

range of channels by using ADAM Utility but also adjust the jumper inside the

module.

Figure 4-57 AI Jumper Setting

Figure 4-58 AI Setting For Ethernet Modules-1


Channel Setting

You can see the current value of analog input on this tab. Simply choose the

check box of the channels you want to monitor and click the Apply button.

Besides, you can see the graphical historical trend by clicking the Trend

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)69

Log button.

Average Setting

ADAM-6015, ADAM-6017 and ADAM-6018 modules feature averaging

calculation function by its built-in processor. You can simply click the

check boxes to decide which channels are used for averaging.

Modbus (Current)

You can see current analog input value in decimal, hexadecimal, and

engineer unit for all related Modbus address.

Modbus (Max)

You can see historical maximum analog input value in decimal, hexadecimal.

Modbus (Min)

You can see historical minimum analog input value in decimal, hexadecimal.

Individual Channel Configuration

Figure 4-59 AI Setting For Ethernet Modules-2

Advantech IAG Training Center (Internal Use Only)


70 Host PC Connection(Advanced)

Built-in alarm function. When the analog input value is higher than the high

alarm value, or lower than the low alarm value, the alarm condition occurs. Then the

alarm status will be activated to logic high.

AO :

If you want to ouput voltage or current, you need to not only set the input

range of channels by using ADAM Utility but also adjust the jumper inside the

module.

Figure 4-60 AO Jumper Setting

The following picture shows you how to configure the AO Channels.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)71

Figure 4-61 AO Setting For Ethernet Modules

DI :

Individual DI Channel Setting

DI

Advantech IAG Training Center (Internal Use Only)


72 Host PC Connection(Advanced)

Figure 4-62 Individual DI Channel Configuration


Click the Enable digital filter check box. If you enable the filter, you can define

the minimum acceptable signal width by the Minimum low signal width and

Minimum high signal width text box.

Counter

One counter will count the pulse number of the digital signal from the selected

channel, and then record the count number in the register.

Low to High Latch

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)73

Once the digital input channel detects logic level changes from low to high, the

logic status will be keep as logic high. The logic status will remain the logic high,

until you clear latch manually. Then the logic status will back to logic low.

High to Low Latch

Once the digital input channel detects logic level changes from high to low, the

logic status will be keep as logic low. The logic status will remain the logic low,

until you clear latch manually. Then the logic status will back to logic high.

Frequency

ADAM-6000 digital module will calculate the frequency value of the digital

input signal from the selected channel.

DO :

Figure 4-63 DI Setting For Ethernet Modules


You can see value of all digital input channels by related LED display in this tab.

Advantech IAG Training Center (Internal Use Only)


74 Host PC Connection(Advanced)

Besides, you also can control values of all digital output channels by related button.

WDT Function

You can enable or disable this function by click the Turn on WDT checked

channel when WDT triggered check box. You can define the fail safe value by the

WDT check box next to the DO status LED.

If the communication between ADAM-6000 digital module and host PC is

broken, channels 0 and 2 will automatically generate logic high value, while

channels 1, 3, 4, 5 will automatically generate logic low value.

Pulse Output

The pulse output is the same as PWR. The DO channel can generate continuous

pulse train or finite pulses. You can define the pulse width. You can define the pulse

width by entering into the Low signal width and High signal width text box in the

Setting area.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)75

Figure 4-64 Low-to-High Delay

Low-to-High Delay

It is almost the same as choosing the DO mode. The only difference is that

there will be certain time delay when the output value changes from logic low to

logic high. Refer to the picture below for its process. Users can define the delay

time.

Figure 4-65 Low-to-High Delay

Advantech IAG Training Center (Internal Use Only)


76 Host PC Connection(Advanced)

High-to-Low Delay

It is almost the same as choosing the DO mode. The only difference is that

there will be certain time delay when the output value changes from logic high to

logic low. Refer to the picture below for its process. Users can define the delay time

Figure 4-66 High-to-Low Delay

4.3.6 Advanced Setting--Password

In this tab, you can set up password for a selected ADAM-6000 module. You

need to type current password in theOld password text box, and the new password

in theNew password and Verify password text box. There will be many

configuration and operation action asking user to type password, so this can help to

ensure safety.

Note: The default password is 00000000

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)77

Figure 4-67 Change Password

4.3.7 Advanced Setting--Access Control

You can decide which computers or devices have the ability to control this

ADAM-6000 module in this tab. Select the IP Address or MAC Address radio button

to decide the identified method.

In the Security IP/MAC Setting area, you can direct type the IP or MAC address

of the authorized computers or devices. Remember to click the Enable/Disable check

box. Take the following picture as example, only the computer (or device) with IP

Address 172.18.3.52 or 172.18.3.116 can have the authority to control this ADAM-

6000 module.

Figure 4-68 Access Control

Advantech IAG Training Center (Internal Use Only)


78 Host PC Connection(Advanced)

4.3.8 Advanced Setting--Firmware Update

Advantech will continuously release new version of firmware to add or improve

functionality of ADAM-6000 modules. You can download the latest version of

firmware on the Advantech website. There should be three files with different file

extension: .bin, .html and .jar.

The file with .bin extension is the firmware itself. And the two files with .html

and .jar extension are for the Web Server on the ADAM-6000 module.

In this tab, you can upgrade the downloaded firmware to your ADAM-6000

module. Click Upgrade button to download the firmware into the ADAM-6000

module.

Figure 4-69 Firmware Update

4.3.9 Practice

Object :

Use AO in ADAM-6024 to output voltage into an AI channel in ADAM-6017.

Procedure :

1. Let PCADAM-6024ADAM-6017 in the same sub-network.

2. Turn off the firewall in PC.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)79

3. Use ADAM .NET Utility to search ADAM-6024 & 6017

Figure 4-70 Search Ethernet modules


4. Set unique IP for ADAM-6024 & 6017

Figure 4-71 Network Setting


5. AIO Wiring

Figure 4-72 AIO Wiring

Advantech IAG Training Center (Internal Use Only)


80 Host PC Connection(Advanced)

6. Use ADAM .NET Utility to configure AO channel & control output value.

Figure 4-73 AO Setting

7. Use ADAM .NET Utility to configure AI channel & monitor input value.

Figure 4-74 AI Setting

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)81

4.4 ADAM-6000 Powerful Function(Advanced)

4.4.1 Data Stream

ADAM-6000 modules can actively send its data to Hosts periodically. It is called

Data Stream. The left side of the picture below shows the traditional method. The

program running in PC uses polling method to get data from ADAM-6000 modules.

And the right side picture shows the Data Stream method, in which ADAM-6000

modules can actively send its data to the program in PCs.

Figure 4-75 DataStream

In this tab, you can define IP address of the Hosts receiving the data transferred

by ADAM-6000 modules, as well as the period how often ADAM-6000 modules will

send data to the Hosts. In the picture below, the module send data to PC with

IP172.18.2.19every 999 millisecond.

Note: When you enable GCL function, Data Stream function will automatically

Advantech IAG Training Center (Internal Use Only)


82 Host PC Connection(Advanced)

be disabled until you disable GLC function.

Figure 4-76 DataStream Setting

In your PC, ADAM Utility also offers the function of monitoring the Data sent

from ADAM-6000 modules.

Figure 4-77 Monitor DataStream

4.4.2 Peer to Peer

Unlike master/client mode, peer to peer enable modules will actively update

input channel status to specific output channels. There will be a pair of modules: one

input and one output module.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)83

In the traditional way, users must write a program running in PC. And the

program is polling the hardware data continuously. Once the program detect that the

data is changed, it will send commands to another device to control the output.

Figure 4-78 Traditional Method

In P2P function, ADAM modules can update the Input status to Output channel

automatically. There is no need for a controller and users dont need to make a

program any more.

Figure 4-79 Peer to Peer


There are two modes, Basic & Advanced Mode, for Peer to Peer function. The

next will show you how to configure the function by using ADAM .NET Utility.

Basic Mode :

The input channels of the Source Device will be mapping to the output channels

of the Target Device. The target device is another ADAM-6000 module. In other

Advantech IAG Training Center (Internal Use Only)


84 Host PC Connection(Advanced)

words, the value of the input channels of the Source will automatically update to

output channels of the Target. In Basic Mode, it is one to one mapping like the picture

below

Figure 4-80 Basic mode : One to One Mapping

1. Enable the Peer to Peer function

Select an ADAM-6000 module First.

Figure 4-81 Enable Peer to Peer Function

2. Configure the Peer to Peer setting

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)85

Figure 4-82 Basic Mode Setting-1


The period time is the value of the input channel will be updated to the target

devices with the defined period.

The value of the input channel will still be updated to the target devices

with the defined period. Moreover, when C.O.S is checked, the value of the input

channel will also update to the target devices immediately.

Take the upper picture as example, if Channel 0,2,4 is enabled, it means that DI

0,2,4 will control DO 0,2,4 separately in destination, otherwise, it will do nothing.

Enable/Disable channels
Save your setting to an outer file
Load setting from the file
Apply all setting into the module

Advanced Mode :

In Advanced Mode, the destination can be different devices. Several Input

Advantech IAG Training Center (Internal Use Only)


86 Host PC Connection(Advanced)

Channels can be mapped to a single Output channel. But one Input Channel is not

allowed to be mapped to several Output Channels.

Figure 4-83 Advanced Mode Setting

Setting Information List : take the upper picture as example

DI2 control DO3 in destination module.

Destination is ADAM-6060 with IP:172.18.2.97

Configure single channel into Setting Informatin List


Apply all setting into the module
Configure into Setting Informatin List

4.4.3 GCL Function

GCL is the abbreviation of Graphic Condition Logic, gives Ethernet I/O modules

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)87

control ability. Users can define the control logic rules through graphical

configuration environment in ADAM.NET utility and download defined logic rules to

specific Adam-6000 Ethernet modules. Then that Ethernet module will execute the

logic rules automatically just like a standalone controller.

Below the GCL Menu area is the Logic Rule Set area. There are 16 logic rules

available on one ADAM-6000 module. Users just need set the GCL rules in Source

Module.

Figure 4-84 GCL Configuration Environment

There are four stages for one logic rule: Input Condition, Logic, Execution and

Output.

Advantech IAG Training Center (Internal Use Only)


88 Host PC Connection(Advanced)

Figure 4-85 Four Stages for One Logic Rule

Input Condition Stage :

The Input Condition stage is a logic condition decision for the input data.

Figure 4-86 Input Condition

Logic Stage :

For each logic rule, there will be at most three input conditions passing logic

True or False values to the Logic stage here. The logic operation will process the input

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)89

logic values, and generate a logic result value to the next Execution stage.

Figure 4-87 Logic Stage

Execution Stage :

The Execution_Period will pass result of Input condition to the Output stage

every the specific period.

Figure 4-88 Execution Stage

SendToNextRule :

There are only three input conditions in one rule. Users can

useSendToNextRuleto increase the input condition. When you

Advantech IAG Training Center (Internal Use Only)


90 Host PC Connection(Advanced)

useSendToNextRulefunction, you can set output of one logic rule being input of the

next logic rule. Please note it can only combine two logic rules which are next to each

other on the same module.

Figure 4-89 SendToNextRule

Output Stage :

The logic result value from the Execution stage will be passed to the three

outputs. And the three outputs will have different action depend on the logic result

value.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)91

Figure 4-90 Output Stage

The destination can be chosen and LocalRemote. Local meaning the

output is on the same module.

Figure 4-91 Local & Remote Ouput

After you complete your GCL, dont forget to enable the rules you want to

use and download the GCL Setting into the ADAM module.

Advantech IAG Training Center (Internal Use Only)


92 Host PC Connection(Advanced)

Figure 4-92 Enable & Download

ADAM Utility also offers the Online Monitoring function. Users can see the

execution situation on the Individual Logic Rule Configuration area.

Figure 4-93 Online Monitor

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)93

4.4.4 Practice

Object :

Use the DI0=ON & DI1=ON in a source ADAM-6050 to trigger the DO in a

destination ADAM-6050. Execution Period = 500ms.

For Example : Source ADAM-6050 with IP 172.18.2.82.

Destination ADAM-6050 with IP 172.18.2.83

Procedure :

1. Let PCsource & destination ADAM-6050 in the same sub-network.

2. Turn off the firewall in PC.

3. Use ADAM .NET Utility to search source & destination ADAM-6050.

Figure 4-94 Search Ethernet modules


4. Enter the GCL Setting Area

Advantech IAG Training Center (Internal Use Only)


94 Host PC Connection(Advanced)

Figure 4-95 Enter GCL Setting


5. Configure Input condition

Figure 4-96 Configure Input condition

6. Configure Logic Stage

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)95

Figure 4-97 Configure Logic Stage


7. Configure Execution Stage

Figure 4-98 Configure Execution Stage


8. Configure Output condition

Figure 4-99 Configure Output condition

Advantech IAG Training Center (Internal Use Only)


96 Host PC Connection(Advanced)

9. Enable the rule and download GCL Setting to Source Module

Figure 4-100 Enable the rule and download GCL Setting to Source Module
10. Run the GCL rule in the source module.

Figure 4-101 Configure Output condition

11. Monitor the operation of the rule in the source module.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)97

Figure 4-102 Configure Output condition

Advantech IAG Training Center (Internal Use Only)


98 Host PC Connection(Advanced)

4.5 Communication Protocols

4.5.1 ASCII commands for Serial Modules

When the ADAM-4000 Serial IO modules are in Advantech Protocol, users can

send ASCII commands to modules to communicate with modules. About how to

change the protocol, please refer to the Chapter 4.2.2 & 4.2.3.

For Example :

$AAM : Return the module name. AA means the address of the module.

$AAF : Return Firmware version. AA means the address of the module.

For more ASCII Command format, you could refer to the ADAM-4000 Manual

on the website.

Figure 4-103 ASCII Command for Serial Modules

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)99

4.5.2 Modbus/RTU for Serial Modules

When the ADAM-4000 Serial IO modules are in Modbus Protocol, users can

communicate with modules through Modbus. About how to change the protocol,

please refer to the Chapter 4.2.2 & 4.2.3.

The modbus address for Digital Channels is coil and starts with 0.

The modubs address for Analog Channels is register and starts with 4.

0X : Read/Write Coil (DI/DO) => Occupy 1 bit

1X : Read coil (DI) => Occupy 1 bit

3X : Read register (AI) => Occupy 1 word ( 2 bytes )

4X : Read/Write register (AI/AO) => Occupy 1 word ( 2 bytes )


Figure 4-104 Modbus Reference Address

The following pictures show how to get the modbus information by using ADAM

.NET Utility.

Advantech IAG Training Center (Internal Use Only)


100 Host PC Connection(Advanced)

Figure 4-105 Modbus/RTU for Serial DIO Modules

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)101

Figure 4-106 Modbus/RTU for Serial AIO Modules

4.5.3 ASCII commands for Ethernet Modules

Users can send ASCII commands to ADAM Ethernet modules through UDP with

port 1025. ADAM Utility also supports an interface for users to send ASCII

commands to ADAM Ethernet modules. But users cant use Hyperterminal to do it. If

users want to make a program to send ASCII Commands, they can open Socket and

use UDP protocol, port 1025, to do it.

Figure 4-107 ASCII Commands for Ethernet Modules

4.5.4 Modbus/TCP for Ethernet Modules

Users also can communicate with ADAM Ethernet modules through

Modbus/TCP and users dont need to change the protocol setting.

The modbus address for Digital Channels is coil and starts with 0.

The modubs address for Analog Channels is register and starts with 4.

Advantech IAG Training Center (Internal Use Only)


102 Host PC Connection(Advanced)

The following pictures show how to get the modbus information by using ADAM

.NET Utility.

Figure 4-108 Modbus/TCP for Ethernet DIO Modules

Figure 4-109 Modbus/TCP for Ethernet AIO Modules

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)103

4.6 Quiz

1. Which protocols can be used to communicate with Adam Remote I/O modules?

2. Which Modbus address can Not be used for Digital data in ADAM Remote I/O

modules. (a) 20002 (b) 40005 (c) 00004 (d) 00001

3. When communicate through Modbus RTU protocol, which is not the basic item

need to know? (a) ID (b) Function code (c) Modbus Address (d) Port number

4. If the customer gets an old Adam-4017+, he wants to change its ID but dont

know the baud rate is. What kind of mode he/she need to setup in hardware

before using the utility to change the address of the module? Please shortly

describe down the procedure.

5. GCL function can be simply configured in Adam.Net utility. Setup a logic rule

including 4 parts; which are Input, Logic, Execution and Output, please short

describe what the function in each one.

6. When customer first time use our adam-4000 series module, what would you

suggest customer to test the module?

7. If one customer sends ASCII commands to ADAM-4000 serial modules, what

kind of protocol is using?

8. Is it possible for there to be more than one module in the initial mode at the same

time in RS-485? Please explain your answer.

Advantech IAG Training Center (Internal Use Only)


104 Host PC Connection(Advanced)

-------------------------------------------Hands-On Exam--------------------------------------

9. Change the Baud-Rate and ID address of Adam-4000 modules.

10. GCL Function => AI and DO (in ADAM-6017) trigger DO in another module.

! Note: Period time setting to 2000ms

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)105

Advantech IAG Training Center (Internal Use Only)


106 Host PC Connection(Advanced)

Chapter 5 Host PC

Connection(Advanced)

5.1 OPC Sever

OPC is an acronym for OLE for Process Control. It is an industry standard

introduced by Microsoft based on DCOM. OPC Server is a software interface for

applications to access data from any data source like a hardware device. In other

words, OPC Server is an interface between hardware device and software applications

on PC. Some SCADA software running in PC can not get data from devices directly.

So use an OPC Server to get data from hardware device and pass data to SCADA

software.

Figure 5-110 OPC Server Architecture

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)107

The ADAM OPC Servers support three communication protocols, including

Advantech ASCII Command MODBUS/RTU and MODBUS/TCP protocol. You

could get Advantech OPC Server with trial version from Advantech Web Site.

Figure 5-111 Get OPC Server

The ModbusTCP OPC Server is used for Ethernet communication and the others

are for serial port communication.

5.1.1 Modbus/TCP OPC Server

The following procedure will show you how to use Modbus TCP OPC Server.

1. Create a new project

Advantech IAG Training Center (Internal Use Only)


108 Host PC Connection(Advanced)

Figure 5-112 OPC Server-Create a new project

2. Add a new Device

Figure 5-113 OPC Server-Add a new Device

3. Connection Setting

Figure 5-114 OPC Server-Connection Setting

4. Add a Data Item

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)109

Figure 5-115 OPC Server-Add a Data Item

5. Monitor the value

Figure 5-116 OPC Server-Monitor the value

5.1.2 Using OPC Client ( ADAM OPC Browser)

The AdamOPC Browser provided with the ADAM OPC Servers, has rapid

methods for connecting your OPC Servers. The OPC Client is able to browse the

registry of a PC and display a complete list of all installed OPC Servers. It also

provides real live data feedback and OPC Server browsing capabilities.

Select OPC DA Monitor node and click right mouse button to add OPC Server.

Advantech IAG Training Center (Internal Use Only)


110 Host PC Connection(Advanced)

Figure 5-117 OPC Client setting-1


User can choose target DA server under local PC or other local network PCs. If

you would like choose the server under local network, you have to make sure the

DCOM communication security setting of OPC server and client between two

computers.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)111

Figure 5-118 OPC Client setting-2


After choosing the server, you can add group to create subscription and items of

the OPCserver. Then select target group node, the data items states are showed in the

right list view.

Figure 5-119 OPC Client setting-3


You can pick the tags by double click the left mouse button. Then click OK.

Advantech IAG Training Center (Internal Use Only)


112 Host PC Connection(Advanced)

Figure 5-120 OPC Client setting-4

5.2 Programming--ADAM .NET Class Library

.NET programming is the trend and becoming more and more popular

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)113

programming tool for developers. Advantech supports a library named ADAM .NET

Class Library. ADAM .NET Class Library is a free library for users to develop their

program in Microsoft Visual Studio 2003/2005 to communicate with ADAM Remote

IO modules through Serial or Ethernet.

The picture below shows the ADAM .NET Class Library Software Architecture.

This library is base on Microsoft .NET Framework.

Figure 5-121 Software Architecture

You could download ADAM .NET Class Library from Advantech Website.

( Refer to Chapter 4.1 ). Before installing the library, we suggest you should install

Microsoft Visual Studio 2003 or 2005 first. After installing the library, there are some

Advantech IAG Training Center (Internal Use Only)


114 Host PC Connection(Advanced)

library filesDLL file and examples in the following path of your PC.

C:\Program Files\Advantech\Adam.NET Class Library\VS2003\Samples.

There are four ADAM .NET DLL Library :

Advantech.Adam

This is the core of this library. You can use this to control and configure the

ADAM series through serial and Ethernet communication.

Advantech.Common

This contains basic classes for communication and packet invalidation.

Advantech.Protocol

This contains the ModbusRTU and ModbusTCP packet constructor.

Advantech.Graph*

This contains some useful graphic controls for user to create their HMI like

programs.

Figure 5-122 DLL Library

ADAM .NET Class Library also offers a Help file for users reference. The

picture below shows the path of the Help file.

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)115

Figure 5-123 Help File

The library also includes some examples for Win32 and WinCE and for two

programming languages, C# and VB.NET. The following content will introduce you

how to use Win32 examples.

5.2.1 COMPortTest Example for Serial Modules

This example shows how to send ASCII commands to ADAM Serial Modules

with Advantech Protocol. The picture below shows how to send commands to

ADAM Serial Modules. About the commands, you could refer to the ADAM 4000

users manual.

Advantech IAG Training Center (Internal Use Only)


116 Host PC Connection(Advanced)

Figure 5-124 COMPort Test

The picture below shows the program flow chart.

OpenComPort( ) => Open the COM port

SetComPortState ( ) => Set the property of the comport

SetComPortTimeout ( )=> Update the COM port timeout

Send ( ) => Send binary data to this COM port

Recv ( ) => Receive binary data from this COM port

CloseComPort ( ) => Close the COM port

Figure 5-125 Program Flow Chart

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)117

5.2.2 ModbusRTU Example for Serial Modules

This example shows how to communicate with ADAM Serial Modules with

Modbus Protocol through Modbus/RTU. The following procedures show how to use

this example.

1. Change some parameter in the program

For Example :
m_bRegister = True Because m_bRegister = True, it will get Analog data.

m_iCOM=4

m_iAddr=5 Get Modbus Address 40003~40010 data from ADAM

m_iStart = 3
Module with Device Address 5 through COMPort 4
m_iLength = 8

m_bRegister = False Because m_bRegister = False, it will get Digital data.

m_iCOM=4

Advantech IAG Training Center (Internal Use Only)


118 Host PC Connection(Advanced)

m_iAddr=5 Get Modbus Address 00003~00010 data from ADAM

m_iStart = 3
Module with Device Address 5 through COMPort 4

m_iLength = 8

Figure 5-126 Modbus/RTU Example

2. Configure COMPort setting

Figure 5-127 Modbus/RTU Example

3. Run the Example

Figure 5-128 Modbus/RTU Example

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)119

The picture below shows the program flow chart.

OpenComPort( ) => Open the COM port

SetComPortState ( ) => Set the property of the comport

SetComPortTimeout ( )=> Update the COM port timeout

m_bRegister = True m_bRegister = False

ReadHoldingRegs ( ) ReadCoilStatus ( )
Reads the binary contents of Reads the ON/OFF status of
holding registers (4X references) in discrete outputs (0X references,
the slave. coils) in the slave.

Figure 5-129 Program Flow Chart

5.2.3 ModbusTCP Example for Ethernet Modules

This example shows how to communicate with ADAM Ethernet Modules

through Modbus/TCP. The following procedures show how to use this example.

1. Change some parameter in the program

Advantech IAG Training Center (Internal Use Only)


120 Host PC Connection(Advanced)

For Example :
m_bRegister = True Because m_bRegister = True, it will get Analog data.

m_szIP = "172.18.2.80"

m_iPort = 502 M_iPort is always 502

m_iStart = 1

m_iLength = 8 Get Modbus Address 40001~40008 data from ADAM

Module with IP 172.18.2.80

m_bRegister = False Because m_bRegister = False, it will get Digital data.

m_szIP = "172.18.2.80"

m_iPort = 502 M_iPort is always 502

m_iStart = 1

m_iLength = 22 Get Modbus Address 00001~00022 data from ADAM

Module with IP 172.18.2.80

Advantech IAG Training Center (Internal Use Only)


Host PC Connection(Advanced)121

Figure 5-130 Modbus/TCP Example

2. Run the Example

Figure 5-131 Modbus/TCP Example

The picture below shows the program flow chart.

SetTimeout( ) => Set the timeout constant for socket

Connect ( ) => Connect to an ADAM Ethernet module

m_bRegister = True m_bRegister = False

ReadHoldingRegs ( ) ReadCoilStatus ( )
Reads the binary contents of Reads the ON/OFF status of
holding registers (4X references) in discrete outputs (0X references,
the slave. coils) in the slave.

Advantech IAG Training Center (Internal Use Only)


122 Host PC Connection(Advanced)

Figure 5-132 Program Flow Chart

5.3 Quiz

1. Please draw a diagram to describe the relation of OPC Server & ADAM

modules.

2. Which programming languages does ADAM .NET Class Library support?

3. If customers want to make a program to communicate with ADAM 6000 series

modules, which programming language do you suggest for customers?

4. Which software/driver can NOT be used for programmer to communicate with

ADAM I/O modules? (a) OPC Server (b) ADAM.NET library (c) ACTIVEDAQ

Pro

5. Suppose there is one customer who wants to use VS .NET 2003 to make a

program on a WinCE system to communicate with Advantech ADAM remote

I/O modules. Which driver does Advantech support?

-------------------------------------------Hands-On Exam--------------------------------------

6. Modify an example in ADAM DotNet Class Library to use a DI of ADAM-6050

to trigger a DO in another ADAM-6050.

7. Use Modbus/RTU OPC Server to get data from ADAM-4018+ or ADAM-4118

Advantech IAG Training Center (Internal Use Only)

Você também pode gostar