ICP DAS USA MP-8 43 Series Function Reference

Hide thumbs Also See for MP-8 43 Series:
Table of Contents

Advertisement

Quick Links

MP-8x43
Function Reference
(Version 1.0)
1 
http://www.icpdas.com
MP-8x43 Function Reference V 1.0

Advertisement

Table of Contents
loading

Summary of Contents for ICP DAS USA MP-8 43 Series

  • Page 1 MP-8x43 Function Reference (Version 1.0) http://www.icpdas.com MP-8x43 Function Reference V 1.0...
  • Page 2 Warranty All products manufactured by ICPDAS Inc. are warranted against defective materials for a period of one year from the date of delivery to the original purchaser. Warning ICPDAS Inc. assumes no liability for damages consequent to the use of this product.
  • Page 3: Table Of Contents

    TABLE OF CONTENTS 1. PREFACE ................7 1.1 Introduction ................7 1.2 What’s new Release ..............9 2. EZPLATFORMSDK API ..........10 2.1 Software Information Functions ..........11 2.1.1 GetSDKversion ................11 2.1.2 GetOSversion ................... 12 2.2 System Information Functions ..........13 2.2.1 GetModuleType ................13 2.2.2 GetNameOfModule .................
  • Page 4 2.3.3.3 DO_32_RB....................30 2.3.4 8 channels DI modules ..............31 2.3.4.1 DI_8......................31 2.3.4.2 DI_8_BW ..................... 32 2.3.5 16 channels DI modules ..............33 2.3.5.1 DI_16......................33 2.3.5.2 DI_16_BW ....................34 2.3.6 32 channels DI modules ..............35 2.3.6.1 DI_32......................35 2.3.6.2 DI_32_BW ....................
  • Page 5 2.6.4 I8024_VoltageHexOut ..............57 2.6.5 I8024_CurrentHexOut..............58 2.6.6 I8024_VoltageOutReadBack ............59 2.6.7 I8024_CurrentOutReadBack ............60 2.7.8 I8024_VoltageHexOutReadBack ........... 61 2.7.9 I8024_CurrentHexOutReadBack ..........62 2.7 FRnet Communication Functions ..........63 2.7.1 i8172_FRNET_IN................63 2.7.2 i8172_FRNET_OUT................ 64 2.7.3 i8172_FRNET_Status..............65 2.7.4 i8172_FRNET_Reset ............... 66 2.8 XSRAM Access Functions ...........67 2.8.1 XSRAM_Init ..................
  • Page 6 3.2 Serial port applications demo in VC ........82 4. SERIALCE API..............83 4.1 Serial port basic function............83 4.1.1 Get_Version..................83 4.1.2 Open_Com ..................84 4.1.3 Close_Com ..................85 4.1.4 DataSizeInCom................86 4.1.5 DataSizeOutCom ................87 4.1.6 ReadComn..................88 4.2 Send and Receive binary data ..........89 4.2.1 Send_Binary..................
  • Page 7: Preface

    1. PREFACE 1.1 Introduction Welcome to the EzPlatformSDK application library user’s manual. ICPDAS provides Library files, namely the EzPlatformSDK application library, for the I-8000 series modules which are used in the MP-8x43 Embedded Controller. The EzPlatformSDK application library has all the essential Library functions designed for the I-8000 series modules for Microsoft WinCE 6.0 platform.
  • Page 8 Fig. 1-1 Fig. 1-2 http://www.icpdas.com MP-8x43 Function Reference V 1.0...
  • Page 9: What's New Release

    1.2 What’s new Release 2010/01 New Release V 1.0 http://www.icpdas.com MP-8x43 Function Reference V 1.0...
  • Page 10: Ezplatformsdk Api

    2. EzPlatformSDK API In this section we will focus on the description and application example of EzPlatformSDK Library functions. The functions of EzPlatformSDK.LIB can be clarified into 10 groups which are listed below: 2.1 System Information Functions 2.2 Software Information Functions 2.3 Digital Input/Output Functions 2.4 Watch Dog Timer Functions 2.5 Analog Input Functions...
  • Page 11: Software Information Functions

    2.1 Software Information Functions 2.1.1 GetSDKversion Description: This function retrieves the version number of the linked EzPlatformSDK library files. Syntax: void GetSDKversion(LPTSTR lpSDKversion) Parameter: lpSDKversion : [Output] the pointer to a string to receive the version number of EzPlatformSDK.DLL, The buffer size had better great then 50. Return Value: None Example:...
  • Page 12: Getosversion

    2.1.2 GetOSversion Description: This function retrieves the version number of the embedded OS. Syntax: void GetOSversion(LPTSTR lpOSversion) Parameter: lpOSversion : [Output] the pointer to a buffer to receive the OS version, The buffer size had better great then 50. Return Value: None Example: TCHAR...
  • Page 13: System Information Functions

    2.2 System Information Functions 2.2.1 GetModuleType Description: This function is used to retrieve the type of i8000 series I/O module plugged into a specific I/O slot in the PAC system. This function performs a supporting task in the collection of information relating to system hardware configurations. Syntax: int GetModuleType(int slot)
  • Page 14: Getnameofmodule

    2.2.2 GetNameOfModule Description: This function is used to retrieve the name of an i8000 series I/O module, which is plugged into a specific I/O slot in the PAC system. This function supports the collection of system hardware configurations. Syntax: int GetNameOfModule(int slot, char *string1)
  • Page 15: Getsystemserialnumber

    2.2.3 GetSystemSerialNumber Description: This function retrieves the hardware serial identification number on the PAC main controller. This function supports the control of hardware versions by reading the 64-bit serial ID chip. Syntax: int GetSystemSerialNumber(char *SN) Parameter: [Output] the pointer to a buffer to receive the serial ID number. Return Value: indicates success.
  • Page 16: Gettimeticks

    2.2.4 GetTimeTicks Description: This function is used to retrieve the number of milliseconds that have elapsed since Windows CE started. The elapsed time is stored as a DWORD value. Therefore, the time will wrap around to zero if the system is run continuously for 49.7 days.
  • Page 17: Get_Slot_No

    2.2.5 Get_Slot_No Description: This function retrieves the IO slot number on the PAC backplane (hardware IO Slot number). Syntax: unsigned char Get_Slot_No (void) Parameter: None Return Value: The slot numbers of backplane. Example: unsigned char slot_no; slot_no = Get_Slot_No(); Remark: 17  http://www.icpdas.com MP-8x43 Function Reference V 1.0...
  • Page 18: Get_Rotarysw

    2.2.6 Get_RotarySW Description: This function retrieves the user selected rotary switch number on front of PAC. Syntax: unsigned char Get_RotarySW (void) Parameter: None Return Value: The rotary switch selected number. Example: unsigned char select_no; select_no = Get_RotarySW (); Remark: 18  http://www.icpdas.com MP-8x43 Function Reference V 1.0...
  • Page 19: Changeslotto87K

    2.2.7 ChangeSlotTo87K Description: This function is used to dedicate serial control to the specified slot for the control of 87K series. The serial bus in the PAC 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.
  • Page 20: Get_Dip_Switch

    2.2.8 Get_DIP_Switch Description: This function retrieves the user selected DIP switch selected on side of PAC. Syntax: Get_DIP_Switch(void) Parameter: None Return Value: The DIP switch selected number. Example: select_no; select_no = Get_DIP_Switch (); Remark: 20  http://www.icpdas.com MP-8x43 Function Reference V 1.0...
  • Page 21: Digital Input/Output Functions

    2.3 Digital Input/Output Functions API support Modules table: Modules Module Type DO API DI API DO_8 i8060x, i8064x, i8065x, 8 DO module DO_8_BW i8066x, i8068x, i8069x DO_8_RB DO_16 i8037x, i8056x, i8057x 16 DO module DO_16_BW DO_16_RB DO_32 32 DO module DO_32_BW i8041x DO_32_RB...
  • Page 22: Channels Do Modules

    2.3.1 8 channels DO modules 2.3.1.1 DO_8 Description: This function is used to output 8-bit data to a digital output module. The 0~7 bits of output data is mapped into the 0~7 channels of digital module output respectively. Syntax: void DO_8(int slot, unsigned char cdata)
  • Page 23: Do_8_Bw

    2.3.1.2 DO_8_BW Description: Set the digital output value of the channel No. in the 8-channel Digital Output series modules. The output Value is “true” or “false”. Syntax: void DO_8_BW(int slot, channel, BOOL data) Parameter: slot : [Input] the slot number where the I/O module is plugged into. channel : [Input] the digital output channel No.(0~7).
  • Page 24: Do_8_Rb

    2.3.1.3 DO_8_RB Description: Read back the 8-channel digital output value for the I-8000 series modules. Syntax: unsigned char DO_8_RB(int slot) Parameter: slot : [Input] the slot number where the I/O module is plugged into. Return Value: 8-bit digital output data read back value Example: slot=1;...
  • Page 25: Channels Do Modules

    2.3.2 16 channels DO modules 2.3.2.1 DO_16 Description: This function is used to output 16-bit data to a digital output module. The 0~15 bits of output data is mapped into the 0~15 channels of digital output modules respectively. Syntax: void DO_16(int slot, unsigned int cdata)
  • Page 26: Do_16_Bw

    2.3.2.2 DO_16_BW Description: Set the digital output value of the channel No. of the 16-channel Digital Output series modules. The output Value is “true” or “false”. Syntax: void DO_16_BW(int slot, channel, BOOL data) Parameter: slot : [Input] the slot number where the I/O module is plugged into. channel : [Input] the digital output channel No.(0~15) data :...
  • Page 27: Do_16_Rb

    2.3.2.3 DO_16_RB Description: To read back the 16-channel digital output value on the i8000 series modules. Syntax: unsigned int DO_16_RB(int slot) Parameter: slot : [Input] the slot number where the I/O module is plugged into. Return Value: 16-bit digital output data read back value Example: slot=1;...
  • Page 28: Channels Do Modules

    2.3.3 32 channels DO modules 2.3.3.1 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: void DO_32(int slot, unsigned long cdata) Parameter: slot :...
  • Page 29: Do_32_Bw

    2.3.3.2 DO_32_BW Description: Set the digital output value of the channel No. on the 32-channel Digital Output series modules. The output Value is “true” or “false”. Syntax: void DO_32_BW(int slot, channel, BOOL data) Parameter: slot : [Input] the slot number where the I/O module is plugged into. channel: [Input] the digital output channel No.(0~31) data :...
  • Page 30: Do_32_Rb

    2.3.3.3 DO_32_RB Description: To read back the 32-channel digital output value of i8000 series modules. Syntax: unsigned long DO_32_RB(int slot) Parameter: slot : [Input] the slot number where the I/O module is plugged into. Return Value: 32-bit digital output data read back value Example: slot=1;...
  • Page 31: Channels Di Modules

    2.3.4 8 channels DI modules 2.3.4.1 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: unsigned char DI_8(int slot) Parameter: slot : [Input] the slot number where the I/O module is plugged into.
  • Page 32: Di_8_Bw

    2.3.4.2 DI_8_BW Description: Obtains channel input data from an 8-channel digital input series module. The Input Value is “true” or “false”. Syntax: BOOL DI_8_BW(int slot, channel) Parameter: slot : [Input] the slot number where the I/O module is plugged into. channel : [Input] the digital output channel No.(0~7) Return Value:...
  • Page 33: Channels Di Modules

    2.3.5 16 channels DI modules 2.3.5.1 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: unsigned int DI_16(int slot) Parameter:...
  • Page 34: Di_16_Bw

    2.3.5.2 DI_16_BW Description: Obtains channel input data from a 16-channel digital input series module. The Input Value is “true” or “false”. Syntax: BOOL DI_16_BW(int slot, channel) Parameter: slot : [Input] the slot number where the I/O module is plugged into. channel : [Input] the digital output channel No.(0~15) Return Value:...
  • Page 35: Channels Di Modules

    2.3.6 32 channels DI modules 2.3.6.1 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 respectively. Syntax: unsigned long DI_32(int slot) Parameter: slot :...
  • Page 36: Di_32_Bw

    2.3.6.2 DI_32_BW Description: Obtains channel input data from a 32-channel digital input series module. The Input Value is “true” or “false”. Syntax: BOOL DI_32_BW(int slot, channel) Parameter: slot : [Input] the slot number where the I/O module is plugged into. channel : [Input] the digital output channel No.(0~31) Return Value:...
  • Page 37: Channels Di And 8 Channels Do Modules

    2.3.7 8 channels DI and 8 channels DO modules 2.3.7.1 DIO_DO_8 Description: This function is used to output 8-bit data to DIO modules. These modules run 8 digital input 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.
  • Page 38: Dio_Do_8_Bw

    2.3.7.2 DIO_DO_8_BW Description: Set the digital output value of the channel No. for the 8-channel Digital I/O series modules. The output Value is “true” or “false”. Syntax: void DIO_DO_8_BW(int slot, channel, BOOL data) Parameter: slot : [Input] the slot number where the I/O module is plugged into. channel : [Input] the digital output channel No.(0~7) data :...
  • Page 39: Dio_Do_8_Rb

    2.3.7.3 DIO_DO_8_RB Description: To read back the 8-channel digital output value from the i8000 digital I/O series modules. Syntax: unsigned char DIO_DO_8_RB(int slot) Parameter: slot : [Input] the slot number where the I/O module is plugged into. Return Value: 8-bit digital output data read back value Example: slot=1;...
  • Page 40: Channels Di And 16 Channels Do Modules

    2.3.8 16 channels DI and 16 channels DO modules 2.3.8.1 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.
  • Page 41: Dio_Do_16_Bw

    2.3.8.2 DIO_DO_16_BW Description: Set the digital output value on the channel No. for the 16-channel Digital I/O series modules. The output Value is “true” or “false”. Syntax: void DIO_DO_16_BW(int slot, channel, BOOL data) Parameter: slot : [Input] the slot number where the I/O module is plugged into. channel : [Input] the digital output channel No.(0~15) data :...
  • Page 42: Dio_Do_16_Rb

    2.3.8.3 DIO_DO_16_RB Description: To read back the 16-channel digital output value from i8000 digital I/O series modules. Syntax: unsigned int DIO_DO_16_RB(int slot) Parameter: slot : [Input] the slot number where the I/O module is plugged into. Return Value: 16-bit digital output data read back value Example: slot=1;...
  • Page 43: Watch Dog Timer Functions

    2.4 Watch Dog Timer Functions 2.4.1 EnableWDT Description: This function can be used to enable and reset the watch dog timer. You must to call this API in the watch dog timer period, until call the DisableWDT(), or the system will reboot by watch dog timer. Syntax: Void EnableWDT (DWORD msecond)
  • Page 44: Disablewdt

    2.4.2 DisableWDT Description: This function is used to disable the watch dog timer. Syntax: void DisableWDT(void) Parameter: None Return Value: None Example: Remark: 44  http://www.icpdas.com MP-8x43 Function Reference V 1.0...
  • Page 45: Analog Input Functions

    2.5 Analog Input Functions 2.5.1 Init_8017H Description: This function is used to initialize the I-8017H(S) module (Analog input module) into the specified slot. Users must execute this function once before trying to use other functions within I-8017H(S). Syntax: int Init_8017H(int slot) Parameter: slot :...
  • Page 46: Set_8017H_Led

    2.5.2 Set_8017H_LED Description: Turns the I-8017H(S) modules LED’s on/off. They can be used to act as an alarm. Syntax: void Set_8017H_LED(int slot, unsigned int led) Parameter: slot : [Input] specified slot of the MP-8x43 system (Range: 1 to 7) led : [Input] range from 0 to 0xffff Return Value: None...
  • Page 47: Set_8017H_Channel_Gain_Mode

    2.5.3 Set_8017H_Channel_Gain_Mode Description: This function is used to configure the range and mode of the analog input channel for the module I-8017H(S) in the specified slot before using ADC (analog to digital converter). Syntax: void Set_8017H_Channel_Gain_Mode(int slot, gain, mode) Parameter: slot : [Input] Specify the slot in the MP-8x43 system (Range: 1 to 7) ch :...
  • Page 48: Get_Ad_Fvalue

    2.5.4 Get_AD_FValue Description: Obtain the analog input voltage value from the analog input module in the float format according configuration function Set_8017H_Channel_Gain_Mode. Syntax: float Get_AD_FValue(int gain) Parameter: gain : [Input] input range +/- 10.0V, +/- 5.0V, +/- 2.5V, +/- 1.25V, +/- 20mA.
  • Page 49: Get_Ad_Ivalue

    2.5.5 Get_AD_IValue Description: This function is used to obtain the analog input current value from an analog input module in the float format according to the configuration in function Set_8017H_Channel_Gain_Mode. Syntax: float Get_AD_IValue(void) Parameter: None Return Value: Return (float): The analog input current value (mA). Example: slot=1,ch=0,gain=4;...
  • Page 50: Get_Ad_Hvalue

    2.5.6 Get_AD_HValue Description: This function is used to obtain the voltage analog input value from the analog input module in the HEX format according to the configuration in function Set_8017H_Channel_Gain_Mode. Syntax: short Get_AD_HValue(void) Parameter: None Return Value: Return (Hex): The voltage analog input value. Example: slot=1,ch=0,gain=4;...
  • Page 51: I8017H_Ad_Polling

    2.5.7 I8017H_AD_POLLING Description: This function is used to get the analog input values of the specific channel from an analog input module and convert the value in HEX format according to the configuration of the slot, the gain and the data number. Syntax: int I8017H_AD_POLLING(int slot,...
  • Page 52: Array_Hex_To_Float_All

    2.5.8 ARRAY_HEX_TO_FLOAT_ALL Description: This function is used to convert the data from hex to float values based on the configuration of the slot, gain and data length. (Voltage or current) Syntax: void ARRAY_HEX_TO_FLOAT_ALL(int *HexValue, float *Ivalue, slot, gain, len) Parameter: *HexValue : [Input] data array in integer type before converting.
  • Page 53: Read_8017Hs_Mode

    2.5.9 Read_8017HS_Mode Description: This function is used to get the mode of input channels, single-end or differential. Syntax: int Read_8017HS_Mode(int slot) Parameter: slot : [Input] Specify the slot in the MP-8x43 system (Range: 1 to 7) Return Value: Single-End Mode, You will have 16 AI channels (8017H ‘s API channel Parameter Range can be 0 to 15).
  • Page 54: Analog Output Functions

    2.6 Analog Output Functions 2.6.1 I8024_Initial Description: This function is used to initialize the module I-8024 in the specified slot. You must implement this function once before you try to use the other I-8024 functions. Syntax: void I8024_Initial(int slot) Parameter: slot : [Input] Specify the MP-8x43 system slot (Range: 1 to 7) Return Value:...
  • Page 55: I8024_Voltageout

    2.6.2 I8024_VoltageOut Description: This function is used to send the voltage float value to the I-8024 module with the specified channel and slot in the MP-8x43 system. Syntax: void I8024_VoltageOut(int slot, float data) Parameter: slot : [Input] Specified the MP-8x43 system slot (Range: 1 to 7) ch : [Input] Output channel (Range: 0 to 3) data :...
  • Page 56: I8024_Currentout

    2.6.3 I8024_CurrentOut Description: This function is used to initialize the I-8024module in the specified slot for current output. Users must call this function once before trying to use the other I-8024 functions for current output. Syntax: void I8024_CurrentOut(int slot, float data) Parameter: slot :...
  • Page 57: I8024_Voltagehexout

    2.6.4 I8024_VoltageHexOut Description: This function is used to send the voltage value in hex format to the specified channel in the I-8024 module, which is plugged into the slot in the MP-8x43 system. Syntax: void I8024_VoltageHexOut(int slot, data) Parameter: slot : [Input] Specify the MP-8x43 system slot (Range: 1 to 7) ch : [Input] Output channel (Range: 0 to 3)
  • Page 58: I8024_Currenthexout

    2.6.5 I8024_CurrentHexOut Description: This function is used to send the current value in Hex format to the specified channel in the analog output module I-8024, which is plugged into the slot in the MP-8x43 system. Syntax: void I8024_CurrentHexOut(int slot, data) Parameter: slot : [Input] Specify the MP-8x43 system slot (Range: 1 to 7)
  • Page 59: I8024_Voltageoutreadback

    2.6.6 I8024_VoltageOutReadBack Description: This function is used to read back the output data in float format from the specified channel on the I-8024 module in the MP-8x43 system. Syntax: float I8024_VoltageOutReadBack(int slot, Parameter: slot : [Input] Specify the MP-8x43 system slot (Range: 1 to 7) ch : [Input] Output channel (Range: 0 to 3) Return Value:...
  • Page 60: I8024_Currentoutreadback

    2.6.7 I8024_CurrentOutReadBack Description: This function is used to read back the current output value in float format from the specified channel on I-8024 module in the specific slot of the MP-8x43 system. Syntax: float I8024_CurrentOutReadBack(int slot, Parameter: slot : [Input] Specify the MP-8x43 system slot (Range: 1 to 7) ch : [Input] Output channel (Range: 0 to 3) Return Value:...
  • Page 61: I8024_Voltagehexoutreadback

    2.7.8 I8024_VoltageHexOutReadBack Description: This function is used to read back the voltage output value in hex format from the specified channel on the analog output module I-8024 in the specific slot of the MP-8x43 system. Syntax: int I8024_VoltageHexOutReadBack(int slot, Parameter: slot : [Input] Specify the slot of the MP-8x43 system (Range: 1 to 7) ch :...
  • Page 62: I8024_Currenthexoutreadback

    2.7.9 I8024_CurrentHexOutReadBack Description: This function is used to read back the current value in Hex format from the specified channel of I-8024 module in the slot of the MP-8x43 system. Syntax: int I8024_CurrentHexOutReadBack(int slot, Parameter: slot : [Input] Specify the slot of the MP-8x43 system (Range: 1 to 7) ch : [Input] Output channel (Range: 0 to 3) Return Value:...
  • Page 63: Frnet Communication Functions

    2.7 FRnet Communication Functions 2.7.1 i8172_FRNET_IN Description: Read FRnet digital input data. Syntax: WORD i8172_FRNET_IN(int Slot, BYTE Port, BYTE wSA) Parameter: Slot : [Input] Specify the PAC system slot (Range: 1 to 7) Port: [Input] Specify the FRnet port of i8172x (0 or 1) wSA: [Input] Specify the SA (sender address) of remote FRnet module...
  • Page 64: I8172_Frnet_Out

    2.7.2 i8172_FRNET_OUT Description: Read FRnet digital input data. Syntax: void i8172_FRNET_OUT(int Slot, BYTE Port, BYTE wRA, WORD Data) Parameter: Slot : [Input] Specify the PACsystem slot (Range: 1 to 7) Port: [Input] Specify the FRnet port of i8172x (0 or 1) wRA: [Input] Specify the RA (receiver address) of remote FRnet module...
  • Page 65: I8172_Frnet_Status

    2.7.3 i8172_FRNET_Status Description: Read FRnet digital input status. Syntax: BYTE i8172_FRNET_Status(int Slot, BYTE Port) Parameter: Slot : [Input] Specify the PAC system slot (Range: 1 to 7) Port: [Input] Specify the FRnet port of i8172x (0 or 1) Return Value: The status of input-group.
  • Page 66: I8172_Frnet_Reset

    2.7.4 i8172_FRNET_Reset Description: Reset FRnet digital output status. Syntax: void i8172_FRNET_Reset(int Slot, BYTE Port) Parameter: Slot : [Input] Specify the PAC system slot (Range: 1 to 7) Port: [Input] Specify the FRnet port of i8172x (0 or 1) Return Value: NONE Example: slot=1;...
  • Page 67: Xsram Access Functions

    2.8 XSRAM Access Functions XSRAM function for EzPlatformSDK support the Battery Backup SRAM (BBSRAM) on the PAC backplane. The BBSRAM have the data block and offset address. The BBSRAM have 4096 blocks (0~4095), and every block has 128 offset addresses. The BBSRAM have 4096*128=512KB SRAM. Before you use the function in this session, you must call the XSRAM_Init() function first.
  • Page 68: Xsram_Get_Max_Block

    2.8.2 XSRAM_Get_Max_Block Description: This function is used to get the BBSRAM Max_Block on PAC Backplane. Syntax: WORD XSRAM_Get_Max_Block (); Parameter: None Return Value: 4096 There have 4096 Blocks on BBSRAM. There don’t have BBSRAM on PAC Backplane. Example: unsigned char Data;...
  • Page 69: Xsram_Set_Block

    2.8.3 XSRAM_Set_Block Description: This function is used to set the current Block number of BBSRAM on the PAC Backplane. Syntax: bool XSRAM_Set_Block(WORD Block); Parameter: Block : [Input] current Block number of BBSRAM. For BBSRAM Block is 0~4095 Return Value: True Set ok False Set NG...
  • Page 70: Xsram_Write_Byte

    2.8.4 XSRAM_Write_Byte Description: This function is used to write a byte to BBSRAM’ offset address on Current Block. Syntax: void XSRAM_Write_Byte(unsigned char address,unsigned char data); Parameter: address : [Input] the offset address on Current Block. data : [Input] the byte data will be write. Return Value: None Example:...
  • Page 71: Xsram_Read_Byte

    2.8.5 XSRAM_Read_Byte Description: This function is used to read a byte from BBSRAM’ offset address on Current Block. Syntax: unsigned char XSRAM_Read_Byte(unsigned char address); Parameter: address : [Input] the offset address on Current Block. data : [Input] the byte data will be write. Return Value: Return the byte data that was read.
  • Page 72: Xsram_Get_Type

    2.8.6 XSRAM_Get_Type Description: This function is used to get the BBSRAM type on PAC Backplane. Syntax: WORD XSRAM_Get_Type(); Parameter: None Return Value: 512: There have BBSRAM on PAC Backplane. : There don’t have BBSRAM on PAC Backplane. Example: unsigned char Data;...
  • Page 73: Xsram_Get_Battery_Status

    2.8.7 XSRAM_Get_Battery_Status Description: This function is used to read status of battery level. If the level of battery is low voltage please change that battery, so the BBSRAM can work normally. Otherwise the BBSRAM will lose the data. Syntax: long XSRAM_Get_Battery_Status (int BatteryNo);...
  • Page 74: Eeprom Read/Write Functions

    EEPROM Read/Write Functions There is a 16K-byte EEPROM in the main control unit in the PAC 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.
  • Page 75: Writeeep

    2.9.2 WriteEEP Description: This function is used to write one byte of data to the EEPROM. Syntax: void WriteEEP(int block, offset, unsigned char ucData) Parameter: block : [Input] the block number of EEPROM. offset: [Input] the offset within the block. ucData: [Input] data to write to EEPROM.
  • Page 76: Motion Control Modules

    2.10 Motion Control modules PAC support the Motion Control modules, which was list below: module description i8092F High Speed 2-Axes Motion Control Module with FRNET i8094 High Speed 4-Axes Motion Control Module i8094F High Speed 4-Axes Motion Control Module with FRNET i8094A High Speed 4-Axes Motion Control Module with CPU i8094H High Speed 4-Axes Motion Control Module with CPU and FRNET For more detail information please reference to the relate manuals.
  • Page 77: Using Mp-8X43 Serial Ports

    3. Using MP-8x43 Serial Ports This section describes how to use the three serial ports (RS-232/RS-485 interface) on the PAC embedded controller. The information in this section is organized as follows:   COM1 Port   COM2 Port   COM3 Port  ...
  • Page 78: Com1 Port

    3.1.1 COM1 Port This COM1 port is located on the PAC backplane. It is a standard RS-232 serial port, and it serial control to the specified slot for the control of 87K series, and the Baud Rate is fixed to 115.2K bps. RS­232, Non­isolation (TxD, RxD and GND) ...
  • Page 79: Com4 Port

    RS­485  Baud Rate: 115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200 bps    Data Bits: 5, 6, 7, 8  Parity: None, Even, Odd, Mark (Always 1), Space (Always 0)  Stop Bits: 1, 2  FIFO: 16 bytes  Note: 16C550 compatible 3.1.4 COM4 Port This COM4 port provides RS-232/485 serial communication port on the PAC. RS­232(TxD, RxD and GND) or 485 (DATA+ and DATA­)  Baud Rate: 115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200 bps    Data Bits: 5, 6, 7, 8  Parity: None, Even, Odd,    Mark (Always 1),    Space (Always 0)  Stop Bits: 1, 2  FIFO: 16 bytes  Note: 16C550 compatible    COM4 can be configured as either RS-232 or RS-485, and the configuration depends on the pin connections as follows: RS­232 (RxD, TxD, CTS, RTS and GND) ...
  • Page 80: Com5 Port

    3.1.5 COM5 Port This COM5 port provides RS-232 serial communication port on the PAC. RS­232 (TxD, RxD, CD, CTS, RTS, DSR, DTR, GND, RI)  Baud Rate: 115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200 bps    Data Bits: 5, 6, 7, 8  Parity: None, Even, Odd,    Mark (Always 1),    Space (Always 0)  Stop Bits: 1, 2  FIFO: 16 bytes  Note: 16C550 compatible 80  http://www.icpdas.com MP-8x43 Function Reference V 1.0...
  • Page 81: Library Architecture Of The Serial Port

    3.1.6 Library Architecture of the Serial Port The SerialCE are library files that are designed for applications that run on the PAC main controller unit and can control the remote modules (I-7000/I-8000/I-87K series modules) through a serial port using Windows CE 6.0. The user can apply them to develop their own applications with many development tools such as Microsoft VS 2008 Visual C++.
  • Page 82: Serial Port Applications Demo In Vc

    3.2 Serial port applications demo in VC The SerialCE is powerful library tools designed specifically for the development of user applications within PAC embedded controllers. The directory settings found in the options for Visual C++. The user program is use in the following: First create a new Visual C++ project.
  • Page 83: Serialce Api

    4. SerialCE API 4.1 Serial port basic function 4.1.1 Get_Version Description: The function is used to obtain the version information. Syntax: long Get_Version(void) Parameter: None Return Value: Version number ==> 0x1000 Example: long Version; Version= Get_Version (); //Version= 0x1000 //For example version 1.0.0.0 Remark: 83  http://www.icpdas.com...
  • Page 84: Open_Com

    4.1.2 Open_Com Description: This function is used to configure and open the COM port. It must be called once before sending/receiving command through COM port. Syntax: long Open_Com(unsigned char cPort, DWORD dwBaudrate,char cData, char cParity, char cStop) Parameter: cPort: [Input] 1=COM1, 2=COM2 …. , MAXPORT dwBaudRate: [Input] 1200/1800/2400/4800/7200/9600/ 19200/38400/57600/115200...
  • Page 85: Close_Com

    4.1.3 Close_Com Description: This function closes and releases the resources of the COM port from computer recourse. And it must be called before exiting the application program. The Open_Com will return error message if the program exit without calling Close_Com function. Syntax: long Close_Com(unsigned char cPort)
  • Page 86: Datasizeincom

    4.1.4 DataSizeInCom Description: Get the how many data existed on the input buffer of COM port. Syntax: long DataSizeInCom (unsigned char cPort) Parameter: port: [Input] 1=COM1, 2=COM2 …. , MAXPORT Return Value: >=0 : Data size in the input buffer. <0 : Error code, please refer to “Appendix A Error Code”.
  • Page 87: Datasizeoutcom

    4.1.5 DataSizeOutCom Description: Get the how many data existed on the output buffer of COM port. Syntax: long DataSizeOutCom (unsigned char cPort) Parameter: port: [Input] 1=COM1, 2=COM2 …. , MAXPORT Return Value: >=0 : Data size in the output buffer. <0 : Error code, please refer to “Appendix A Error Code”.
  • Page 88: Readcomn

    4.1.6 ReadComn Description: This function is applied to receive the multi-bytes data from COM port input buffer. Syntax: long ReadComn (unsigned char cPort, char szResult[], WORD wmaxLen, WORD *wT) Parameter: Cport:: [Input] 1=COM1, 2=COM2 …. , MAXPORT szResult: [Output] Pointer to the buffer that receives the data read wmaxLen:: [Input] Number of bytes to be read COM port *wT:...
  • Page 89: Send And Receive Binary Data

    4.2 Send and Receive binary data 4.2.1 Send_Binary Description: This function is used to send binary data to the serial port with the fixed length. Syntax: long Send_Binary (unsigned char cPort, char szCmd[], iLen ,WORD wSTimeOut=0) Parameter: cPort: [Input] 1=COM1, 2=COM2 …. , MAXPORT szCmd: [Input] pointer of Sending binary data.
  • Page 90: Receive_Binary

    4.2.2 Receive_Binary Description: This function is used to receive binary data from the serial port with the fixed length. Syntax: long Receive_Binary (unsigned char cPort, char szResult[],WORD wTimeOut, WORD wLen, WORD *wT) Input Parameter: cPort: [Input] 1=COM1, 2=COM2 …. , MAXPORT szResult: [Output] The receiving binary data from the module wTimeOut:...
  • Page 91 memset(m_szSend, '\n', sizeof(m_szSend)); sprintf(m_szSend, "%s", "0123456789"); //Remote other device Send_Binary(m_ComPort , m_szSend, m_length); //Send 10 character RET =Receive_Binary(m_ComPort , m_szReceive, m_TimeOut, m_wlength, &m_wT); RET =Close_Com(m_ComPort); //Receive 10 character Remark: 91  http://www.icpdas.com MP-8x43 Function Reference V 1.0...
  • Page 92: Send_Receive_Binary

    4.2.3 Send_Receive_Binary Description: This function is used to Send binary data and receive binary data with the fixed length. Syntax: long Send_Receive_Binary(unsigned char cPort, char ByteCmd[],WORD in_Len,char ByteResult[], WORD out_Len, WORD wTimeOut, WORD wSTimeOut=0) Parameter: cPort : [Input] 1=COM1, 2=COM2 …. , MAXPORT ByteCmd[]: Pointer to binary data to be send.
  • Page 93 memset(m_ByteCmd, '\n', sizeof(m_ByteCmd)); sprintf(m_ByteCmd, "%s", "0123456789"); //Remote other device RET =Send_Receive_Binary(m_ComPort, ByteCmd,in_Len,ByteResult, out_Len,wTimeOut) //Send 10 character RET =Close_Com(m_ComPort); Remark: 93  http://www.icpdas.com MP-8x43 Function Reference V 1.0...
  • Page 94: Send And Receive With Cr End Character

    4.3 Send and Receive with CR end character 4.3.1 Send_Cmd Description: This function only sends a command string to DCON series modules. If the wCheckSum=1, it automatically adds the two checksum bytes to the command string. And then the end of sending string is further added [0x0D] to mean the termination of the command (szCmd).
  • Page 95 char m_parity=0; char m_stopbit=0; char m_szSend[100]; WORD m_TimeOut=100; WORD m_Checksum=0; long RET; RET =Open_Com(m_ComPort, m_baudrate, m_databit, m_parity, m_stopbit); memset(m_szSend, '\n', sizeof(m_szSend)); sprintf(m_szSend, "%s", "$01M"); //Remote module address “1” ,I7016D RET=Send_Cmd(m_ComPort, m_szSend, m_TimeOut, m_Checksum); RET=Close_Com(m_ComPort); Remark: 95  http://www.icpdas.com MP-8x43 Function Reference V 1.0...
  • Page 96: Receive_Cmd

    4.3.2 Receive_Cmd Description: User can utilize this function to obtain the response string from the modules in RS-485 Network. And this function provides a response string without the last byte [0x0D]. Syntax: long Receive_Cmd (unsigned char cPort, char szResult[], WORD wTimeOut, WORD wChksum, WORD *wT) Parameter: Cport::...
  • Page 97 sprintf(m_szSend, "%s", "$01M"); //Remote module address “1” ,I7016D RET=Send_Cmd(m_ComPort, m_szSend, m_Checksum); RET=Receive_Cmd(m_ComPort, m_szReceive, m_TimeOut, m_Checksum, &m_wT); RET=Close_Com(m_ComPort); //m_szReceive <- “!017016D” Remark: 97  http://www.icpdas.com MP-8x43 Function Reference V 1.0...
  • Page 98: Send_Receive_Cmd

    4.3.3 Send_Receive_Cmd Description: This function sends a command string to RS485 Network and receives the response from RS485 Network. If the wCheckSum =1, this function automatically adds the two checksum bytes into the command string and also check the checksum status when receiving response from the modules. Note that the end of sending string is added [0x0D] to mean the termination of every command.
  • Page 99 Return Value: NoError : Others : Error code, please refer to “Appendix A Error Code”. Example: unsigned char m_ComPort=3; //Com_port of PAC DWORD m_baudrate=9600; char m_databit=8; char m_parity=0; char m_stopbit=0; char m_szSend[100]; char m_szReceive[100]; WORD m_TimeOut=100; WORD m_Checksum=0; WORD m_wT; long RET;...
  • Page 100: Other Serial Port Api

    Serial 4.4 Other port API 4.4.1 Get_Com_Status Description: The function can obtain COM Port status. Syntax: long Get_Com_Status (unsigned char cPort) Parameter: cPort: [Input] 1=COM1, 2=COM2 …. , MAXPORT Return Value: COM port is not in used. COM port is in used. <0: Error code, please refer to “Appendix A Error Code”.
  • Page 101: Change_Baudrate

    4.4.2 Change_BaudRate Description: This function only can be applied to change the Baudrate setting of serial communication after COM port was opened. Syntax: long Change_BaudRate (unsigned char cPort, DWORD dwBaudrate) Parameter: cPort : [Input] 1=COM1, 2=COM2 …. , MAXPORT dwBaudrate: [Input] 1200/1800/2400/4800/7200/9600/ 19200/38400/57600/115200 Return Value:...
  • Page 102: Change_Config

    4.4.3 Change_Config Description: This function only can be used to change the configuration of the COM port after COM port was opened. Syntax: long Change_Config (unsigned char cPort, DWORD dwBaudrate,char cData, char cParity, char cStop) Parameter: cPort: [Input] 1=COM1, 2=COM2 …. , MAXPORT dwBaudRate: [Input] 150/300/600/1200/1800/2400/4800/ 7200/9600/19200/38400/57600/115200...
  • Page 103: Setlinestatus

    4.4.4 SetLineStatus Description: Set the Line Status (DTR, RTS). Syntax: long SetLineStatus (int port, pin, mode) Parameter: port: [Input] 1=COM1, 2=COM2 …. , MAXPORT pin: [Input] 1: DTR, 2: RTS, 3: DTR+RTS mode: [Input] 0: Disable, 1: Enable, 2: HandShake Return Value: NoError : Others :...
  • Page 104: Getlinestatus

    4.4.5 GetLineStatus Description: Get the Line Status (CTS, DSR, RI, CD). Syntax: long GetLineStatus (int port, pin) Parameter: port: [Input] 1=COM1, 2=COM2 …. , MAXPORT pin: [Input] 0: CTS, 1: DSR, 2: RI, 3: CD Return Value: Others : Error code, please refer to “Appendix A Error Code”. Example: port=3;...
  • Page 105: Set_Flowcontrol

    4.4.6 Set_FlowControl Description: This function is used to set DCB settings which are related to the flow control (Software and Hardware). Syntax: long Set_FlowControl (unsigned char cPort, DCB_Member, mode) Parameter: cPort : [Input] 1=COM1, 2=COM2 …. , MAXPORT DCB_Member: 0 CtS (fOutxCtsFlow) 1 Rts (fRtsControl) 2 Dsr (fOutxDsrFlow) 3 Dtr (fDtrControl)
  • Page 106 Return Value: NO_ERROR Others: Error code, please refer to “Appendix A Error Code”. Example: unsigned char m_ComPort=3; //Com_port of PAC DWORD m_baudrate=9600; char m_databit=8; char m_parity=0; char m_stopbit=0; char m_szSend[100]; char m_szReceive[100]; long RET; RET =Open_Com(m_ComPort, m_baudrate, m_databit, m_parity, m_stopbit); RET =Set_FlowControl(m_ComPort, 3, 1);...
  • Page 107: Get_Flowcontrol

    4.4.7 Get_FlowControl Description: This function is used to get DCB settings which are related to the flow control (Software and Hardware). Syntax: long Get_FlowControl (unsigned char cPort, DCB_Member) Parameter: cPort : [Input] 1=COM1, 2=COM2 …. , MAXPORT DCB_Member: 0 CtS (fOutxCtsFlow) 1 Rts (fRtsControl) 2 Dsr (fOutxDsrFlow) 3 Dtr (fDtrControl)
  • Page 108 Example: unsigned char m_ComPort=3; //Com_port of PAC DWORD m_baudrate=9600; char m_databit=8; char m_parity=0; char m_stopbit=0; char m_szSend[100]; char m_szReceive[100]; long RET; RET=Open_Com(m_ComPort, m_baudrate, m_databit, m_parity, m_stopbit); RET =Get_FlowControl(m_ComPort, 3); RET=Close_Com(m_ComPort); Remark: Software flow control: Use XOFF and XON characters to control the transmission and reception of data. Hareware flow control: Use control lines of the serial cable to control whether sending or receiving is enabled.
  • Page 109: Clear_Buffer

    4.4.8 Clear_Buffer Description: This function is used to clear the buffer of input (output) for the serial port. Syntax: long Clear_Buffer (unsigned char cPort, unsigned char cAction) Parameter: cPort : [Input] 1=COM1, 2=COM2 …. , MAXPORT cAction: [Input] 0: clear Tx, 1: clear Rx 2: clear Tx and Rx Return Value:...
  • Page 110: Appendix A Serialce Api Error Code

    APPENDIX A SerialCE API Error Code NoError Functions work normally. Open_Com_Error -101 Open Com port error. Close_Com_Error -102 Cloes Com port error. SetCommState_Error -103 Set COM port status error. GetCommState_Error -104 Read COM port status error. SetTimeOut_Error -105 Set COM port TimeOut error. Win32API_Error -109 Call wrong function error.
  • Page 111: Problems Report

    PROBLEMS REPORT Technical support is available at no charge. The best way to report problems is send electronic mail to service@icpdas.com When reporting problems, please include the following information: Is the problem reproducible? If so, how? What kind and version of Platform are you using? For example, Windows 2000, Windows for Workgroups, Windows XP, etc.

Table of Contents