background image

ICP DAS                                                                                                                                                                                                                                             

 

                                                 

  LinPAC-52xx Series XV-Board API User Manual

                                            1   

 

 

L

L

i

i

n

n

P

P

A

A

C

C

-

-

2

2

2

2

x

x

x

x

/

/

5

5

2

2

x

x

x

x

 

 

S

S

e

e

r

r

i

i

e

e

s

s

 

 

 

 

 

 

 

 

X

X

V

V

-

-

B

B

o

o

a

a

r

r

d

d

 

 

A

A

P

P

I

I

 

 

U

U

s

s

e

e

r

r

 

 

M

M

a

a

n

n

u

u

a

a

l

l

 

 

V1.0.0 Apr 2019 

 

 

 

 

 

Warranty

 

 

All

 

products

 

manufactured

 

by

 

ICP

 

DAS

 

are

 

warranted

 

against

 

defective

 

materials

 

for

 

a

 

period

 

of

 

one

 

year

 

from

 

the

 

date

 

of

 

delivery

 

to

 

the

 

original

 

purchaser.

   

 

Warning

 

 

ICP

 

DAS

 

assume

 

no

 

liability

 

for

 

damages

 

consequent

 

to

 

the

 

use

 

of

 

this

 

product.

 

ICP

 

DAS

 

reserves

 

the

 

right

 

to

 

change

 

this

 

manual

 

at

 

any

 

time

 

without

 

notice.

 

The

 

information

 

furnished

 

by

 

ICP

 

DAS

 

is

 

believed

 

to

 

be

 

accurate

 

and

 

reliable.

 

However,

 

no

 

responsibility

 

is

 

assumed

 

by

 

ICP

 

DAS

 

for

 

its

 

use,

 

nor

 

for

 

any

 

infringements

 

of

 

patents

 

or

 

other

 

rights

 

of

 

third

 

parties

 

resulting

 

from

 

its

 

use.

   

 

Copyright

 

 

Copyright

 

©

 

2019

 

by

 

ICP

 

DAS

 

Co.,

 

Ltd.

 

All

 

rights

 

are

 

reserved.

   

 

Trademarks

 

 

Names

 

are

 

used

 

for

 

identification

 

purposes

 

only

 

and

 

may

 

be

 

registered

 

trademarks

 

of

 

their

 

respective

 

companies.

   

Summary of Contents for LinPAC-22 Series

Page 1: ...ICP DAS assume no liability for damages consequent to the use of this product ICP DAS reserves the right to change this manual at any time without notice The information furnished by ICP DAS is believ...

Page 2: ...ogram 3 1 3 Specifications 4 2 XV Board API functions 5 2 1 modbusRequest 5 2 2 modbusRequestXV 8 2 3 getXVBitBack 11 2 4 getXVBit 13 2 5 getXVRegBack 15 2 6 getXVReg 17 2 7 setXVBit 19 2 8 setXVReg 2...

Page 3: ...er I O functions However only one XV Board can be inserted into each PAC at a time For more information related to the XV Board series refer to http www icpdas com root product solutions hmi_touch_mon...

Page 4: ...r Manual 4 1 3 Specifications For more detailed specifications related to specific XV Boards and the Modbus register table refer to http ftp icpdas com tw pub cd linpac napdos lp 5000 lp 52xx lp 5231...

Page 5: ...COM1 dev ttyO1 cNetID Input The NetID for the device The default slave address for the XV Board is 1 cFunction Input The Modbus RTU protocol function code wAddr Input The channel address Note Input t...

Page 6: ...ar szBuf 80 DWORD baudrate 115200 WORD wT Open the device file RetValue Open_Com comport baudrate Data8Bit NonParity OneStopBit if RetValue 0 printf open COM d failed n comport return FAILURE RetValue...

Page 7: ...or COM4 RS 232 RxD TxD and GND Non isolated 9600 ttyO2 dev ttyO2 or COM2 RS 485 Data Data Non isolated 9600 ttyO5 dev ttyO5 or COM5 RS 485 Data Data 2500 VDC isolated 9600 2 Modbus RTU protocol funct...

Page 8: ...mber of the COM port for the XV Board 1 COM1 dev ttyO1 cFunction Input The Modbus RTU protocol function code wAddr Input The channel address Note Input the channel address mapping in decimal format wC...

Page 9: ...orceSingleCoil case FC15ForceMultipleCoil szBuf 0 wValue 0xff break case FC06PresetSingleRegister case FC16PresetMultipleRegister szBuf 0 wValue 8 0xff szBuf 1 wValue 0xff break default return FAILURE...

Page 10: ...r COM4 RS 232 RxD TxD and GND Non isolated 9600 ttyO2 dev ttyO2 or COM2 RS 485 Data Data Non isolated 9600 ttyO5 dev ttyO5 or COM5 RS 485 Data Data 2500 VDC isolated 9600 2 Modbus RTU protocol functio...

Page 11: ...t char szBuf WORD wBufLen Parameters cPort Input The number of the COM port for the XV Board 1 COM1 dev ttyO1 wAddr Input The channel address Note Input the channel address mapping in decimal format w...

Page 12: ...szBuf RetValue getXVBitBack comport addr count szBuf sizeof szBuf Close_Com comport if RetValue 0 if count 8 printf d szBuf 0 else if count 16 dwValue szBuf 1 8 szBuf 0 printf u dwValue else dwValue s...

Page 13: ...r szBuf WORD wBufLen Parameters cPort Input The number of the COM port for the XV Board 1 COM1 dev ttyO1 wAddr Input The channel address Note Input the channel address mapping in decimal format wCount...

Page 14: ...f szBuf RetValue getXVBit comport addr count szBuf sizeof szBuf Close_Com comport if RetValue 0 if count 8 printf d szBuf 0 else if count 16 dwValue szBuf 1 8 szBuf 0 printf u dwValue else dwValue szB...

Page 15: ...t char szBuf WORD wBufLen Parameters cPort Input The number of the COM port for the XV Board 1 COM1 dev ttyO1 wAddr Input The channel address Note Input the channel address mapping in decimal format w...

Page 16: ...M d failed n comport return FAILURE memset szBuf 0 sizeof szBuf RetValue getXVRegBack comport addr count szBuf sizeof szBuf Close_Com comport if RetValue 0 dwValue szBuf 0 8 szBuf 1 printf u dwValue R...

Page 17: ...ount char szBuf WORD wBufLen Parameters cPort Input The number of the COM port for the XV Board 1 COM1 dev ttyO1 wAddr Input The channel address Note Input the channel address mapping in decimal forma...

Page 18: ...COM d failed n comport return FAILURE memset szBuf 0 sizeof szBuf RetValue getXVReg comport addr count szBuf sizeof szBuf Close_Com comport if RetValue 0 dwValue szBuf 0 8 szBuf 1 printf u dwValue Rem...

Page 19: ...D wBufLen Parameters cPort Input The number of the COM port for the XV Board 1 COM1 dev ttyO1 wAddr Input The channel address Note Input the channel address mapping in decimal format wCount Input The...

Page 20: ...n comport return FAILURE memset szBuf 0 sizeof szBuf szBuf 0 dwValue 0xff szBuf 1 dwValue 8 0xff szBuf 2 dwValue 16 0xff szBuf 3 dwValue 24 0xff RetValue setXVBit comport addr count szBuf sizeof szBu...

Page 21: ...ar szBuf WORD wBufLen Parameters cPort Input The number of the COM port for the XV Board 1 COM1 dev ttyO1 wAddr Input The channel address Note Input the channel address mapping in decimal format wCoun...

Page 22: ...0 printf open COM d failed n comport return FAILURE memset szBuf 0 sizeof szBuf szBuf 0 dwValue 8 0xff szBuf 1 dwValue 0xff RetValue setXVReg comport addr count szBuf sizeof szBuf Close_Com comport Re...

Page 23: ...rror Set stop Bits error 6 ParityError Set parity Bits error 7 CheckSumError Checksum error 8 ComPortNotOpen The specified COM port is not open 10 SendCmdError Send command error 11 ReadComStatusError...

Page 24: ...setxvao c getxvao c and getxvai c files in the path C cygwin LinPAC_AM335x_SDK examples xvboard folder for details Wiring Connections Run Set and read back the Analog Output value for a single channe...

Page 25: ...ter 1 3 Specifications for details of other specifications for the XV Board together with the Modbus register table AO0 AO1 2 In this example we set the type code for the AO range to 02 which denotes...

Page 26: ...table for the XV310 module for more details The table below provides the valid range for register addresses Refer to Chapter 1 3 Specifications for details of other specifications for the XV Board to...

Page 27: ...es xvboard folder for more details Wiring Connections The following is an example of communication between the XV310 module and the M 7000 series module To read the M 7002 module values from an LP 52x...

Page 28: ...dule Step2 Change the permissions for the files as shown below chmod 755 setxvdo exe chmod 755 getxvdo exe Step3 Execute the program Write to the DO0 channel setxvdo 0 1 1 Write to the DO1 channel set...

Page 29: ...format is as follows Single channel DO Channel Address Count Channel Status Data Format Value DO0 00000 DO1 00001 DO2 00002 DO3 00003 1 ON or OFF 0 OFF 1 ON All channels Start Address Count Channel S...

Page 30: ...s 2 115200 1 2 34 1 100 Read the DI3 channel on the M 7002 module getmodbus 2 115200 1 2 35 1 100 Read the DI4 channel on the M 7002 module getmodbus 2 115200 1 2 36 1 100 Read all DI channels on the...

Page 31: ...ard API User Manual 31 Appendix A Revision History This chapter provides information related to the revision history of this document The table below shows the revision history Revision Date Descripti...

Reviews: