background image

ICP DAS                                                                                                                                                                                                                                             

 

                                                 

  LinPAC-52xx Series XV-Board API User Manual

                                            28   

Connect the DO channel on the XV310 module to the DI channel on the M-7002 module, as 

illustrated below: 

Power Supply 

M-7002 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Â

 

Run

 

Set and read back the Digital Output value from multiple channels 

Step1: Transfer the setxvdo.exe and getxvdo.exe files to the LP-52xx module. 

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 

# ./setxvdo  1  1  1 

Write to the DO2 channel 

# ./setxvdo  2  1  1 

Write to the DO3 channel 

# ./setxvdo  3  1  1 

Write to all DO channels 

# ./setxvdo  0  4  10

Read back the DO0 channel 

# ./getxvdo  0  1 

Read back the DO1 channel 

# ./getxvdo  1  1 

Read back the DO2 channel 

# ./getxvdo  2  1 

Read back the DO3 channel 

# ./getxvdo  3  1 

Read back all DO channels 

# ./getxvdo  0  4 

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: