Home
User`s Manual - ICP DAS USA`s I
Contents
1. C LinPAC 8X81 SDK Manual 43 Version 2 0 void DO_16 int slot unsigned int data Parameter slot Input the slot number where the I O module is plugged into data Input output data Return Value None Example int slot 1 unsigned int data 3 DO_16 slot data The l 8057 card is plugged in slot 1 of LP 8X81 and can turn on channelO and 1 Remark This function can be applied on modules l 8037 1 8056 and l 8057 m DO_32 Description Output the 32 bit data to a digital output module The 0 31 bits of output data are mapped into the 0 31 channels of digital output modules respectively Syntax C void DO_32 int slot unsigned int data Parameter slot Input the slot number where the I O module is plugged into data Input output data Return Value None LinPAC 8X81 SDK Manual 44 Version 2 0 Example int slot 1 unsigned int data 3 DO_32 slot data The l 8041 card is plugged in slot 1 of LP 8X81 and can turn on channel 0 and 1 Remark This function can be applied on module l 8041 m DI 8 Description Obtains 8 bit input data from a digital input module The 0 7 bits of input data correspond to the 0 7 channels of digital input modules respectively Syntax C unsigned char DI_8 int slot Parameter slot Input the slot number where the I O module is plugged into Return Value Input data
2. Close_Slot slot The l 8040 module is plugged in slot 1 of LP 8X81 and return channel 0 status 0 ON 1 OFF Remark These functions can be applied on modules DI 8 channel 1 8048 l 8052 and l 8058 DI 16 channel 1 8051 and l 8053 LinPAC 8X81 SDK Manual 53 Version 2 0 DI 32 channel 1 8040 m UDIO_WriteConfig_16 Description This function is used to configure the channel of the universal DIO module which is digital input or digital output mode The universal DIO module can be up to 16 digital input or digital output channels running simultaneously Syntax C unsigned short UDIO_WriteConfig_16 int slot unsigned short config Parameter slot Input the slot number where the I O module is plugged into config Input channel status DO 1 DI 0 Return Value None Example int slot 1 unsigned short config Oxffff UDIO_WriteConfig_16 slot config The l 8064 card is plugged in slot 1 of LP 8X81 WriteConfig Oxffff ch O ch15 is DO mode Remark This function can be applied on modules l 8050 m UDIO_ReadConfig_16 Description This function is used to read the channels configuration of the universal DIO module which is digital input or digital output mode LinPAC 8X81 SDK Manual 54 Version 2 0 Syntax C unsigned short UDIO_ReadConfig_16 int slot Parameter slot Input the slot number where the I O module is plugged into Return Va
3. FloatValue Output Converted data array in calibrated float type slot Input specified slot of the LP 8X81 system Range 1 to 7 gain Input Input range len input ADC data length Return Value LinPAC 8X81 SDK Manual 69 Version 2 0 None Example int slot 1 ch 0 gain 0 datacount 10 hdata 10 float fdata 10 18017_SetChannelGainMode slot ch gain 0 1I8017_AD_POLLING slot ch gain datacount data ARRAY_HEX_TO_FLOAT_Cal data fdata slot gain len You can convert ten not calibrated Hex values to ten calibrated Float values Remark This function can be applied on module 8017H and I 8017HS Function of 3 m 18017 Hex_Cal Description This function is used to convert the data from non calibrated hex values to calibrated hex values Voltage or current Please refer to Fig 6 2 Syntax C int 18017_Hex_Cal int data Parameter data Input specified not calibrated hex value Return Value The Calibrated Hex Value Example int slot 1 ch 0 gain 0 hdata int hdata_cal 18017_SetChannelGainMode slot ch gain 0 hdata 18017 _GetCurAdChannel_ Hex slot LinPAC 8X81 SDK Manual 70 Version 2 0 hdata_cal 18017 _Hex_Cal hdata You can convert not calibrated Hex Value to calibrated Hex Value Remark This function can be applied on module 8017H and I 8017HS m 18017 Hex _Cal_ Slot_Gain Description This function is used to convert
4. Function of 2 m HEX TO FLOAT Cal Description This function is used to convert the data from not calibrated hex to calibrated float values based on the configuration of the slot gain Voltage or current Please refer to the Fig 6 2 Syntax C float HEX_TO_FLOAT_Cal int HexValue int slot int gain Parameter HexValue Input spedified not calibrated HexValue before converting slot Input specified slot of the LP 8X81 system Range 1 to 7 gain Input Input range 0 10 0V 1 5 0V 2 2 5V 3 1 25V 4 20mA LinPAC 8X81 SDK Manual 68 Version 2 0 Return Value The Calibrated Float Value Example int slot 1 ch 0 gain 0 hdata float fdata 18017_SetChannelGainMode slot ch gain 0 hdata 18017_GetCurAdChannel_ Hex slot fdata HEX_TO_FLOAT_Cal hdata slot gain You can convert not calibrated Hex Value to calibrated Float Value Remark This function can be applied on module I 8017H and I 8017HS m ARRAY HEX TO FLOAT Cal Description This function is used to convert the data from non calibrated hex values to calibrated float values in the array mode based on the slot s configuration Voltage or current Please refer to Fig 6 2 Syntax C void ARRAY_HEX_TO_FLOAT_cal int HexValue float FloatValue int slot int gain int len Parameter HexValue Input data array in not calibrated Hex type before converting
5. 15 Linux Command date date show date and time 16 Linux Command netstat netstat show the state of network Parameter a list all states Example netstat a LinPAC 8X81 SDK Manual 25 Version 2 0 5 1 17 Linux Command ifconfig ifconfig show the ip and network mask like ipconfig in DOS 5 1 18 Linux Command wget wget get the file from the web link 5 1 19 Linux Command ping ping check to see if the host in the network is alive ping IPAddress Example ping 192 168 0 1 5 1 19 Linux Command clear clear clear the screen 5 1 20 Linux Command passwd passwd change the password 5 1 21 Linux Command reboot reboot reboot the LinPAC 5 2 A Simple Example Helloworld c In this section we will introduce how to compile the helloworld c to helloworld and transfer the helloworld to the LP 8X81 by using WinSCP software or scp command please refer to the Fig 5 1 Finally executes this file on the LP 8X81 In this example no ICP DAS modules are used LinPAC 8X81 SDK Manual 26 Version 2 0 Windows PC WinSCP WinSCP scp root Helloworld root LinPAC IP root Please refer to Fig 5 3 Linux X86 PC LinPAC 8000 ex Fedora Core 4 Fig 5 1 If you want to use the modules of ICP DAS to control your system you can refer to demo in the chapter 7 These processes can be divided into three steps and thet are given as below
6. Example int slot 1 unsigned char data data DI_8 slot The l 8058 card is plugged in slot 1 of LP 8X81 and has inputs in channel 0 and 1 Returned value data 0xfC Remark LinPAC 8X81 SDK Manual 45 Version 2 0 This function can be applied on modules l 8048 l 8052 l 8058 m DI_16 Description This function is used to obtain 16 bit input data from a digital input module The 0 15 bits of input data correspond to the 0 15 channels of digital module s input respectively Syntax C unsigned int DI_16 int slot Parameter slot Input the slot number where the I O module is plugged into Return Value Input data Example int slot 1 unsigned int data data DI_16 slot The l 8053 card is plugged in slot 1 of LP 8X81 and has inputs in channel 0 and 1 Returned value data OxfffC Remark This function can be applied on modules l 8051 1 8053 m DI 32 Description This function is used to obtain 32 bit input data from a digital input module The 0 31 bits of input data correspond to the 0 31 channels of digital input module LinPAC 8X81 SDK Manual 46 Version 2 0 respectively Syntax C unsigned long DI_32 int slot Parameter slot Input the slot number where the I O module is plugged into Return Value Input data Example int slot 1 unsigned long data data DI_32 slot The l 8040 card plugged is in slot 1
7. Input Range from 1 to 8192 total ADCs number DataPtr Output The starting address of data array and the array size must be equal to or bigger than the datacount Return Value 0 indicates success Not O indicates failure Example int slot 1 ch 0 gain 0 data 10 unsigned int datacount 10 18017_AD_POLLING_Cal slot ch gain datacount data You gain ten calibrated hex values via channel 0 in the I 8017H module Function of 1 2 m 18017_GetCurAdChannel_Float_Cal Description Obtains the calibrated analog input value in the Float format directly from the analog i8017H input modules This function is a combination of the 18017_GetCurAdChannel_ Hex function and the Hex _TO FLOAT Cal function Please refer to Fig 6 2 Syntax LinPAC 8X81 SDK Manual 75 Version 2 0 C int 18017_GetCurAdChannel_Float_Cal int slot Parameter slot Input specified slot of the LP 8X81 system Range 1 to 7 Return Value The analog input value in Calibrated Float format Example int slot 1 ch 0 gain 0 float data 18017_SetChannelGainMode slot ch gain 0 data 18017_GetCurAdChannel_Float_Cal slot The I 8017H card is plugged into slot 1 of LP 8X81 and the range of the data value from channel 0 in I 8017H is 10V 10V Remark This function can be applied on module I 8017H and I 8017HS 6 6 Analog Output Functions m 18024 Initial Description This f
8. 123 root localhost i7k Fig 7 1 The DO of l 7050 255 2 8 1 means DO channel 0 7 will output and The DI of l 7050 123 127 2 2 means there is input in DI channel 2 7 2 I 7k Modules AIO Control Demo This demo i7kaio c will illustrate how to control the Al AO with the l 7017 8 Al channels and l 7021 modules 1 AO channel The address for the l 7021 and l 7017 modules are in the RS 485 network where 05 and 03 are separate and the baudrate is 9600 The result of this demo allows the l 7021 module s AO channel to output 3 5V and the l 7017 s Al channel 2 to input The source code of this demo program is as follows include lt stdio h gt include lt stdlib h gt include msw h LinPAC 8X81 SDK Manual 84 Version 2 0 char szSend 80 szReceive 80 WORD wBuf 12 float fBuf 1 2 int main int i j wRetVal DWORD temp wRetVal Open_Com COM3 9600 Data8Bit NonParity OneStopBit if wRetVal gt 0 printf open port failed n return 1 Analog output 7021 AO i 0 wBuf 0 3 COM Port wBuf 1 0x05 Address wBuf 2 0x7021 1D wBuf 3 0 CheckSum disable wBuf 4 100 TimeOut 100 msecond wBuf 5 i Not used if module ID is 7016 7021 Channel No 0 to 1 if module ID is 7022 Channel No 0 to 3 if module ID is 7024 wBuf 6 0 string debug fBuf 0 3 5 Analog Value w
9. 4 AO channels and l 8017 8 Al channels module and they are plugged into slot 0 and slot 1 of the l 8000 controller separately Please follow the below steps to configure the hardware 1 Put the l 8024 and l 8017 modules in slot 0 and slot 1 of 1 8000 controller 2 Install 8k232 exe or R232_300 exe to flash memory of l 8000 controller as firmware 3 Connect com3 of LP 8X81 to com1 of I 8000 controller with RS 232 cable The address and baudrate of l 8000 controller are 01 and 115200 that can be modified by DCON Utility The result of this demo lets AO voltage channel 0 of 8024 output 3 5V and Al channel 2 of 8017H input The source code of this demo program is as follows include lt stdio h gt include lt stdlib h gt include msw h LinPAC 8X81 SDK Manual 104 Version 2 0 char szSend 80 szReceive 80 DWORD wBuf 12 float fBuf 1 2 int main int i j wRetVal DWORD temp wRetVal Open_Com COM3 115200 Data8Bit NonParity OneStopBit if wRetVal gt 0 printf open port failed n return 1 Analog output 8024 AO i 0 wBuf 0 3 COM Port wBuf 1 0x01 Address wBuf 2 0x8024 1D wBuf 3 0 CheckSum disable wBuf 4 100 TimeOut 100 msecond wBuf 5 i Channel No of AO wBuf 6 0 string debug wBuf 7 0 Slot Number fBuf 0 3 5 wRetVal AnalogOut_8K wBuf fBuf szSend szReceive if wRetVal printf AO of 8
10. Parameter slot Input the slot number where the I O module is plugged into Return Value Input data Example int slot 1 unsigned char data data DIO_DI_16 slot The l 8042 card is plugged in slot 1 of LP 8X81 and has inputs in channel 0 and 1 Returned value data OxfffC Remark This function can be applied in modules l 8042 LinPAC 8X81 SDK Manual 50 Version 2 0 m DO 8 RB DO_16_RB DO 32 RB DIO DO 8 RB gt DIO DO 16 RB Description This function is used to Readback all channel status from a Digital Output module Syntax C unsigned char DO_8_ RB int slot unsigned int DO_16_RB int slot unsigned long DO_32_RB int slot unsigned char DIO_DO_8 RB int slot unsigned int DIO_DO_16_RB int slot Parameter slot Input the slot number where the I O module is plugged into Return Value all DO channel status Example int slot 1 Open_Slot slot printf u DO_32 RB slot Close_Slot slot The 8041 module is plugged in slot 1 of LP 8X81 and return all DO channel status Return value From 0 4294967295 for 32 channel Remark These functions can be applied on modules DO 8 channel I 8060 I i8064 l 8065 l 8066 I 8068 and l 8069 DO 16 channel 1 8037 l 8056 and l 8057 DO 32 channel 1 8041 LinPAC 8X81 SDK Manual 51 Version 2 0 m DO 8 BW DO 16 BW DO 32 BW DIO DO 8 BW DIO DO 16 BW Description This function is used to output assigned s
11. STEP 1 Compile helloworld c to helloworld on the Linux X86 PC 1 Create Helloworld c on the linux PC using linux distribution for example Fedora Core 4 please refer to the Fig 5 2 2 Type in gcc o Helloworld Helloworld c to compile Helloworld c into helloworld please refer to Fig 5 2 root localhost cat Helloworld c nt main v printf hello world n return O BR J root localhost gcc o Helloworld Helloworld c root localhost 1s Helloworld root Iocalhost Fig 5 2 LinPAC 8X81 SDK Manual 27 Version 2 0 STEP 2 Transfer Helloworld to the LP 8X81 There are two methods for transferring files to the LP 8X81 lt Method one gt By Using the Linux Command Prompt Open a Linux Command Prompt and type scp root Helloworld root LinPAC 8000 IP root command to connect and transmit the executes Helloworld to the LP 8X81 Then type the Password icpdas is the default value to accomplish the connection and transmission from the linux PC to the LP 8X81 Please refer to Fig 5 3 A root localhost root localhost ls root Helloworld root localhost scp Helloworld root 10 0 9 68 root rootlild 0 9 68 s password Helloworld rootllocalhost 1008 4692 4 OKB s 00 0 Fig 5 3 lt Method two gt By Using WinSCP Software 1 Open the WinSCP Software and type the user and password ssh port and the IP of linux PC Afte
12. To type vi etc inittab to modify run level 2 To change run level from 3 to 5 please refer to Fig 9 6 then type reboot to restart LP 8X81 9 4 Application Support There are many applications in the LP 8X81 1 Provide Media Player Users can play media by using the media player built in the LP 8X81 Just click the icon xine refer to Fig 9 7 to open the media player Applications Places System SR Xine media player T xine There i5 no MRL Fig 9 7 LinPAC 8X81 SDK Manual 115 Version 2 0 2 Provide Web Browser Users can see the Web Page by using the Web Browser built in the LP 8X81 Just click the icon firefox refer to Fig 9 8 to open the web browser Applications Places System SEG Firefox web browser 3 54 PM amp J ICP DAS PAC Remote IO Industrial communication PCI based Data acquisition board Machine automation Mozilla Firefox File Edit View Go Bookmarks Tools Help P s A O http www icpdas com tw z co GL amp Additional plugins are required to display all the media on this page Install Missing Plugins 8 PC Based PET 7000 J we Boards gt PoE Ethemet I O ISAGRAF ee SPOTLIGHT ET 7000 SoftLogic PAC 7 OF THE WEEK Ethernet VO ji G 4500D SIM300 NS 205 IP67 1 7565 Converters amp Macnime G 4500PD SIM300 Repeaters utomation RN ER Intelligent 3 3 Ethernet Switch USB to CAN I 7 A GPRS GPS with 1P67 converter
13. 1 Mask 255 0 0 0 UP LOOPBACK RUNNING MTU 16436 Metric 1 RX packets 220 errors 0 dropped 0 overruns 0 frame 0 TX packets 220 errors 0 dropped 0 overruns 0 carrier 0 collisions 0 txqueuelen 0 RX bytes 5088 4 9 KiB TX bytes 5088 4 9 KiB Fig 4 11 LinPAC 8X81 SDK Manual 17 Version 2 0 Boot up LP 8X81 and open command line Type in vi etc resolv conf to open the DNS setting file Type DNS server in the nameserver field Then type wq to save the setting Type reboot to reboot the LP 8X81 to make the setting work Refer to the Fig 4 12 Es _ generated oe Oe We En ee ie Be scr ipt search nameserver je a 2 hal a iI or L Fig 4 12 Before you startup the LixPAC 8000 system you can insert the CF Card into the slot of CF Card in the LP 8X81 Then user can use the command fdisk I to check the device name of CF card in the LP 8X81 Therefore users can access the CF Card in the LP 8X81 by using the command mount and umount Please refer to the Fig 4 13 a 3 root localhost fdisk l1 Disk dev hda 4206 MB 4206182400 bytes 255 heads 63 sectors track 511 cylinders Units cylinders of 16065 512 8225280 bytes Device Boot Start End Blocks dev hdal 1 SLL 4104576 Disk dev hdb 1014 MB 1014644736 bytes 32 heads 63 sectors track 983 cylinders Units cylinders of 2016 512 1032192 bytes Device Boot Start End Blocks dev hd
14. 15 EFF 10 2008 2 27 FF 10 2008 8 17 FF 06 2008 8 1 FF 014 2008 8 17 FF 06 goldentask 2008 8 24 FF 03 13 905 2008 48 24 FF 05 24 200746129 _EF 05 208 200837 EFF 10 176 2007 5 29 H 05 100 20076129 _ F 05 26 2008 2 27 FF 11 16 2008 2 27 FF 10 120 2005 5 23 _LF 05 Biel 81 2008 2 27 FF 10 ree 6 426 20088417 FF 05 Hel i 0 2008 2 27 FF 10 129 2007 5 29 E 05 The Windows PC directory oooocooceoceors 0 F amp S 1 To drag the Helloworld from the Windows directory to the LinPAC LX800 directory ae ji EIS ENETE NEN EHEN NENNEN Fig 5 7 STEP3 SSH to the LP 8X81 and execute program 1 To use putty exe software please refer to chapter 4 or telnet command please refer to chapter 4 to connect to the remote server of the LP 8X81 Then type the Password root is the default value If it shows the prompt character the process of connecting from your PC to the remoter server of the LP 8X81 is finished refer to Fig 5 8 if root localhost ZU08 Irom 10 0 9 32 not alled t installed installed 0 installed Fig 5 8 LinPAC 8X81 SDK Manual 30 Version 2 0 2 Type in the Is command in order to list all the files in root and to see the Helloworld file Then type in the chmod 777 Helloworld command to change the authority of Helloworld This means that the file is executable Type in Helloworld to execute
15. 4 VGA Resolution 4 5 Running applications automatically at boot time snesnnenn 4 5 1 Making program run at boot time 4 5 2 Disabling program run at boot time 5 Instructions for the LP 8X81 5 1 Basic Linux Instmietiohs essen anna aa el alchh 5 1 1 Linux Command ls 5 1 2 Linux Command 5 1 3 Linux Command mkdir 5 1 4 Linux Command 5 1 5 Linux Command 5 1 6 Linux Command 5 1 7 Linux Command 5 1 8 Linux Command 5 1 9 Linux Command cp my pwa who rmdir rm 3 7 5 1 10 Linux Command chmod 5 1 11 Linux Command uname 5 1 12 Linux Command ps 5 1 15 Linux Command date 5 1 16 Linux Command netstat LinPAC 8X81 SDK Manual 2 Version 2 0 Peer cc rr ccc ccccccccccccccc cece cece cc eecc cece cscs ereseccccccccee Peer ce rr ccc ccccccccccrcccc cece cece cececc cece cccceceeer cece eseeecces Perec creer cece cree cccccc cece reece cere eeee sees essere esse es ee er er 5 1 17 Linux Command ifconfig 26 5 1 18 Linux Command wget 26 5 1 19 Linux Command ping 26 5 1 19 Linux Command clear 26 5 1 20 Linux Command passwd 26 5 1 21 Linux Command reboot 26 5 2 A Simple Example Helo worl die nee an 26 IA Talk VEN ae ale 31 O EIBISK A eee ae a a ee in Are 36 6 1 System Information Functions case ae 37 6 2 Digital Input Output Functions eesseseessessseseesseresseeesseesssreessreesss
16. The analog input value in Hex format Example int slot 1 ch 0 gain 4 int data 18017_SetChannelGainMode slot ch gain 0 data 18017 _GetCurAdChannel_ Hex slot The I 8017H card is plugged into slot 1 of LP 8X81 and the range of the data value from channel 0 in I 8017H is 20mA m 18017 AD POLLING Description This function is used to get the analog input non calibrated hex values of the specified channel from an analog input module and can convert it to the value according to the slot configuration the gain and the data number Syntax C int 18017_AD_POLLING int slot int ch int gain unsigned int datacount int DataPtr Parameter slot Input Specified slot in the LP 8X81 system Range 1 to 7 ch Input Specified channel for I 8017H Range 0 to 7 Specified channel for I 8017HS Range 0 to 15 gain Input Input range 0 10 0V 1 5 0V 2 2 5V 3 1 25V 4 20mA datacount Input Range from 1 to 8192 total ADCs number LinPAC 8X81 SDK Manual 67 Version 2 0 DataPtr Output The starting address of data array and the array sizemust be equal to or bigger than the datacount Return Value 0 indicates success Not 0 indicates failure Example int slot 1 ch 0 gain 0 data 10 unsigned int datacount 10 1I8017_AD_POLLING slot ch gain datacount data You gain ten not calibrated hex values via channel 0 in the I 8017H module
17. a are divided into the sub group functions for ease of use within the different applications The powerful functions of the LP 8X81 embedded controller LinPAC 8X81 SDK Manual 5 Version 2 0 which includes a VGA USB Card Reader Camera Mouse Keyboard Series ports RS 232 RS 422 485 Ethernet Hub and many I O slots in the picture Presently HTTP SSH Servers are built in and users can transfer files or use remote control with the LP 8X81 more conveniently In network communication wireless gt ethernet Fig 1 1 illustrates the outline of the LP 8X81 with modules Fig 1 1 Fig 1 2 illustrates hardware architecture of the LP 8X81 LinPAC 8X81 SDK Manual 6 Version 2 0 Fig 1 2 NO Interface Name NO Interface Name 1 Power LED Indicator 15 CF Compact Flash Card Slot 2 Rotary Switch 16 VGA Port 3 Ethernet Port 1 17 Slot 1 Slot 7 4 USB 2 0 Ports 18 DIP Switch 5 COM Port 5 RS 232 6 COM Port 4 RS 232 RS 485 7 Power Switch 8 COM Port 2 RS 232 9 Power and Ground 10 RS 485 Data and Data 11 Redundant Power and Ground 12 Relay Output R COM and R NO 13 Frame Ground 14 Ethernet Port 2 LinPAC 8X81 SDK Manual 7 Version 2 0 2 The LinPAC 8X81 SDK Introduction LP 8X81 SDK consists of the following major items e LinPAC SDK library files LinPAC SDK include files Demo files From hittp ftp icodas com pub cd linpac n
18. application of the control functions on the I 7000 I 8000 I 87k series modules for use in the LP 8X81 After user download the latest version of LP 8X81 SDK LinPAC 8X81_sdk tar gz from the ftp path please refer to chapter 2 then user could use command tar zxvf LinPAC 8X81_sdk tar gz to unzip SDK LinPAC 8X81_sdk tar gz in the LP 8X81 user can find all demo programs include demo source code and executes file in the examples directory 7 1 l 7k Modules DIO Control Demo This demo i7kdio c will illustrate how to control DI DO with the I 7050 module 8 DO channels and 7 DI channels The address and baudrate of the l 7050 module in the RS 485 network are 02 and 9600 separately The result of this demo allows the DO channels 0 7 output and DI channel 2 input The source code of this demo program is as follows include lt stdio h gt include lt stdlib h gt include msw h char szSend 80 szReceive 80 ans WORD wBuf 12 float fBuf 12 int main int wRetVal Check Open_Com3 wRetVal Open_Com COM3 9600 Data8Bit NonParity OneStopBit LinPAC 8X81 SDK Manual 82 Version 2 0 if wRetVal gt 0 printf open port failed n return 1 I 7050 DO amp amp DI Parameter wBuf 0 3 COM Port wBuf 1 0x02 Address wBuf 2 0x7050 1D wBuf 3 0 CheckSum disable wBuf 4 100 TimeOut 100 msecond wBuf 5 OxOff 8 DO Channels On wB
19. is mini second Return Value None Example EnableWDT 10000 Enable WDT interval 10000ms 10s while getchar 10 printf Refresh WDT n EnableWDT 10000 Refresh WDT 10s printf Disable WDT n DisableWDT Remark m DisableWDT Description This function is used to disable WDT Syntax C void DisableWDT void Parameter None LinPAC 8X81 SDK Manual 58 Version 2 0 Return Value None Example Remark m WatchDogSWEven Description This function is used to read the LinPAC Reset Condition and users can reinstall the initial value according to the Reset Condition Syntax C unsigned int WatchDogSWEven void Parameter None Return Value Just see the last number of the return value RCSR Reset Controller Status Register For example RCSR is 20009a4 so just see the last number 4 4 is 0100 in bits and it means Bit 0 Hardware Reset Like Power Off Reset Button Bit 1 Software Reset Like Type Reboot in command prompt Bit 2 WDT Reset Like Use EnableWDT 1000 Bit 3 Sleep Mode Reset Not supported in the LinPAC Example printf RCRS x n WatchDogSWEven Remark LinPAC 8X81 SDK Manual 59 Version 2 0 m ClearWDTSWEven Description This function is used to clear RCSR value Syntax C void ClearWDTSWEven unsigned int rcsr Parameter rcsr Clea
20. of LP 8X81 and has inputs in channels 0 and 1 Returned value data OxfffffffC Remark This function can be applied on module l 8040 m DIO_DO 8 Description This function is used to output 8 bit data to DIO modules These modules run 8 digital input channels and 8 digital output channels simultaneously The 0 7 bits of output data are mapped onto the 0 7 output channels for their specific DIO modules respectively Syntax C void DIO_DO _8 int slot unsigned char data LinPAC 8X81 SDK Manual 47 Version 2 0 Parameter slot Input the slot number where the I O module is plugged into data Input output data Return Value None Example int slot 1 unsigned char data 3 DIO_DO_8 slot data The l 8054 card is plugged in slot 1 of LP 8X81 and can turn on channels 0 and 1 t not only outputs a value but also shows 16LEDs Remark This function can be applied in modules l 8054 l 8055 and l 8063 m DIO_DO_16 Description This function is used to output 16 bits of data to DIO modules which have 16 digital input and 16 digital output channels running simultaneously The 0 15 bits of output data are mapped onto the 0 15 output channels for their specific DIO modules respectively Syntax C void DIO_DO_16 int slot unsigned int data Parameter slot Input the slot number where the I O module is plugged into data Input output data Li
21. then please refer to the demo in section 7 5 2 7 5 1 I 8k Modules in slots of LP 8X81 In this section this demo program i8kdio c will introduce how to control the DI DO with the l 8055 8 DO channels and 8 DI channels module and it is plugged into slot 3 of the LP 8X81 The address and baudrate in the LP 8X81 are constant and they are 00 and 115200 separately The result of this demo lets DO channel 0 7 of l 8055 output and DI channel 0 of l 8055 input The source code of this demo program is as follows include lt stdio h gt include lt stdlib h gt include msw h char szSend 80 szReceive 80 DWORD dwBuf 12 float fBuf 1 2 int main LinPAC 8X81 SDK Manual 97 Version 2 0 int i j wRetVal WORD DoOval temp wRetVal Open_Slot 3 if wRetVal gt 0 printf open Slot failed n return 1 N 8055 DO DO_8 3 255 printf DO of l 8055 0x x n 255 N 8055_DI printf DI of l 8055 x DI_8 3 Close_Slot 3 return 0 Allthe steps from programming to execution are the same as those in the section 7 1 The result of execution refers to Fig 7 5 i root localhost goldentask U tility i8k srce 20080729 examples i8k root localhost i8k ls i8kdio Fig 7 5 7 5 2 I 8k Modules in slots of l 8000 Controller In this section this demo program i8kdio_8k c will illustrate how to control the DI DO with the I 8055 8 DO channels and 8 DI channels module Please
22. 024 Error Error Code d n wRetVal else printf AO of 8024 channel d f n i fBuf 0 Analog Input 8017H Al j 2 wBuf 0 3 COM Port LinPAC 8X81 SDK Manual 105 Version 2 0 wBuf 1 0x01 Address wBuf 2 0x8017 1D wBuf 3 0 CheckSum disable wBuf 4 100 TimeOut 100 msecond wBuf 5 j Channel of Al wBuf 6 0 string debug wBuf 7 1 Slot Number wRetVal Analogin_8K wBuf fBuf szSend szReceive if wRetVal printf Al of 8017H Error Error Code d n wRetVal else printf Al of 8017H channel d f n j fBuf 0 Close_Com COMS3 return 0 All the steps from programming to execution are the same as those in the section 7 1 The result of execution refers to Fig 7 8 foe root localhost goldentask Utlity i8k s c 200807297 examples i8k root localhost i8k ls 18kaio 8k root localhost 18k 18kaio 8k AO of 8024 channel 0 3 500000 AT of 8017H channel 1 3 504000 root localhost i8k Fig 7 8 7 7 Conclusion of Module Control Demo Fig 7 9 is the table of communication functions for the 1 7000 1 8000 1 87000 modules in different locations When using the ICP DAS modules in the LP 8X81 this LinPAC 8X81 SDK Manual 106 Version 2 0 table will be helpful to let users understand which functions of communication should be used I 8k or I 87K In I 8000 Controller I 87K In Expansion Unit I 87K In Li
23. 2 setexao slot comport value channel baudrate address gt setexao 0 3 6 7 5 9600 2 Description 1 Set channel 5 analog value 6 7 to the module at slot 2 2 Set channel 5 analog value 6 7 to the module at COMS getexdi Command 1 getexdi slot 1 gt getexdi 2 1 2 getexdi slot comport baudrate address gt getexdi 0 3 9600 2 Description 1 Get the dec digital input value from the module at slot 2 2 Get the dec digital input value from the module at COMS getexai Command 1 getexai slot 1 channel gt getexai215 2 getexai slot comport channel baudrate address gt getexai 0 3 5 9600 2 Description 1 Get channel 5 analog value from the module at slot 2 2 Get channel 5 analog value from the module at COMS read_sn Command read_sn gt read_sn Description Show the serial number Table 5 2 LinPAC 8X81 SDK Manual 34 Version 2 0 Users can also type in the instructions name and it will show the instructions usage LinPAC 8X81 SDK Manual 35 Version 2 0 6 LIBISK A In this section we will focus on examples for the description of and application of the functions found in the Libi8k a The Libi8k a functions can be clarified into 3 groups which are listed in Fig 6 1 A Libisk a 2 Functions of DCON Functions of 18000 Modules 17000 8000 8700 Modules in LonCon Slot in Serial Communication H In Paralle
24. 4 EF B vi 8 786 2008 5 LF IE P pone soot 49 2008841 FF ie 091 211 2008423 F 31 783 2008 86 F 0 2008 1 23 FF 69 471 2008 123 F E install log syslog 5 790 2009123 HF Fig 5 5 3 After user get the file Helloworld from the linux PC user could upload the file to the LP 8X81 Please create a new the login window of WinSCP then type the LP 8X81 user and password ssh port and the IP After user set the config user can click login button to to connect to the LP 8X81 please refer to Fig 5 6 WanSCP Login un m EIRPAC TXEOO TP Host name Port number Environment 10 0 3 68 22 Directories SSH User name Password Preferences x rf Default Value _ iepdas Private key file Ga Protocol SFIP SFTP allow SCP fallback SCP C Advanced options Select color a ee Fig 5 6 LinPAC 8X81 SDK Manual 29 Version 2 0 4 Upload the file Helloworld to the LP 8X81 refer to Fig 5 7 Local Mark Files Commands Session Options Remote Help 8 82 m28 4 yi Default g w CREE ver Ga fa at i ai root v Bad we S te C Documents and Settings useri amp e M demo Aod Name Ext Size Type Change Name Ext Size Changed ctory 200848 2008 8 25 _LF 08 Aua a eig Kai eae demo pdf 719 914 Adobe Acrobat 7 2005 10 2008 8 17 FF 06 2008817 FF 05 2008 2 27 FF 10 2008 2 27 FF 09 2008 2 27 FF 10 The LinPAC LX800 directorgo0s227 F 10 2008 3465 EF 11 0 2008 8 17 FF 05 2008 8
25. 5 bits data to a universal DIO module according to the channel configuration The 0 15 bits of input data are mapped onto the 0 15 input channels for their specific universal DIO modules respectively Syntax C unsigned short UDIO_DI16 int slot LinPAC 8X81 SDK Manual 56 Version 2 0 Parameter slot Input the slot number where the I O module is plugged into Return Value None Example int slot 1 unsigned int data unsigned short config Oxff00 UDIO_WriteConfig_16 slot config data UDIO_DI16 slot printf DI ChO Ch7 of l 8055 in Slot d Ox x n r slot data scanf d amp data UDIO_DO16 slot data printf DO Ch8 Ch15 of l 8050 in Slot d Ox x n r slot data The l 8050 card is plugged in slot 1 of LP 8X81 WriteConfig 0x00ff ch O ch7 is DI mode and ch8 ch15 is DO mode DI Ch0 Ch7 of l 8055 in Slot 1 Oxfbff Input DO value 255 DO Ch8 Ch15 of l 8050 in Slot 1 Oxff Remark This function can be applied on modules l 8050 6 3 Watch Dog Timer Functions m EnableWDT Description This function can be used to enable the watch dog timer WDT and users need to reset WDT in the assigned time set by users Or LinPAC will reset automatically Syntax C LinPAC 8X81 SDK Manual 57 Version 2 0 void EnableWDT unsigned int msecond Parameter msecond LinPAC will reset in the assigned time if users don t reset WDT The unit
26. 8024 functions for current output Syntax C void 18024 CurrentOut int slot int ch float cdata Parameter slot Input Specify the LP 8X81 system slot Range 1 to 7 ch Input Output channel Range 0 to 3 cdata Input Output data with engineering unit Current Output 0 20 mA Return Value None Example int slot 1 ch 0 float cdata 10 0f 18024 CurrentOut slot ch data Output the 10 0mA current from the channel 0 of l 8024 module Remark This function can be applied on module l 8024 m 18024 VoltageHexOut Description This function is used to send the voltage value in the Hex format to the specified LinPAC 8X81 SDK Manual 78 Version 2 0 channel in the l 8024 module which is plugged into the slot in the LP 8X81 system Syntax C void 18024 VoltageHexOut int slot int ch int hdata Parameter slot Input Specify the LP 8X81 system slot Range 1 to 7 ch Input Output channel Range 0 to 3 hdata Input Output data with hexadecimal data range Oh 3FFFh gt Voltage Output 10 10 V Return Value None Example int slot 1 ch 0 data 0x3000 18024 VoltageHexOut slot ch data The l 8024 module output the 5 0V voltage from the channel 0 Remark This function can be applied on module l 8024 m 18024 CurrentHexOut Description This function is used to send the current value in the Hex format to the specified channel
27. R 10 0 9 68 NETMASK 255 255 255 0 NETWORK 10 0 9 0 ONBOOT yes TYPE Ethernet zwg Fig 4 6 root local tc sysconfig network DEVICE ethl BOOTPROTO dhcp HWADDR 00 10 F3 12 BB 99 ONBOOT yes TYPE Ethernet DEVICE ethl BOOTPROTO static BROADCAST 10 0 9 255 IPADDR 10 0 9 15 NETMASK 255 255 255 0 NETWORK 10 0 9 0 ONBOOT yes TYPE Ethernet wq Fig 4 7 2 Using Assigned IP Boot up LP 8X81 and open a command Prompt Type in vi etc sysconfig network to open the network setting file If user want to set LinPAC 8X81 SDK Manual 15 Version 2 0 gateway user can remove in the GATEWAY and GATEWAYDEV Please refer to the Fig 4 8 NETWORKING yes HOSTNAME localhost localdomain If you want to set gateway please remove the in GATEWAY and GATEWAYDEV GATEWAY 10 0 9 254 GATEWAYDEV Fig 4 8 After editing the network file user can type in vi etc sysconfig network scripts ifcfg ethO and vi etc sysconfig network scripts ifcfg eth1 to set the network device eth0 and eth1 To add in the dhcp block and remove in the Assign IP block Then type wq to save the setting To type etc init d ifplugd restart to make the setting work Please refer to the Fig 4 9 and Fig 4 10 ES fetcisysco DEVICE ethoO BOOTPROTO dAhNCcpP HWADDR 00 10 F3 12 BB 94 H ONBOOT yes TYPES Ethern
28. RetVal AnalogOut wBuf fBuf szSend szReceive if wRetVal printf AO of 7021 Error Error Code d n wRetVal else printf AO of 7021 channel d f n i fBuf 0 Analog Input 7017 Al j wBuf 0 3 COM Port LinPAC 8X81 SDK Manual 85 Version 2 0 wBuf 1 0x03 Address wBuf 2 0x7017 1D wBuf 3 0 CheckSum disable wBuf 4 100 TimeOut 100 msecond wBuf 5 j Channel of Al wBuf 6 0 string debug wRetVal AnalogIn wBuf fBuf szSend szReceive if wRetVal printf Al of 7017 Error Error Code d n wRetVal else printf Al of 7017 channel d f n j fBuf 0 Close_Com COMS3 return 0 All the steps from programming to execution are the same as those in the section 7 1 The result of execution refers to Fig 7 2 ie root localhost eoldentask U tlityidk sre 20080729 examplestisk root localhost 17k ls 1Tkalo root localhost 17k 17kalo E 7017 channel 1 3 roottiocalhost i7k Fig 7 2 LinPAC 8X81 SDK Manual 86 Version 2 0 7 3 1 87k Modules DIO Control Demo When using I 87k modules for I O control of the LP 8X81 the program will be a little different according to the location of I 87k modules There are three conditions for the location of the I 87k modules 1 When l 87k DIO modules are in the LP 8X81 slots the two functions Open_Slot and ChangeToSlot must be added before using other
29. Send Receive string from LinPAC COM port read_sn Get Hardware Serial Number of LP 8X81 Table 5 1 Table 5 2 lists the demo that show how to use the I talk utility In the demo the l 8024 AO Module 1 8017H Al Module and 1 8055 DIO Module are all used and they are plugged into the slots 1 gt 2 and 3 of the LinPAC seperately Instruction Demo getlist Command getlist gt getlist Description List all module name in the LP 8X81 LinPAC 8X81 SDK Manual 32 Version 2 0 setdo Command setdo slot data gt setdo 33 Description Set i 8055 channel 1 and 2 on setao Command setao slot channel data gt setao 102 2 Description Set the i 8024 channel 0 output 2 2V getdi Command getdi slot type gt getdi 38 Description Get the 8 bits DI value from i 8055 getai Command getai slot channel gain mode gt getdi2000 Description Get the Al value from i 8017H setexdo Command 1 setexdo slot 1 data gt setexdo 2 1 55 2 setexdo slot comport data baudrate address gt setexdo 0 3 55 9600 2 Description 1 Set the dec digital output value to the module at slot 2 at COM1 2 Set the dec digital output value to the module at slot 0 at COMS setexao Command 1 setexao slot 1 value channel LinPAC 8X81 SDK Manual 33 Version 2 0 gt setexao 216 75
30. Serial USB CAN Ethernet _ 5 Switch RU 87Pn 28 2570 2571 NS 205PSE A es RS 485 1 0 Ethernet Unangan Wireless Get it Now P Top SERON RS 485 232 to er A Communication Unit ZigBee Converter Sultsi RoHS WEEE Compliance News amp Events Products News e ICP Das PAC Remote 10 Industrial xine There is no MRL Starting Take Screenshot xa K Fig 9 8 4 Provide Apache Server The Web Server Apache Server has been built in the LP 8X81 and it will be started automatically at boot time default the system will startup apache server at boot time if user don t startup web server at boot time user can type mv etc rc5 d S56httpd etc rc5 d xS56httpd to rename the S56httpd symbolic link for turn off running program automatically at boot time Users can type like http 10 0 9 68 to connect to the web server in the LP 8X81 If it returns a successful web page please refer to Fig 9 9 it means that the web server in the LP 8X81 has been started The index web page of Apache Server is in the path var www html index php LinPAC 8X81 SDK Manual 116 Version 2 0 2 phpinfo Windows Internet Explorer GO elno The LinPAC LX800 IP _ Fe et PRO SEO HAV ROSEA IAG RAW i Google G Goo A Er i Bookmarker PageRank y 53 blocked Y Check w 3 Translate v Q Look for Map v gt gt Settings KR S pmvintoo EE
31. Software Guide ICP DAS LinPAC 8X81 SDK Implement industry control with Linux Technique Warranty All products manufactured by ICP DAS Inc are warranted against defective materials for a period of one year from the date of delivery to the original purchaser Warning ICP DAS Inc assume no liability for damages consequent to the use of this product ICP DAS Inc reserves the right to change this manual at any time without notice The information furnished by ICP DAS Inc is believed to be accurate and reliable However no responsibility is assumed by ICP DAS Inc for its use nor for any infringements of patents or other rights of third parties resulting from its use Copyright Copyright 2008 2011 by ICP DAS Inc All rights are reserved Trademark The names used for identification only maybe registered trademarks of their respective companies License The user can use modify and backup this software on a single machine The user may not reproduce transfer or distribute this software or any copy in whole or in part LinPAC 8X81 SDK Manual 1 Version 2 0 Contents 1 Introduction 2 The LinPAC 8X81 SDK Introduction 3 The Architecture of LIBI8K A in the LP 8X81 4 LP 8X81 System Settings 4 1 Settings for the LP 8X81 Network 4 1 1 Setting the IP gt Netmask and Gateway 4 1 2 Setting of DNS 4 2 CF Compact Flash Card Usage AS USB DEVIC Usage anna ee AEE EEEE 4 3 1 Mount USB Device 4 3 2 Umount USB Device 4
32. _SlotAll Description If you have used the function Open_SlotAll to open all the slots in the LP 8X81 you can use the Close_SlotAll function to close all the slots in the LP 8X81 For example once you are finish sending or receiving data from many slots this function can be called to close all the slots rapidly Syntax C void Close_SlotAll void Parameter None Return Value None Example Close_Slot All slots in the LP 8X81 will be closed LinPAC 8X81 SDK Manual 40 Version 2 0 Remark m GetModuleType Description This function is used to retrieve which type of 8000 series I O module is plugged into a specific I O slot in the LP 8X81 This function performs a supporting task in the collection of information related to the system s hardware configurations Syntax C int GetModuleType char slot Parameter slot Input Specify the slot number in which the I O module is plugged into Return Value Module Type it is defined in the IdTable of slot c Example char slot 1 int moduleType Open_Slot slot moduleType GetModuleT ype slot Close_Slot Slot The l 8057 card is plugged in slot 1 of LP 8X81 and has a return Value 20 Remark LinPAC 8X81 SDK Manual 41 Version 2 0 GetNameOfModule Description This function is used to retrieve the name of an 8000 series I O module which is plugged into a specific I O slot in the LP 8X81 This func
33. a RD gt The index web page in directory R Nartwwwihtrl Linux localhostlocaldamain 2 6 18 1 Wed Aug 6 11 53 28 CST 2008 i586 May 9 2005 11 21 49 Jconfigure build i386 redhat inux host i386 redhat linux target i386 redhattinux gnu program prefix prefix usr exec prefix usr bindir usm bin sbindir jusr sbin sysconfdir ete datadir usr share includedir usriinclude ibdir usrilib libexecdir usrilibexec localstatedir Wvar sharedstatedir usr com mandir usr share man infodir usr share info cache file config cache with libdir lib with config file path etc with config file scan dir etc php d disable debug with pic disable rpath with bz2 with curl with exec dir usr bin with freetype dir usr with png dir usr enable gd native tf without gdbm with gettext with gmp with iconv with jpeg dir usr with openssl with png with pspell with expat dir usr with pcre regex usr with zlib with layout GNU enable exif enable fp enable magic quotes enable sockets enable sysvsem enable sysvshm enable Fig 9 9 9 5 Other Optional Function These optional functions are listed below all supported in the LP 8X81 1 Support MySQL lt MySQL is a small database server and it is Relational DataBase Man
34. agement System RDBMS By using MySQL users can add or delete data easily and it is open source and supports many platforms like UNIX gt Linux or Windows operating system If users want to startup MySQL server at boot time default system wouldn t startup mysql server at boot time user could follow under steps 1 Type cd etc rc5 d to into default run level please refer to Fig 9 10 2 Type In sv init d mysqld S60mysaql to make a symbolic link into the script file and it will be executed automatically at boot time please refer to Fig 9 10 LinPAC 8X81 SDK Manual 117 Version 2 0 if root localhost etc tc5 d alhost rc5 d 1 root root 16 ji Fig 9 10 2 Support PHP PHP is a kind of open source script language and used to design active web page When PHP combined with MySQL are cross platform It means that users can develop in Windows and serve on a Linux platform Refer to Fig 9 11 PHP has been built in the LP 8X81 Kernel so users just boot up LP 8X81 and can use PHP directly in the LP 8X81 Fig 9 11 LinPAC 8X81 SDK Manual 118 Version 2 0 3 Support Perl Perl Practical Extraction and Report Language is also a open source script language and has been built in the LP 8X81 Kernel so users just boot up LP 8X81 and can use Perl directly in the LP 8X81 LinPAC 8X81 SDK Manual 119 Version 2 0 Appendix A Service Information This appendix
35. amp offset location Remark 6 5 Analog Input Functions m 18017_lnit Description This function is used to initialize the I 8017H modules Analog input module into the specified slot Users must execute this function before trying to use other functions LinPAC 8X81 SDK Manual 63 Version 2 0 within the I 8017H modules Syntax C int 18017_Init int slot Parameter slot Input specified slot of the LP 8X81 system Range 1 to 7 Return Value The version of library Example int slot 1 ver ver 8017_Init slot The I 8017H card is plugged in slot 1 of LP 8X81 and initializes the module 1 8017H Remark This function can be applied on module 8017H and I 8017HS m 18017 SetLed Description Turns the I 8017H modules LED s on off They can be used to act as an alarm Syntax C void 18017 _SetLed int slot unsigned int led Parameter slot Input specified slot of the LP 8X81 system Range 1 to 7 led Input range from 0 to Oxffff Return Value LinPAC 8X81 SDK Manual 64 Version 2 0 None Example int slot 1 unsigned int led 0x0001 18017_SetLed slot led There will be a L A LED light on channel 0 of the I 8017H card which is plugged in slot 1 on the LP 8X81 Remark This function can be applied on module 8017H and I 8017HS m 18017 _SetChannelGainMode Description This function is used to configure the range and mod
36. apdos p 8x8x you can download the latest version of LP 8X81 SDK and the Manual And then follows the below steps in order to get the development toolkit which has been provided by ICP DAS for the easy application of the LP 8X81 embedded controller platform 1 User can connect to LP 8X81 through Ethernet 1 Ethernet 2 by using the command telnet refer to Fig 4 1 Fig 4 2 or by using putty software refer to Fig 4 3 Fig 4 4 2 After user connect to LP 8X81 user could type command wget http ftp icodas com pub cd linpac napdos p 8x8x lp 8x8x sdk linpac 8x81_sdk tar gz to get the latest version of LP 8X81 SDK 3 To type tar zxf linpac 8X81_sdk tar gz to decompress tar file refer to Fig 2 1 root localhost cCDB tar root localhost CD cd root localhost LinPAC 8X8 ChangeLog root localhost LinPAC s8Xxe Fig 2 1 Once user decompress the SDK file user can find the files for the library and demo in the following paths LinPAC 8X81 SDK Manual 8 Version 2 0 The Libi8k a path is LinPAC 8X81_sdk lib The include files path is LinPAC 8X81_sdk include The demo path is LinPAC 8X81_sdk examples LinPAC 8X81 SDK Manual 9 Version 2 0 3 The Architecture of LIBI8K A in the LP 8X81 The libi8k a is a library file that is designed for 17000 8000 87000 applications running in the LP 8X81 Embedded Controller using the Linux OS Users can apply it to develop their own applicat
37. b1 1 983 990328 Partition 1 has different physical logical endings phys 982 31 63 logical 982 15 63 root localhost Fig 4 13 LinPAC 8X81 SDK Manual 18 Version 2 0 4 3 USB Device Usage Before accessing the USB device users need to mount the USB device to the LP 8X81 Because it will not auto mount the USB device in the LP 8X81 After Users mount the USB device ex USB disk to the LP 8X81 they can access the USB device 4 3 1 Mount USB Device The steps are as follows 1 Type mkdir mnt usb to build a usb directory 2 Type mount dev sda1 mnt usb to mount the USB device to the usb directory and type Is mnt usb to see the content of USB device 4 3 2 Umount USB Device Before users pull out the USB device from the LP 8X81 users need to type the umount mnt usb command first Then pull out the USB device to prevent any damage to usb device 4 4 VGA Resolution There are two modes 640x480 800x600 1024x768 default VGA Resolution supported in the LinPAC VGA resolution and the default setting is 800x600 If users want to change the VGA resolution Please follow below steps 1 Type user ID and password login to desktop 2 Choose menu bar Desktop gt Preferences gt Screen Resolution 3 Use Screen Resolution Preferences to adjust VGA Resolution Please refer to Fig 4 14 LinPAC 8X81 SDK Manual 19 Version 2 0 Applications Pla
38. baudrate of I 87k modules in the network of RS 485 need to be set by DCON Utility 3 Open com1 internal serial port of LP 8X81 will be modified to open com3 RS 485 port of LP 8X81 The address and baudrate of the I 87054 in the RS 485 network are set to be 06 and 9600 separately by the DCON Utility The source code of this demo program LinPAC 8X81 SDK Manual 89 Version 2 0 i87kdio_87k c is as follows include lt stdio h gt include lt stdlib h gt include msw h char szSend 80 szReceive 80 DWORD dwBuf 12 float fBuf 12 int main int i wRetVal DWORD temp Check Open_Com3 wRetVal Open_Com COM3 9600 Data8Bit NonParity OneStopBit if wRetVal gt 0 printf open port failed n return 1 digital output DigitalOut_87k dwBuf 0 3 COM Port dwBuf 1 06 Address dwBuf 2 0x87054 ID dwBuf 3 0 CheckSum disable dwBuf 4 100 TimeOut 100 msecond dwBuf 5 Oxff digital output dwBuf 6 0 string debug wRetVal DigitalOut_87k dwBuf fBuf szSend szReceive DO Output printf DO Value u dwBuf 5 digital Input Digitalln_87k dwBuf 0 3 COM Port dwBuf 1 06 Address dwBuf 2 0x87054 ID dwBuf 3 0 CheckSum disable dwBuf 4 100 TimeOut 100 msecond LinPAC 8X81 SDK Manual 90 Version 2 0 dwBuf 6 0 string debug getch Digitalln_87k dwBuf fBuf szSend szR
39. be set by DCON Utility 3 Open com1 internal serial port of LP 8X81 will be modified to open com3 LinPAC 8X81 SDK Manual 94 Version 2 0 RS 485 port of LP 8X81 The addresses I 87022 and 87017 are in the RS 485 network and are set to be 01 and 02 separately and the baudrate is 9600 by DCON Utility The source code of this demo program i87kaio_87k c is as follows include lt stdio h gt include lt stdlib h gt include msw h char szSend 80 szReceive 80 DWORD wBuf 12 DWORD wBuf7 12 float fBuf 12 int main int i j wRetVal DWORD temp Check Open_Com3 wRetVal Open_Com COM3 9600 Data8Bit NonParity OneStopBit if wRetVal gt 0 printf open port failed n return 1 Analog output 87022 AO i 0 wBuf 0 3 COM Port wBuf 1 0x01 Address wBuf 2 0x87022 D wBuf 3 0 CheckSum disable wBuf 4 100 TimeOut 100 msecond wBuf 5 i Channel Number of AO wBuf 6 0 string debug fBuf 0 2 5 AO Value wRetVal AnalogOut_87k wBuf fBuf szSend szReceive LinPAC 8X81 SDK Manual 95 Version 2 0 if wRetVal printf AO of 87022 Error Error Code d n wRetVal else printf AO of 87022 channel d f n i fBuf 0 Analog Input 87017 Al j 1 wBuf7 0 3 COM Port wBuf7 1 0x02 Address wBuf7 2 0x87017 D wBuf7 3 0 CheckSum disable wBuf7 4 100 TimeOu
40. ces System Si f 5 roots Home t Screen Resolution Preferences Default Settings Resolution Refresh rate 75 Hz Rotation 3 Help Wil x Close II wW Apply Fig 4 14 4 5 Running applications automatically at boot time A run level determines which programs are executed at system startup Run level 5 is the default run level of LP 8X81 The contents of run level are in the etc init d directory that directory contains the scripts executed at boot time These scripts are referenced by symbolic links in the etc rc5 d These links are named S lt 2 digit number gt lt original name gt The numbers determine the order in which the scripts are run from 00 to 99 the lower number would earlier executed Scripts named with an S are called with start and named with a K or x are called with stop 4 5 1 Making program run at boot time Making program run at boot time you should create a startup script placed in etc init d directory that runs the required commands for executed automatically at boot time and be symbolically linked to etc rc5 d directory The steps are as follows 1 Type vi etc init d hello to edit a script that would like to executed program filename is hello Type wq to save and quit the script Refer to the Fig 4 11 2 Type chmod 755 etc init d hello to change authority 3 Type cd etc rc5 d to into default run level LinPAC 8X81 SDK Manua
41. d If you want to control ICP DAS I O remote modules like i7k i8k and i87k through COM2 or COM3 or COM4 of the LinPAC the functions are all the same with DCON DLL And if you want to control i8k modules that are plugged in the slots of the LinPAC then the functions are different and they are described as follows 6 1 System Information Functions m ChangeToSlot Description This function is used to dedicate serial control to the specified slots for the control of the I 87k series The serial bus in the LP 8X81 backplane is for mapping through to COM1 For example if you want to send or receive data from a specified slot you need to call this function first Then you can use the other series functions Syntax C void ChangeToSlot char slot Parameter slot Input Specify the slot number in which the I O module is plugged into Return Value LinPAC 8X81 SDK Manual 37 Version 2 0 None Example char slot 1 ChangeToSlot slot The first slot is specified as COM1 port in LP 8X81 m Open_Slot Description This function is used to open and initiate a specifed slot in the LP 8X81 The 8k or I 87k modules in the LP 8X81 will use this function For example if you want to send or receive data from a specified slot this function must be called first Then the other functions can be used later Syntax C int Open_Slot int slot Parameter slot Input Specify the slot number in which th
42. d is icpdas BEE Microsoft Windows XP Lh 5 1 2600 001 Microsoft Corp c SDocuments and Settings user gt telnet 10 0 9 42 Fig 4 1 CPDAS Linux tem Golden 6 18 on an i586 ogin Wed Jan 14 14 48 48 from 10 0 9 32 not installed Fig 4 2 3 To connect to LP 8X81 through Ethernet Port by using Putty software please LinPAC 8X81 SDK Manual 12 Version 2 0 refer to Fig 4 3 Fig 4 4 The default ID is root and password is icpdas FE PuTTIY Configuration Category Sas Basic options for your PuT TY session E cogging Specify your connection by host name or IP address Terminal Keyboard Ho Mame or IP address Port Bell 10 0 9868 Remote host IP Features Protocol windows Raw Telnet Rlogin Appearance Load save or delete a stored session Behaviour Translation Saved Sessions Selection Colours Default Settings Connection 7188E Data winSCP temporary session Proxy T elnet Rlogin SSH Kex Aath gt 11 Tunnels Open Cancel Fig 4 3 Close window on exit O Always O Never Only on clean exit i root localhost rd os LIU ZU 58 ZUU5 Irom LU U 3 3Z 1 root locall Fig 4 4 In this section we will introduce how to setup the LP 8X81 configuration Let users can use the LP 8X81 more easily LinPAC 8X81 SDK Manual 13 Version 2 0 4 1 Settings for the LP 8X81 Network The LP 8X81 netwo
43. e int slot 1 ch 0 gain 0 hdata hdata_cal float fdata 18017_SetChannelGainMode slot ch gain 0 hdata 18017 _GetCurAdChannel_ Hex slot hdata_cal 18017_HEX_Cal hdata fdata CalHex_TO_FLOAT hdata_cal gain You can convert calibrated Hex Value to calibrated Float Value Remark This function can be applied on module 8017H and I 8017HS LinPAC 8X81 SDK Manual 72 Version 2 0 m ARRAY CalHEX TO FLOAT Description This function is used to convert the data from calibrated hex values to calibrated float values in the array mode based on the configuration of the gain Voltage or current Please refer to the Fig 6 2 Syntax C void ARRAY_CalHex_TO_FLOAT int HexValue float FloatValue int gain int len Parameter HexValue Input data array in calibrated Hex format FloatValue Output Converted data array in calibrated float format gain Input Input range len input ADC data length Return Value The Calibrated Float Value Example int slot 1 ch 0 gain 0 hdata_cal 10 float fdata 10 fdata ARRAY_CalHex_TO_FLOAT hdata_cal fdata gain len You can convert ten calibrated Hex Values to ten calibrated Float Values Remark This function can be applied on module I 8017H and I 8017HS Function of 1 3 m 18017 _GetCurAdChannel_Hex_Cal Description Obtain the calibrated analog input values in the Hex format directly from the analog input module
44. e I O module is plugged into Return Value 0 is for Success Not 0 is for Failure Example Int slot 1 Open_Slot slot The first slot in the LP 8X81 will be open and initiated Remark m Close Slot Description LinPAC 8X81 SDK Manual 38 Version 2 0 If you have used the function of Open_Slot to open the specifed slot in the LP 8X81 you need to use the Close_Slot function to close the specifed slot in the LP 8X81 The 8k or I 87k modules in the LP 8X81 will use this function For example once you have finished sending or receiving data from a specified slot this function would then need to be called Syntax C void Close_Slot int slot Parameter slot Input Specify the slot number in which the I O module is plugged into Return Value None Example Int slot 1 Close_Slot slot The first slot in the LP 8X81 will be closed Remark m Open_SlotAll Description This function is used to open and initiate all slots in the LP 8X81 For example if you want to send or receive data from multiple slots you can call this function to simplify your program Then you can use the other functions later Syntax C int Open_SlotAll void LinPAC 8X81 SDK Manual 39 Version 2 0 Parameter None Return Value 0 is for Success Not 0 is for Failure Example Open_SlotAll All slots in the LP 8X81 will be open and initiated Remark m Close
45. e of the analog input channel for the I 8017H modules in the specified slot before using the ADC analog to digital converter Syntax C void 18017_SetChannelGainMode int slot int ch int gain int mode Parameter slot Input Specify the slot in the LP 8X81 system Range 1 to 7 ch Input Specify the I 8017H channel Range 0 to 7 Specify the I 8017HS channel Range 0 to 15 gain Input input range 0 10 0V 1 5 0V 2 2 5V 3 1 25V 4 20mA mode Input 0 normal mode polling LinPAC 8X81 SDK Manual 65 Version 2 0 Return Value None Example int slot 1 ch 0 gain 0 18017_SetChannelGainMode slot ch gain 0 The I 8017H card is plugged in slot 1 of LP 8X81 and the range of the data value from channel 0 for I 8017H will be 10 10 V Remark This function can be applied on module 8017H and I 8017HS od m Calibraiei Float Value Read 1 Not Calibrated 3 Hex Value Calibrated Hex Value I 8017H 8017H Flow Diagram Fig 6 2 Function of 1 m 18017 _GetCurAdChannel_ Hex Description Obtains the non calibrated analog input value in the Hex format from the analog input I 8017H modules Please refer to Fig 6 2 Syntax C int 18017_GetCurAdChannel_ Hex int slot Parameter slot Input specified slot of the LP 8X81 system Range 1 to 7 LinPAC 8X81 SDK Manual 66 Version 2 0 Return Value
46. eceive DI Input printf DI u dwBuf 5 digital output Close DO dwBuf 0 3 COM Port dwBuf 1 06 Address dwBuf 2 0x87054 ID dwBuf 3 0 CheckSum disable dwBuf 4 100 TimeOut 100 msecond dwBuf 5 0x00 digital output dwBuf 6 0 string debug getch push any key to continue wRetVal DigitalOut_87k dwBuf fBuf szSend szReceive Close_Com COMS3 return 0 All the steps from programming to execution are the same as those in the section 7 1 The result of execution refers to Fig 7 3 Ke root localhost goldentask U tility i8k sre 20080729 examples i87k root localhost i87k 1s 187 kdio root localhost 187k 187kdio DO Value 255 DI 2 root localhost 187k Fig 7 3 LinPAC 8X81 SDK Manual 91 Version 2 0 7 3 3 1 87k Modules in slots of I 8000 Controller If the I 87k DIO modules are in the l 8000 controller slots 87k modules will be regarded as I 8k modules and so please refer to DI DO control of I 8k modules in the section 7 5 7 4 1 87k Modules AIO Control Demo When using I 87k modules for I O control of the LP 8X81 according to the location of the I 87k modules the program will be a little different There are three conditions for the location of the 87k modules 1 When the I 87k AIO modules are in the LP 8X81 slots the two functions Open_Slot and ChangeToSlot must be added before using the o
47. ectory Parameter 1 i it will show the warning message when deleting Example rm i test exe 2 r delete directory despite that it isn t empty Example rm r Test 3 f it will not show a warning message when deleting Example rm f test exe 5 1 6 Linux Command cp cp copy file gt like copy in DOS cp parameter source destination Example cp test exe root Test test exe 5 1 7 Linux Command mv mv move or rename file or directory gt like move or ren in DOS mv parameter source file or directory destination file or directory Example mv test exe testi exe Example mv test exe root Test 5 1 8 Linux Command pwd pwd show the current path LinPAC 8X81 SDK Manual 24 Version 2 0 5 1 5 1 5 1 5 1 5 1 5 1 9 Linux Command who who show the on line users 10 Linux Command chmod chmod change authority of file chmod file gt means owner group all users For example chmod 754 test exe 754 gt 111 read write execute 101 read write execute 100 read write execute The first number 7 owner can read and write and execute files The second number 5 group can only read and execute files The third number 4 all users can only read files 11 Linux Command uname uname show the version of linux 12 Linux Command ps ps show the procedures that execute now
48. et DEVICES etho BOOTPROTO static I Toy N Dl or CH es Oe Oe Zu 2 ITPADDR 10 0 9 68 NE TMASK 255 255 255 0 NE TWORK 10 0 9 0 ONBOOT yes TYPE Ethernet Fig 4 9 LinPAC 8X81 SDK Manual 16 Version 2 0 ZAarmot sloealhostlptcizyeront DEVICE eth1 BOOTPROTO dhcep HWADDR 00 10 F3 12 BB 99 ONBOOT yes TYPE Ethernet DEVICE ethl BOOTPROTO static BROADCAST 10 0 9 255 IPADDR 10 0 9 15 NE TMASK 255 255 255 0 NETWORK 10 0 9 0 ONBOOT yes TYPE Ethernet Fig 4 10 After finish the LinPAC network setting users can type ifconfig to see the network setting Refer to the Fig 4 11 root localhost ifconfig eth0 Link encap Ethernet HWaddr 00 10 F3 12 BB 92 inet addr 10 0 9 68 Bcast 10 0 9 255 Mask 255 255 255 UP BROADCAST RUNNING MULTICAST MTU 1500 Metric 1 RX packets 14208 errors 0 dropped 0 overruns 0 frame 0 TX packets 4033 errors 0 dropped O overruns O carrier 0 collisions 0 txqueuelen 1000 RX bytes 1436281 1 3 MiB TX bytes 479736 468 4 KiB Interrupt 7 Base address 0x4000 Link encap Ethernet HWaddr 00 10 F3 12 BB 93 inet addr 10 0 9 15 Bcast 10 0 9 255 Mask 255 255 255 UP BROADCAST RUNNING MULTICAST MTU 1500 Metric l RX packets 15253 errors 0 dropped 0 overruns O frame 0 TX packets 260 errors 0 dropped 0 overruns 0 carrier 0 collisions 0 txqueuelen 1000 RX bytes 1543038 1 4 MiB TX bytes 9260 9 0 KiB Interrupt 15 Base address 0x6000 Link encap Local Loopback inet addr 127 0 0
49. follow the LinPAC 8X81 SDK Manual 98 Version 2 0 below steps to configure the hardware 1 Put the l 8055 module in slot 0 of I 8000 controller 2 Install 8k232 exe or R232_300 exe to flash memory of l 8000 controller as firmware 3 Connect the com3 of LP 8X81 to the com1 of l 8000 controller with the RS 232 cable The address of l 8000 controller is 01 and the baudrate is 115200 that can be modified by DCON Utility The result of this demo lets DO channel 0 7 of 1 8055 output and DI channel 0 of l 8055 input The source code of this demo program is as follows include lt stdio h gt include lt stdlib h gt include msw h char szSend 80 szReceive 80 DWORD dwBuf 12 float fBuf 1 2 int main int i wRetVal DWORD temp Check Open_Com3 wRetVal Open_Com COM3 115200 Data8Bit NonParity OneStopBit if wRetVal gt 0 printf open port failed n return 1 digital output DigitalOut_8K dwBuf 0 3 COM Port dwBuf 1 01 Address dwBuf 2 0x8055 D dwBuf 3 0 CheckSum disable LinPAC 8X81 SDK Manual 99 Version 2 0 dwBuf 4 100 TimeOut 100 msecond dwBuf 5 Oxff digital output dwBuf 6 0 string debug dwBuf 7 1 slot number wRetVal DigitalOut_8K dwBuf fBuf szSend szReceive if wRetVal printf DO of 8055 Error Error Code d n wRetVal else printf DO of 8055 0x x dwBuf 5 dig
50. functions for the I 87k modules and the function of Close_Slot also needs to be added to the end of the program Please refer to demo in section 7 3 1 2 When l 87K DIO modules are in the I 87k I O expansion unit slots then please refer to the demo in section 7 3 2 3 When the l 87k DIO modules are in the l 8000 controller slots then the I 87k modules will be regarded as I 8k modules and so please refer to I O control of I 8k modules in section 7 5 2 7 3 1 1 87k Modules in slots of LP 8X81 This demo i87kdio c will illustrate how to control the DI DO with the 1 87054 module 8 DO channels and 8 DI channels The I 87054 module is in slot 3 of the LP 8X81 The address and baudrate in the LP 8X81 are constant and they are 00 and 115200 respectively The result of this demo lets DO channel 0 7 of 1 87054 output and DI channel 1 of I 87054 input The source code of this demo program is as follows include lt stdio h gt include lt stdlib h gt include msw h char szSend 80 szReceive 80 DWORD dwBuf 12 float fBuf 12 LinPAC 8X81 SDK Manual 87 Version 2 0 int main int i wRetVal DWORD temp Check Open_Slot wRetVal Open_Slot 0 if wRetVal gt 0 printf open Slot failed n return 1 Check Open_Com1 wRetVal Open_Com COM1 115200 Data8Bit NonParity OneStopBit if wRetVal gt 0 printf open port failed n return 1 Choose Slot3 ChangeToSlo
51. hello symbolic link for turn off running program automatically at boot time LinPAC 8X81 SDK Manual 22 Version 2 0 5 Instructions for the LP 8X81 In this section some Linux instructions that are often used will be introduced The use of these instructions in linux is very familiar with those in DOS and generally they are used in lower case 5 1 Basic Linux Instructions 5 1 1 Linux Command ls Is list the file information gt like dir in DOS Parameter 1 l list detailed information of file Example Is l 2 a list all files including hidden files Example Is a 3 t list the files that are arranged by time from new to old 5 1 2 Linux Command cd cd directory Change directory gt like cd in DOS Parameter 1 move to the upper directory Example cd 2 move back to the root directory Example cd 3 divided sign for examples cd root i8k 5 1 3 Linux Command mkdir mkdir create the subdirectory gt like md in DOS mkdir parameter subdirectory Example mkdir owner LinPAC 8X81 SDK Manual 23 Version 2 0 5 1 4 Linux Command rmdir rmdir delete remove the subdirectory and it must be empty gt like rd in DOS mkdir parameter subdirectory Example rmdir owner 5 1 5 Linux Command rm rm delete file or directory gt like del or deltree in DOS rm parameter file or dir
52. id DisableWDT void unsigned int WatchDogSWEven void void ClearWDTSWEven unsigned int rcsr 8 4 List Of EEPROM Read Write Functions void Enable_EEP void void Disable_EEP void unsigned char Read_EEP int block int offset void Write_EEP int block int offset unsigned char data 8 5 List Of Analog Input Functions int 18017_Init int slot void 18017 _SetLed int slot unsigned int led void 18017_SetChannelGainMode int slot int ch int gain int mode int 18017_GetCurAdChannel_ Hex int slot int 18017_AD_POLLING int slot int ch int gain unsigned int datacount int DataPtr float HEX_TO_FLOAT_Cal int HexValue int slot int gain void ARRAY_HEX_TO_FLOAT_Cal int HexValue float FloatValue int slot int gain int len int 18017 _Hex_Cal int data int 18017 _Hex_Cal_Slot_Gain int slot int gain int data float CalHex_TO_FLOAT int HexValue int gain void ARRAY_CalHex_TO_FLOAT int HexValue float FloatValue int gain int len int 18017_GetCurAdChannel_Hex_Cal int slot int 18017_AD_POLLING_Cal int slot int ch int gain unsigned int datacount LinPAC 8X81 SDK Manual 109 Version 2 0 int DataPtr int 18017_GetCurAdChannel_Float_Cal int slot 8 6 List Of Analog Output Functions void 18024 _Initial int slot void 18024 VoltageOut int slot int ch float data void 18024 CurrentOut int slot int ch float cdata void 18024 VoltageHexOut int slot int ch int hdata void 18024 CurrentHexOut int slot int ch int hda
53. in the analog output module l 8024 which is plugged into the slot in the LP 8X81 system Syntax C void 18024 CurrentHexOut int slot int ch int hdata LinPAC 8X81 SDK Manual 79 Version 2 0 Parameter slot Input Specify the LP 8X81 system slot Range 1 to 7 ch Input Output channel Range 0 to 3 hdata Input Output data with hexadecimal data range Oh 3FFFh gt Current Output 0 20 mA Return Value None Example int slot 1 ch 0 data 0x2000 18024 CurrentHexOut slot ch data Output the 10 0mA current from the channel 0 of l 8024 module Remark This function can be applied on module l 8024 6 7 The Software Develop Toolkit Error Code Error 1D 0 NoError 1 FunctionError 2 PortError 3 BaudRateError 4 DataError 5 StopError 6 ParityError 7 CheckSumError 8 ComPortNotOpen 9 SendThreadCreateError LinPAC 8X81 SDK Manual 80 Version 2 0 10 SendCmdError 11 ReadComStatusError 12 StrCheck Error 13 CmdError 14 X 15 TimeOut 16 X 17 Moduleld Error 18 AdChannelError 19 UnderRange 20 ExceedRange 21 InvalidateCounterNo 22 InvalidateCounterValue 23 InvalidateGateMode 24 InvalidateChannelNo 25 ComPortiInUse LinPAC 8X81 SDK Manual 81 Version 2 0 7 Demo of LP 8X81 Modules With C Language In this section we will focus on examples for the description and
54. ingle channel status ON OFF of a Digital Output module Syntax C void DO_8 BW int slot int bit int data void DO_16_ BW int slot int bit int data void DO_32_ BW int slot int bit int data void DIO_DO_8_BW int slot int bit int data void DIO_DO_16_BW int slot int bit int data Parameter slot Input the slot number where the I O module is plugged into bit Input channel of module data Input channel status on 1 off 0 Return Value None Example int slot 1 bit 0 data 1 Open_Slot slot DO_32_BW slot bit data Close_Slot slot The l 8041 module is plugged in slot 1 of LP 8X81 and just turn on channel 0 of l 8041 Remark These functions can be applied on modules DO 8 channel 1 8060 1 8064 l 8065 l 8066 l 8068 and l 8069 LinPAC 8X81 SDK Manual 52 Version 2 0 DO 16 channel 1 18037 1 8056 and l 8057 DO 32 channel 1 8041 m DI 8 BW DI 16 BW DI 32 BW Description This function is used to Readback assigned single channel status ON OFF from a Digital Input module Syntax C int DI_8 BW lt int slot int bit int DI_16_ BW int slot int bit int DI_32_BW int slot int bit Parameter slot Input the slot number where the I O module is plugged into bit Input channel of module Return Value None Example int slot 1 bit 0 Open_Slot slot printf DI channel d d n bit DI_32_BW slot bit
55. ions with GNU C language In order to assist users to build their project quickly we provide many demo programs Based on these demo programs users can easily understand how to use these functions and develop their own applications within a short period of time The relationships among the libi8k a and user s applications are depicted as Fig 3 1 I 7000 8000 87000 series Modules functions Driver Physical Layer Fig 3 1 Functions for LP 8X81 Embedded Controller are divided into sub groups for LinPAC 8X81 SDK Manual 10 Version 2 0 ease of use within the different applications System Information Functions Digital Input Output Functions Watch Dog Timer Functions EEPROM Read Write Functions Analog Input Functions OO ee ee Analog Output Functions The functions in the Libi8k a are specially designed for LP 8X81 Users can easily find the functions they need for their applications from the descriptions in chapter 6 and in the demo programs provided in chapter 7 LinPAC 8X81 SDK Manual 11 Version 2 0 User can use the three methods to connect to LP 8X81 to configure system check system status and startup stop system service 1 To connect to LP 8X81 through serial port COM2 by using Windows communication software Hyper Terminal baud rate is 38400 2 To connect to LP 8X81 through Ethernet port by using command telnet please refer to Fig 4 1 4 2 The default ID is root and passwor
56. ital Input Digitalln_8K dwBuf 0 3 COM Port dwBuf 1 01 Address dwBuf 2 0x8055 ID dwBuf 3 0 CheckSum disable dwBuf 4 100 TimeOut 100 msecond dwBuf 6 0 string debug dwBuf 7 1 slot number getch Digitalln_8K dwBuf fBuf szSend szReceive printf DI u dwBuf 5 digital output Close DO dwBuf 0 3 COM Port dwBuf 1 01 Address dwBuf 2 0x8055 ID dwBuf 3 0 CheckSum disable dwBuf 4 100 TimeOut 100 msecond dwBuf 5 0x00 digital output dwBuf 6 0 string debug dwBuf 7 1 slot number getch push any key to continue wRetVal DigitalOut_8K dwBuf fBuf szSend szReceive Close_Com COMS3 return 0 LinPAC 8X81 SDK Manual 100 Version 2 0 All the steps from programming to execution are the same as those in the section 7 1 The result of execution refers to Fig 7 6 B root localhost goldentask U tility i8k src 20080729 examples i8k rootf localhost i8k 1s 18kd1io_ 8k root localhost 18k i8kdio 8k DO of 8055 Oxff DI 1 root localhost i8k Fig 7 6 7 6 I 8k Modules AIO Control Demo 18000 c of Libi8k a is the source file for i8k modules in slots of l 8000 controller Slot c of Libi8k a is the source file for i8k modules in slots of the LP 8X81 Therefore the functions for the i8k modules in LP 8X81 slots and in the l 8000 controller slots are completely differe
57. l 20 Version 2 0 4 Type In sv init d hello etc rc5 d S87hello to make a symbolic link into the script file and it will be executed automatically at boot time Refer to the Fig 4 15 Fig 4 16 fetc re d init d functions echo amp amp success failure Taj sto Taj sto Fr ne amp amp success failure echo restart echo Es v amp amp success failure echo echo RETVAL Fig 4 15 root localhost rc5 d In sv init d hello S87hello reate symbolic link S87hello to init d hello root localhost rc5 d ls al otal 8 drwxr xr x 2 root root 4096 Aug 17 11 21 drwxr xr x root root 4096 Mar 8 23 08 LEWXEWXEWX root root 17 Aug 1 13 20 S50ifplugd gt init d ifplugd LEWXEWXEWX root root 14 Aug 1 13 20 S55sshd gt init d sshd LEWXEWXEWX root root 15 Aug 1 13 20 S5 httpd gt init d httpd lL EWXEWXIWX root root 13 Aug 2 10 46 S85qpm gt init d qpm LEWXEWXEWX root root 15 Aug 17 11 21 S87hello gt init d hello LEWXEWXEWX root root 20 Aug 1 13 20 S97messagebus gt init d messagebus LEWXEWXEWX root root 14 Aug 1 13 20 S98slot gt init d slot lL EWXEWXEWX root root 11 Aug 1 13 20 S99local gt rc local Fig 4 16 LinPAC 8X81 SDK Manual 21 Version 2 0 4 5 2 Disabling program run at boot time The steps are as follows 1 Type cd etc rc5 d to into default run level 2 Type mv S87hello xS87hello to rename the S87
58. l Communication o Functions of COM PORT Timer c Sio c I7k c 17000 c I8000 c 187000 c Slot c Like Uart dll Like I7000 dll In Windows In Windows Structure of Libi8k a Fig 6 1 Functions 1 and 2 in the Libi8k a are the same as with the DCON DLL Driver including Uart dll and 17000 dll as used in the DCON modules 1 7000 1 8000 I 87000 in serial communication You can refer to the DCON DLL Driver manual which includes the functions on how to use DCON modules The DCON DLL Driver has already been wrapped into the Libi8k a Functions 3 of the Libi8k a consist of the most important functions as they are specially designed for I 8000 modules in the LP 8X81 slots They are different from functions 1 and 2 because the communication of I 8000 modules in the LP 8X81 slots are parallel and not serial LinPAC 8X81 SDK Manual 36 Version 2 0 Therefore ICP DAS rewrote 18000 c to Slot c especially for I 8000 modules in the LP 8X81 slots Here we will introduce all the funcitions for slot c and they can be divided into eight parts for ease of use 1 System Information Functions Digital Input Output Functions Watch Dog Timer Functions EEPROM Read Write Functions Analog Input Functions oO SN Analog Output Functions When using the development tools to develop applications the msw h file must be included in front of the source program and when building applications Libi8k a must be linke
59. l unit in the LP 8X81 system This EEPROM is divided into 256 blocks 0 to 255 and each block is 64 bytes in length from offset 0 to 63 This EEPROM with its accessing APIs provides another mechanism for storing critical data inside non volatile memory Syntax C unsigned char Read_EEP int block int offset Parameter block Input the block number of EEPROM offset Input the offset within the block Return Value Data read from the EEPROM Example int block offset unsigned char data data ReadEEP block offset Returned value data read an 8 bit value from the EEPROM block amp offset Remark LinPAC 8X81 SDK Manual 62 Version 2 0 m Write EEP Description To write one byte of data to the EEPROM There is a 16K byte EEPROM in the main control unit of the LP 8X81 system This EEPROM is divided into 256 blocks 0 to 255 and each block is 64 bytes in length from the offset of 0 to 63 This EEPROM with its accessing APIs provides another mechanism for storing critical data inside non volatile memory Syntax C void Write_EEP int block int offset unsigned char data Parameter block Input the block number of EEPROM offset Input the offset within the block Data Input data to write to EEPROM Return Value None Example int block offset unsigned char data 10 WriteEEP block offset data Writes a 10 value output to the EEPROM block
60. lue None Example int slot 1 unsigned int ret unsigned short config 0x0000 UDIO_WriteConfig_16 slot config ret UDIO_ReadConfig_16 slot printf Read the I O Type is 0x 04lx n r ret The l 8050 card is plugged in slot 1 of LP 8X81 WriteConfig 0x0000 ch O ch15 is DI mode Read the I O Type is 0x0000 Remark This function can be applied on modules l 8050 m UDIO_DO16 Description This function is used to output 0 15 bits data to a universal DIO module according to the channel configuration The 0 15 bits of output data are mapped onto the 0 15 output channels for their specific universal DIO modules respectively Syntax C void UDIO_DO16 int slot unsigned short config LinPAC 8X81 SDK Manual 55 Version 2 0 Parameter slot Input the slot number where the I O module is plugged into config Input output data Return Value None Example int slot 1 unsigned int data unsigned short config 0x00ff UDIO_WriteConfig_16 slot config scanf d amp data UDIO_DO16 slot data printf DO ChO Ch7 of 1 8050 in Slot d 0x x n r slot data The l 8050 card is plugged in slot 1 of LP 8X81 WriteConfig 0x00ff ch O ch7 is DO mode and ch8 ch15 is DI mode Input DO value 255 DO ChO Ch7 of l 8050 in Slot 1 Oxff Remark This function can be applied on modules l 8050 m UDIO_DI16 Description This function is used to input 0 1
61. nCon 8000 I 8K In LinCon 8000 Fig 7 9 Fig 7 10 is the table of source files for the I 7000 I 8000 I 87000 modules in different locations When using ICP DAS modules in the LP 8X81 this table will be helpful to let users understand which source files of the libi8k a should be called Module Location LinPAC 8X81 SDK Manual 107 Version 2 0 8 LP 8X81 Library Reference in C Language In this chaper all the functions of libi8k will be listed to allow users to able to look them up quickly 8 1 List Of System Information Functions void ChangeToSlot char slot int Open_Slot int slot void Close_Slot int slot int Open_Slot void void Close_SlotAll void int GetModuleType char slot int GetNameOfModule char slot 8 2 List Of Digital Input Output Functions void DO_8 int slot unsigned char data void DO_16 int slot unsigned int data void DO_ 32 int slot unsigned int data unsigned char DI_8 int slot unsigned int DI_16 int slot unsigned long DI_32 int slot void DIO_DO_ amp int slot unsigned char data void DIO_DO_16 int slot unsigned int data unsigned char DIO_DI_ 8 int slot unsigned char DIO_DI_16 int slot unsigned short UDIO_WriteConfig_16 unsigned short UDIO_ReadConfig_16 void UDIO_DO16 int slot unsigned short config unsigned short UDIO_DI16 int slot LinPAC 8X81 SDK Manual 108 Version 2 0 8 3 List Of Watch Dog Timer Functions void EnableWDT unsigned int msecond vo
62. nPAC 8X81 SDK Manual 48 Version 2 0 Return Value None Example int slot 1 unsigned int data 3 DIO_DO_16 slot data The l 8042 card is plugged in slot 1 of LP 8X81 and can turn on the channels 0 and 1 t not only outputs a value but also shows 32LEDs Remark This function can be applied on modules l 8042 and l 8050 m DIO_DI_8 Description This function is used to obtain 8 bit data from DIO modules These modules run 8 digital input and 8 digital output channels simultaneously The 0 7 bits of intput data are mapped onto the 0 7 iutput channels for their specific DIO modules respectively Syntax C Unsigned char DIO_DI_8 int slot Parameter slot Input the slot number where the I O module is plugged into Return Value Input data Example int slot 1 unsigned char data data DIO_DI_8 slot LinPAC 8X81 SDK Manual 49 Version 2 0 The l 8054 card is plugged in slot 1 of LP 8X81 and has inputs in channel 0 and 1 Returned value data 0xfC Remark This function can be applied in modules l 8054 1 8055 and l 8063 m DIO DI 16 Description This function is used to obtain 16 bit data from DIO modules These modules run 16 digital input and 16 digital output channels simultaneously The 0 15 bits of iutput data are mapped onto the 0 15 iutput channels for their specific DIO modules respectively Syntax C Unsigned char DIO_DI_16 int slot
63. nt There are two conditions for the location of the I 8k modules 1 When I 8K AIO modules are in the LP 8X81 then please refer to the demo in section 7 6 1 2 When I 8K AIO modules are in the l 8000 controller then please refer to the demo in section 7 6 2 7 6 1 I 8k Modules in slots of LP 8X81 In this section this demo program i8kaio c will illustrate how to control the Al AO with the l 8024 4 AO channels and l 8017 8 Al channels module and they are in slot 1 and slot 2 of the LP 8X81 separately The address and baudrate in the LP 8X81 are constant and they are 00 and 115200 separately The result of this demo lets AO voltage channel 0 of l 8024 output LinPAC 8X81 SDK Manual 101 Version 2 0 5 5V and Al channel 2 of I 8017H input The source code of this demo program is as follows include lt stdio h gt include lt stdlib h gt include msw h char szSend 80 szReceive 80 DWORD dwBuf 12 float fBuf 1 2 int main int i wRetVal j float fAi int hAi chAi Succ int Arr_hAi 5 float Arr_fAi 5 8024 wRetVal Open_Slot 1 if wRetVal gt 0 printf open Slot failed n return 1 18024 Initial 18024 _Initial 1 N8024 AO Output 18024 VoltageOut 1 0 5 5 Close_Slot 1 EEE SAR eS ee en eee 8017H wRetVal Open_Slot 2 if wRetVal gt 0 printf open Slot failed n LinPAC 8X81 SDK Manual 102 Version 2 0 return 1 N8017H Ini
64. of Module Control Dem0 cece ecesessecccecececeeeessnsaeeeeeeeeeees 106 8 LP 8X81 Library Reference in C Language 108 LinPAC 8X81 SDK Manual 3 Version 2 0 8 1 List Of System Information Functions uceesesssssssessnnnnsnnnnnnnsnnnnnennnn 108 8 2 List Of Digital Input Output Functions eeececeenteceesteeeeeeeeeeeenneeeees 108 8 3 List Of Watch Dog Timer Functions 0 ceeeseceeseeceeeeneeceeseceeeeneeeeenneeeees 109 8 4 List Of EEPROM Read Write Functions 0 ceeecceceeseeceesteeeeeeeeeeeeneeeeees 109 8 5 List Of Analog Input Functions rssscccesssseessssnessnnenensnnnsnnnnnnensnnnnnnnn 109 8 6 List Of Analog Output Functions ueeesseeesssseessssnnssnnnnnnsnnnnnnnnnennnnnnnnnnnn 110 9 Additional Suppor ans 111 9 1 N Port Module i 8114w or other serial module Support 111 9 2 N Port Serial Modules i 8114w or others Driver Instal 112 9 3 GUI F ntion SUPPOH aa een stein 113 9 3 1 How to boot LP 8X81 without loading X window 114 9 3 2 Enabling X window load at boot time 115 9 4 Application Support zes seRr Erle 115 9 3 Other Opa onal Punch Onis aa n nek a e nun 117 Appendix A Service Information e ee 120 STM SET VICE nee eher a EEE R e E EEEE EE EES 120 Manual Revision nee A EA ascend len 121 LinPAC 8X81 SDK Manual 4 Version 2 0 1 Introduction Recently Linux has been adopted widely by many user
65. p SDK LP 8X81sdk_for_linux tar gz in the LP 8X81 user can find all GUI demo programs include demo source code and executes file in the examples gui directory Refer to the Fig 9 5 LinPAC 8X81 SDK Manual 113 Version 2 0 Applications Places Desktop amp a u Fri Aug 29 13 44 EX i 87118 Test sysconfigl v nn N Slot 1 1 8000 i Slot 2 1 8000 AJ f Slot 3 1 8000 I 7 Slot 4 1 8142 i Slot 5 1 8000 A Slot 6 1 8060 Slot 7 1 8000 System Config Auto execute About LinCon Utility Serial Number MAC address EEPROM Size Flash Memory Size OS Version OS Imgae Size LinCon SDK Version 00000000 00 10 13 12 bb 92 16K bytes 32M bytes Linux 2 6 18 N A Ver_0 1 Bit DO ICPDAS LinCon Demo Slot 8 i 8060 2 3 _ 4 OFF OFF OFF OFF OFF OFF Fig 9 5 9 3 1 How to boot LP 8X81 without loading X window LP 8X81 can boot without loading X window by the steps as follows 1 To type vi etc inittab to modify run level default run level is 5 2 To change run level from 5 to 3 please refer to Fig 9 6 then type reboot to restart LP 8X81 Fig 9 6 LinPAC 8X81 SDK Manual 114 Version 2 0 9 3 2 Enabling X window load at boot time LP 8X81 can boot and loading X window at the same time by the steps as follows 1
66. r bits of RCSR Refer to the following parameter setting 1 clear bit O 2 clear bit 1 4 clear bit 2 8 clear bit 3 F clear bit 0 bit 3 Return Value None Example ClearWDTSWEven OxF Used to clear bit 0 bit 3 of RCRS to be zero Remark 6 4 EEPROM Read Write Functions m Enable EEP Description This function is used to make EEPROM able to read or write It must be used before using Read_EEP or Write_EEP This EEPROM is divided into 256 blocks 0 to 255 and each block is 64 bytes in length from offset 0 to 63 Syntax LinPAC 8X81 SDK Manual 60 Version 2 0 C void Enable_EEP void Parameter None Return Value None Example Enable_EEP After using this function you can use Write_EEP or Read_EEP to write or read data of EEPROM Remark m Disable EEP Description This function is used to make EEPROM unable to read or write You need to use this function after using Read_EEP or Write_EEP Then it will protect you from modifying your EEPROM data carelessly Syntax C void Disable_EEP void Parameter None Return Value None LinPAC 8X81 SDK Manual 61 Version 2 0 Example Disable_EEP After using this function you will not use Write_EEP or Read_EEP to write or read data of EEPROM Remark m Read EEP Description This function will read one byte data from the EEPROM There is a 16K byte EEPROM in the main contro
67. r user set the config user can click login button to to connect to the Linux PC please refer to Fig 5 4 WanSCP Login Session Session The IP of Linux PC Stored sessions Host name Port number Environment Directories SSH Preferences Private key file Protocol SFIP SFTP allow SCP fallback SEP Select color C Advanced options Fig 5 4 LinPAC 8X81 SDK Manual 28 Version 2 0 2 After user connect to the linux PC user could find the Helloworld file in the directory that user compiled Then user could drag the file Helloworld from the linux directory to window directory refer to Fig 5 5 root Fedorab_test_ machine WinSCP Local Mark Files Commands Session Options Remote Hi oO G 980 OS BF MED co De g cam M e s BHAA Gis toot yie gt gt Hada its SS ee E Name Ext Size Type Change Name Ext Size Changed Parent directory 2008 84 tmp 200986 FF 0 E Helloworld 4 692 HER 2008 8 E t 13 769 2008 8 14 FF Fdemo pat 719 914 Adobe Acrobat 7 2005 10 3 gt 24 2004124 EF B i 191 2004124 EF a i a 176 20041214 Windos PC directory Linux PC directory 100 2004 12 4 a B amr 26 2009123 LF B 16 2008615 FF B2 422 2008610 FF B 120 20051523 EFF f 128 2008 1 23_b F B ICE 4 158 2009811 EF To drag the file Helloworld B 0 200841723 F from linux directory to Windows Ss 511 2008 1 23 EFF E 129 2004 12
68. ressreesssresse 42 6 3 Watch Dog Timer Functions au RI 57 6 4 EEPROM Read Write FUnctions ccccccccssssssssecececececessessnseaeceeececeeeeseees 60 6 5 Analog Input Funehons sesss satriniecceertant reader tsanemene 63 6 6 Analog Output Functions er HD 76 6 7 The Software Develop Toolkit Error Code ssseseessessssseessesesssrrsseressssresse 80 7 Demo of LP 8X81 Modules With C Language 82 7 1 E7k Modules DIO Control Demo anne 82 7 2 I 7k Modules AIO Control Demo ccc ccccccccessssececececececeesessnsseeeeeeeeeees 84 7 3 I 87k Modules DIO Control Demo 222222222snseeseesssssnsnnnsnnnnnnenenenennnn 87 7 3 1 1 87k Modules in slots of LP 8X81 87 7 3 2 1 87k Modules in slots of I 87k I O expansion unit 89 7 3 3 1 87k Modules in slots of l 8000 Controller 92 7 4 I 87k Modules AIO Control Demo 2222222sssseenensssssssnnnnnnnnnnenenennennn 92 7 4 1 87k Modules in slots of LP 8X81 92 7 4 2 1 87k Modules in slots of l 87k I O expansion unit 94 7 4 3 1 87k Modules in slots of l 8000 Controller 96 7 5 I 8k Modules DIO Control Demo ccc ccccccesessncecececececeesessnseaeceeeeeeeens 97 7 5 1 8k Modules in slots of LP 8X81 97 7 5 2 8k Modules in slots of l 8000 Controller 98 7 6 I 8k Modules AIO Control Demo ccccccsesssnccececececeeeesessseceeeeeeeees 101 7 6 1 I 8k Modules in slots of LP 8X81 101 7 6 2 I 8k Modules in slots of l 8000 Controller 104 7 7 Conclusion
69. rk setting includes two ways One is DHCP and the other is Assigned Static IP DHCP is the default setting after the LP 8X81 is produced and this way is easy for users However if your network system is without DHCP server then users need to configure the network setting by using Assigned IP 4 1 1 Setting the IP Netmask and Gateway 1 Using DHCP Boot up LP 8X81 and use telnet to open a linux command Prompt Type in vi etc sysconfig network to open the network setting file Please refer to the Fig 4 5 root localhost letc sysconfig NETWORKING yes HOSTNAME Localhost localdomain If you want to set gateway please remove the in GATEWAY and GATEWAYDEV GATEWAY 10 0 9 254 GATEWAYDEV Fig 4 5 After editing the network file user can type in vi etc sysconfig network scripts ifcfg ethO and vi etc sysconfig network scripts ifcfg eth1 to set the network device eth0 and eth1 To remove in the dhcp block and add in the Assign IP block Then type wq to save the setting To type etc init d ifplugd restart to make the setting work Please refer to the Fig 4 6 and Fig 4 7 LinPAC 8X81 SDK Manual 14 Version 2 0 gt root localhost fetc sysconfig networ DEVICE ethO i leleuu 45 104 KO S l 2e 9 HWADDR 00 10 F3 12 BB 94 ONBOOT yes TYPE Ethernet DEVICE etho BOOTPROTO static BROADCAST 10 0 9 255 IPADD
70. s 1 8017H This function is a combination of the LinPAC 8X81 SDK Manual 73 Version 2 0 18017 _GetCurAdChannel_ Hex function and the 18017_Hex_Cal Please refer to Fig 6 2 Syntax C int 18017_GetCurAdChannel_Hex_Cal int slot Parameter slot Input specified slot of the LP 8X81 system Range 1 to 7 Return Value The analog input value in Calibrated Hex format Example int slot 1 ch 0 gain 0 data 18017_SetChannelGainMode slot ch gain 0 data 18017_GetCurAdChannel_ Hex_Cal slot The I 8017H card is plugged into slot 1 of LP 8X81 and the range of the data value from channel 0 in I 8017H is 0x0000 Ox3fff Remark This function can be applied on module 8017H and I 8017HS m 18017 AD POLLING Cal Description This function is used to get the analog input calibrated hex values in the array mode from an analog input module and can convert according to the slot configuration value the gain and the data number Syntax C int 18017_AD_POLLING_Cal int slot int ch int gain unsigned int datacount int DataPtr LinPAC 8X81 SDK Manual 74 Version 2 0 Parameter slot Input Specified slot in the LP 8X81 system Range 1 to 7 ch Input Specified channel for I 8017H Range 0 to 7 Specified channel for I 8017HS Range 0 to 15 gain Input Input range 0 10 0V 1 5 0V 2 2 5V 3 1 25V 4 20mA datacount
71. s because of the properties of stability open source and free charge In the mean while the development of linux is supported by many large international companies and the function in linux is not inferior to Windows so that linux OS is more and more popular and accepted In the other hand the hardware requirement that linux OS can works in embedded system smoothly is not high just only 386 CPU or better and 8 MB RAM Therefore except Win CE of Microsoft Linux has been already another good choice in embedded OS The Linux OS demands less system resources from the embedded controller and is therefore the best fit for it because of the embedded controller has some limitations in system resources It is for this reason that the LP 8X81 embedded controller has been published to be a new generation product from ICP DAS and the Embedded Linux OS has been adopted into the LP 8X81 The LP 8X81 s main purpose is to allow the numerous enthusiastic linux users to control their own embedded systems easily within the Linux Environment ICP DAS provides the library file libi8k a which includes all the functions from the I 7000 8000 87000 series modules which are used in the LP 8X81 Embedded Controller The libi8k a is designed specially for the 1 7000 8000 87000 series modules on the Linux platform for use in the LP 8X81 Users can easily develop applications in the LP 8X81 by using either C Language In the future The various functions of the libi8k
72. t 100 msecond wBuf7 5 j Channel Number of Al wBuf7 6 0 string debug wRetVal Analogin_87k wBuf7 fBuf szSend szReceive if wRetVal printf Al of 87017 Error Error Code d n wRetVal else printf Al of 87017 channel d f n j fBuf 0 Close_Com COMS3 return 0 All the steps from programming to execution are the same as those in the section 7 1 The result of execution refers to Fig 7 4 4 root localhost goldentask U tility i8k src 20080729 examples i87k froot localhost i87k 1s i87kaio root d localhost T Bk Fi 1 8 kaio of 87022 channel O AI of 87017 channel 1 root localhost 187k Fig 7 4 7 4 3 1 87k Modules in slots of l 8000 Controller If the l 87k AlO modules are in slots of l 8000 controller 87kK modules will be LinPAC 8X81 SDK Manual 96 Version 2 0 regarded as I 8k modules and refer to Al AO control of I 8k modules in the section 7 6 7 5 I 8k Modules DIO Control Demo 18000 c of Libi8k a is the source file for i8k modules in slots of l 8000 controller Slot c of Libi8k a is the source file for i8k modules in slots of LP 8X81 Therefore the functions for i8k modules in slots of LP 8X81 and in slots of l 8000 controller are different completely There are two conditions for the location of the I 8k modules 1 When I 8K DIO modules are in the LP 8X81 then please refer to the demo in section 7 5 1 2 When I 8K DIO modules are in the l 8000 controller
73. t 3 digital output DigitalOut_87k dwBuf 0 1 COM Port dwBuf 1 00 Address dwBuf 2 0x87054 ID dwBuf 3 0 CheckSum disable dwBuf 4 100 TimeOut 100 msecond dwBuf 5 Oxff digital output dwBuf 6 0 string debug wRetVal DigitalOut_87k dwBuf fBuf szSend szReceive DO Output printf DO Value u dwBuf 5 digital Input Digitalln_87k dwBuf 0 1 COM Port dwBuf 1 00 Address dwBuf 2 0x87054 ID LinPAC 8X81 SDK Manual 88 Version 2 0 dwBuf 3 0 CheckSum disable dwBuf 4 100 TimeOut 100 msecond dwBuf 6 0 string debug getch Digitalln_87k dwBuf fBuf szSend szReceive DI Input printf DI u dwBuf 5 digital output Close DO dwBuf 0 1 COM Port dwBuf 1 00 Address dwBuf 2 0x87054 ID dwBuf 3 0 CheckSum disable dwBuf 4 100 TimeOut 100 msecond dwBuf 5 0x00 digital output dwBuf 6 0 string debug getch push any key to continue wRetVal DigitalOut_87k dwBuf fBuf szSend szReceive Close_Com COM1 Close_SlotAll return 0 7 3 2 1 87k Modules in slots of I 87k I O expansion unit If the I 87k modules are in the slots of the I 87k I O expansion unit the above program needs to be modified in three parts 1 The functions of Open_Slot ChangeToSlot Close_SIotAll will be deleted 2 The address and
74. t d root localhost init d comport inst LinPAC Lx800 Serial Driver Installer Load module 8250 linpac ko 8250 Ko Load module icpdas_ root localhost init d Fig 9 3 LinPAC 8X81 SDK Manual 112 Version 2 0 2 To type dmesg to check the status of installing comport driver 3 If user want to remove the comport driver user could type cd etc init d and type comport remove to remove comport driver automatically refer to 9 4 E root localhost etc init d root localhost cd etc init d root localhost init d comport remove LinPAC LX800 Serial Driver Uninstaller Remove module icpdas 8250 ko root dlocalhost init d Fig 9 4 9 3 GUI Funtion Support Now X window is supported in the LP 8X81 and when the LP 8X81 boot up the GUI like Windows screen will show up The most important thing is that users can write GUI programs and run them in the LP 8X81 The GUI Library in the LP 8X81 is provided with GTK v1 2 amp v2 0 Library Therefore users can design their own SCADA screen by the GTK Library in the LP 8X81 In the meanwhile we provide some GUI demo programs to control I O modules of ICP DAS and assist users to develop own GUI programs quickly After user download the latest version of LP 8X81 SDK LP 8X81sdk_for_linux tar gz from the ftp path please refer to chapter 2 then user could use command tar zxvf LP 8X81sdk_for_linux tar gz to unzi
75. ta LinPAC 8X81 SDK Manual 110 Version 2 0 9 Additional Support In this chapter ICP DAS provides extra module supported and instructions to enhance LP 8X81 functionality and affinity 9 1 N Port Module i 8114w or other serial module Support The i 8114w modules provide four serial ports respectively Users can insert them into the LP 8X81 slots In this way users can use more serial ports in the LP 8X81 and the expanded maximum number of serial port in the LP 8X81 will be twenty eight The LP 8X81 is a multi tasking uint therefore users can control all the serial ports simultaneously The serial port number of i 8114w modules are presented in the Fig 9 1 and it is fixed according to their slot position in the LP 8X81 i 8114w i 8114w i 8114w i 8114w i 8114w i 8114w i 8114w u un zu Fig 9 1 LinPAC 8X81 SDK Manual 111 Version 2 0 Fig 9 2 is the serial port number corresponding to the device name in the LP 8781 i 8114w i 8114w i 8114w i 8114w i 8114w i 8114w i 81 14w gt Fig 9 2 9 2 N Port Serial Modules i 8114w or others Driver Install The comport linux driver can be used in LP 8X81 to support i 8114w or other serial module For LP 8X81 Linux O S the recommended installation and uninstall steps as follows 1 To type cd etc init d and type comport inst to install serial module driver automatically refer to Fig 9 3 ete root localhost fetc imit d root localhost cd etc ini
76. tf open port failed n return 1 ChangeToSlot 2 Analog output 87022 AO b wBuf 0 1 COM Port wBuf 1 0x00 Address wBuf 2 0x87022 1D wBuf 3 0 CheckSum disable wBuf 4 100 TimeOut 100 msecond wBuf 5 i Channel Number of AO wBuf 6 0 string debug fBuf 0 2 5 AO Value wRetVal AnalogOut_87k wBuf fBuf szSend szReceive LinPAC 8X81 SDK Manual 93 Version 2 0 if wRetVal printf AO of 87022 Error Error Code d n wRetVal else printf AO of 87022 channel d f n i fBuf 0 ChangeToSlot 3 Analog Input 87017 Al pi wBuf7 0 1 COM Port wBuf7 1 0x00 Address wBuf7 2 0x87017 1D wBuf7 3 0 CheckSum disable wBuf7 4 100 TimeOut 100 msecond wBuf7 5 j Channel Number of Al wBuf7 6 0 string debug wRetVal AnalogIn_87k wBuf7 fBuf szSend szReceive if wRetVal printf Al of 87017 Error Error Code d n wRetVal else printf Al of 87017 channel d f n j fBuf 0 Close_Com COM1 Close_SlotAll return 0 7 4 2 1 87k Modules in slots of I 87k I O expansion unit If the I 87k modules are in slots of I 87k I O expansion unit the above program needs to be modified in three parts 1 The functions of Open_Slot ChangeToSlot Close_SIotAll will be deleted 2 The addrss and baudrate of I 87k modules in the network of RS 485 need to
77. the data from non calibrated hex values to calibrated hex values based on the configuration of the slot gain Voltage or current Voltage or current Please refer to the Fig 6 2 Syntax C int 18017_Hex_Cal_Slot_Gain int slot int gain int data Parameter slot Input specified slot of the LP 8X81 system Range 1 to 7 gain Input Input range data Input specified not calibrated hex value Return Value The Calibrated Hex Value Example int slot 1 ch 0 gain 0 hdata int hdata_cal 18017_SetChannelGainMode slot ch gain 0 hdata 18017_GetCurAdChannel_ Hex slot hdata_cal 18017 _Hex_Cal_Slot_Gain slot gain hdata You can convert not calibrated Hex Value to calibrated Hex Value according to the gain of slot you choose Remark This function can be applied on module I 8017H and I 8017HS LinPAC 8X81 SDK Manual 71 Version 2 0 Function of 4 m CalHEX_TO_ FLOAT Description This function is used to convert the data from calibrated hex values to calibrated float values based on the configuration of the gain Voltage or current Please refer to Fig 6 2 Syntax C float CalHex_TO_FLOAT int HexValue int gain Parameter HexValue Input spedified not calibrated HexValue before converting gain Input Input range 0 10 0V 1 5 0V 2 2 5V 3 1 25V 4 20mA Return Value The Calibrated Float Value Exampl
78. the file and it will show hello world Then all the steps from compile gt transfer to connect to execute program will be completed refer to Fig 5 9 v0t localho R not installed not installed 8142 not installed a not installed 87118 t localhost ls op Helloworld oo centas xine out wav root localhost chmod 777 Helloworld root localhost Helloworld hello world root localhost Fig 5 9 The i Talk utility provides fifteen instructions that make it convenient for users to access the modules and hardware in the LP 8X81 and they are placed in the path usr bin Table 5 1 describes the functions of i Talk utility Instruction Function Discription getlist List all module name in the LP 8X81 LinPAC 8X81 SDK Manual 31 Version 2 0 setdo Set digital output value to 8k module setao Set analog output value to 8k module getdi Get digital input value from 8k module getai Get analog input value from 8k module setexdo Set digital output value to 7k 87k module setexao Set analog output value to 7k 87k module getexdi Get digital input value from 7k 87k module getexai Get analog input value from 7k 87k module setport Set port value by offset to a module getport Get port value by offset from a module setsend Send string from LinPAC COM port getreceive Receive string from LinPAC COM port getsendreceive
79. ther functions of the I 87k modules and the function Close_Slot also needs to be added to the end of the program Please refer to the demo in section 7 4 1 2 When I 87K AIO modules are in the I 87k I O expansion unit slots please refer to the demo in section 7 4 2 3 When the I 87k AIO modules are in the l 8000 controller slots the l 87k modules will be regarded as I 8k modules and so please refer to I O control of I 8k modules in section 7 4 3 7 4 1 1 87k Modules in slots of LP 8X81 This demo i87kaio c will illustrate how to control the Al AO with the I 87022 module 2 AO channels and the I 87017 module 8 Al channels The I 87022 and I 87017 modules are plugged into slot 2 and slot 3 of the LP 8X81 separately The address and baudrate in the LP 8X81 are constant and they are 00 and 115200 separately The result of this demo lets AO channel 0 of I 87022 output 2 5V and Al channel 1 of I 87017 input The source code of this demo program is as follows include lt stdio h gt include lt stdlib h gt include msw h LinPAC 8X81 SDK Manual 92 Version 2 0 char szSend 80 szReceive 80 DWORD wBuf 12 DWORD wBuf7 12 float fBuf 12 int main int i j wRetVal DWORD temp Check Open_Slot wRetVal Open_Slot 0 if wRetVal gt 0 printf open Slot failed n return 1 Check Open_Com1 wRetVal Open_Com COM1 115200 Data8Bit NonParity OneStopBit if wRetVal gt 0 prin
80. tial 18017_Init 2 N8017H _Channel Setup 18017_SetChannelGainMode 2 2 0 0 First Method Get Al Value hAi 18017_GetCurAdChannel_Hex 2 Get Not calibrated Al Hex Value printf 8017_Al_not_Cal_Hex x n hAi fAi HEX_TO_FLOAT_Cal hAi 2 0 Not calibrated Al Hex Value modify to calibrated Al Float Value printf 8017_Al_Cal_Float f n n fAi Second Method Get Al Value hAi 18017_GetCurAdChannel_Hex_Cal 2 Get Calibrated Al Hex Value printf 8017_Al_Cal_Hex x n hAi fAi CalHex_TO_FLOAT hAi 0 Calibrated Al Hex Value modify to Calibrated Al Float Value printf 8017_Al_ Cal_Float f n n fAi Third Method Get Al Value fAi 18017_GetCurAdChannel_Float_Cal 2 Get Calibrated Al Float Value printf 8017_Al Cal_Float f n n n fAi Close_Slot 2 return 0 All the steps from programming to execution are the same as those in the section 7 1 The result of execution refers to Fig 7 7 LinPAC 8X81 SDK Manual 103 Version 2 0 X root localhost goldentask U tility i8k src 20080729 examples i8k froot localhost i8k ls 18kaio root localhost i8k 18kaio 8017 AI not Cal Hex 112 8017 AI Cal Float 5 499573 8017 AI Cal Hex 4669 8017 AI Cal Float 8017 AI Cal Float 5 500793 root localhost i8k Fig 7 7 7 6 2 I 8k Modules in slots of l 8000 Controller In this section this demo program i8kaio_8k c will introduce how to control the Al AO with the l 8024
81. tion supports the collection of system hardware configurations Syntax C int GetNameOfModule char slot Parameter slot Input Specify the slot number where the I O module is plugged into Return Value I O module ID For Example the l 8017 will return 8017 Example char slot 1 int moduleName Open_Slot slot modulelD GetNameOfModule slot Close_Slot Slot The l 8017 card plugged in slot 1 of LP 8X81 Returned Value moduleName 8017 Remark 6 2 Digital Input Output Functions m DO 8 Description LinPAC 8X81 SDK Manual 42 Version 2 0 This function is used to output 8 bit data to a digital output module The 0 7 bits of output data are mapped into the 0 7 channels of digital module output respectively Syntax C void DO_ 8 int slot unsigned char data Parameter slot Input the slot number where the I O module is plugged into data Input output data Return Value None Example int slot 1 unsigned char data 3 DO_8 slot data The l 8064 card is plugged in slot 1 of LP 8X81 and can turn on channel 0 and 1 Remark This function can be applied on modules l 8060 l 8064 l 8065 l 8066 I 8068 and l 8069 m DO_16 Description This function is used to output 16 bit data to a digital output module The 0 15 bits of output data are mapped into the 0 15 channels of digital output modules respectively Syntax
82. uf 6 0 string debug 7050 DO Output wRetVal DigitalOut wBuf fBuf szSend szReceive if wRetVal printf DigitalOut_7050 Error Error Code d n wRetVal printf The DO of 7050 u n wBuf 5 7050 DI Input Digitalln wBuf fBuf szSend szReceive printf The DI of 7050 u n wBuf 5 Close_Com COMS3 return 0 Follow the below steps to achieve the desired results STEP 1 To ttransmit LP 8X81sdk_for_linux tar gz SDK to LP 8X81 User could use WinSCP software or linux scp command to transmit LP 8X81sdk_for_linux tar gz from Windows or Linux PC to LP 8X81 User could refer to the 5 2 A Simple Example Helloworld c to know how to use WinSCP software and linux scp command to transmit file to LP 8X81 STEP 2 To connect to LP 8X81 to execute i7kdio User could use putty software to connect to LP 8X81 User could refer to the 4 LP 8X81 System Settings to know how to use Putty software to connect to LP 8X81 LinPAC 8X81 SDK Manual 83 Version 2 0 STEP 3 To execute i7kdio in the LP 8X81sdk_for_linux examples i7k After user connect to LP 8X81 user could find the demo i7kdio in the directory LP 8X81sdk_for_linux examples i7k The result of execution refers to Fig 7 1 gt root localhost goldentask U tility i8k src 20080729 examples i7k root localhost i7k ls i7kdio root localhost i7k i7 kdio The DO of 7050 255 The DI of 7050
83. unction is used to initialize the I 8024 module in the specified slot You must implement this function before you try to use the other l 8024 functions Syntax C void 18024 _Initial int slot Parameter LinPAC 8X81 SDK Manual 76 Version 2 0 slot Input Specify the LP 8X81 system slot Range 1 to 7 Return Value None Example int slot 1 18024 Initial slot The l 8024 card is plugged into slot 1 of LP 8X81 and initializes the l 8024 module Remark This function can be applied on module l 8024 m 18024 VoltageOut Description This function is used to send the voltage float value to the l 8024 module with the specified channel and slot in the LP 8X81 system Syntax C void 18024_VoltageOut int slot int ch float data Parameter slot Input Specified the LP 8X81 system slot Range 1 to 7 ch Input Output channel Range 0 to 3 data Input Output data with engineering unit Voltage Output 10 10 Return Value None Example int slot 1 ch 0 float data 3 0f 18024_VoltageOut slot ch data The l 8024 module output the 3 0V voltage from the channel 0 LinPAC 8X81 SDK Manual 77 Version 2 0 Remark This function can be applied on module l 8024 m 18024 CurrentOut Description This function is used to initialize the I 8024module in the specified slot for current output Users must call this function before trying to use the other l
84. will show how to contact ICP DAS when you have problems in the LP 8X81 or other products Internet Service The internet service provided by ICP DAS will be satisfied and it includes Technical Support Driver Update OS_Image LinPAC_SDK and User s Manual Download etc Users can refer to the following web site to get more information 1 ICP DAS Web Site http www icpdas com 2 Software Download http ftp icpdas com pub cd linpac napdos Ip 8x8x 3 E mail for Technical Support service icpdas com LinPAC 8X81 SDK Manual 120 Version 2 0 Manual Revision Manual Edition Revision Date Revision Details v1 0 2009 4 3 1 The first version of user manual LinPAC 8X81 SDK Manual 121 Version 2 0
Download Pdf Manuals
Related Search
Related Contents
ASN.1 Compiler Version 6.2 C/C++ User`s Manual Objective Plinius Audio SA-102 User's Manual Guía Administrador KX-UT670 Istruzioni per l`uso KZ13F MODE D`EMPLOI - Primo Méridiennes septembre-octobre 2010 (pdf Chapter One Modifying Your Fonts Bedienungsanleitung Schichtdickenmessgerät Copyright © All rights reserved.
Failed to retrieve file