/**************************************************/ /*head file for 8172 */ /* */ /*Library: */ /* 8000E.lib */ /*Ver 1.1.3 [25 May,2010] by Martin */ /**************************************************/ int FRnet_GetLibVersion(); /********************************************************* User use this function to read the version of lib. *********************************************************/ void FRnet_GetLibDate(char *LibDate); /******************************************************** Reading the date of lib lately. *********************************************************/ //FR-2057 function void FRnet_WriteDOGroup(int group, unsigned int doData); /*************************************************************** User use this function to input Hex value to DO module, group: 0 ~ 7 iData: 0 ~ 0xffff ****************************************************************/ //FR-2057 function void FRnet_WriteDOBit(int group,int bitIndex, int bitStatus); /**************************************************************** User use this function to input single channel to DO module, group: 0 ~ 7 bitIndex: 0~15 bitStatus: 0 off 1 on ****************************************************************/ //FR-2053 function unsigned int FRnet_ReadDIGroup(int group); /*************************************************************** User use this function to read value from DI module, Group: 8 ~ 15 return: DI Value 0 ~ 0xffff ****************************************************************/ //FR-2053 function unsigned int FRnet_ReadDIBit(int group,int bitIndex); /*************************************************************** User use this function to read single channel from DI module, group: 8 ~ 15 bitIndex: 0 ~ 15 return: 0 or 1 ************************************************************/ //FR-2053, FR-2054, FR-2017 function int FRnet_ReadInputGroupStatus( int group); /************************************************************** Read status of single DI group: Group: 8 ~ 15 return 0 off line, 1 on line ***************************************************************/ //FR-2054 function void FRnet_DIO_WriteDOGroup( int group,unsigned int doData); /*************************************************************** User use this function to input Hex value to DO module, group: 0 ~ 7 iData: 0 ~ 0xff ****************************************************************/ //FR-2054 function void FRnet_DIO_WriteDOBit(int group,int bitIndex,int bitStatus); /**************************************************************** User use this function to input single channel to DO module, group: 0 ~ 7 bitIndex: 0~7 bitStatus: 0 off 1 on ****************************************************************/ //FR-2054 function unsigned int FRnet_DIO_ReadDIGroup(int group); /*************************************************************** User use this function to read value from DI module, group: 8 ~ 15 return: DI Value 0 ~ 0xff ****************************************************************/ //FR-2054 function unsigned int FRnet_DIO_ReadDIBit(int group,int bitIndex); /*************************************************************** User use this function to read single channel from DI module, group: 8 ~ 15 bitIndex: 0 ~ 7 return: 0 or 1 ************************************************************/ //FR-2017 function short FRnet_ReadAIHex(int group,short bitMode,short *chIndex, short* aiHex); /*************************************************************** User use this function to read channel index and analog input data get from FR-2017, group: 8 ~ 15 bitMode: 12 means 12-bit mode, 16 means 16-bit mode. *chIndex: requested channel index get from FR-2017 *aiHex: requested hex format analog input data from FR-2017 return: if return < 0 means Read AI Hex failed else means Read AI Hex successfully. Note: For FRnet, FR-2017 update 16-bit data coutinuous every 2.8 ms, if 16-bit mode, *iChannel always be 0, and aiHex will be the only analog input data. if 12-bit mode, the data format defined as MSB LSB bit15 bit14 bit13 bit12 bit11 bit10 Bit9 Bit8 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 |<------------------------------12-bits AD data------------------------------------------->| |<----- Channel Index ---->| if 12-bit mode, we have to use FRnet_ReadAIHex function to get which channel and data get from FR-2017, if use FRnet_ReadAIHex to get hex data from FR-2017, we have to use FRnet_AIHexToFloat with typeCode and bitMode to convert the hex data to float. ****************************************************************/ float FRnet_AIHexToFloat(short hexData, short typeCode, short bitMode); /*************************************************************** User use this function to convert hex format analog input data to float format, hexData: hex format analog input data get from FR-2017 with function FRnet_ReadAIHex typeCode: the input range of FR-2017 bitMode: 12 means 12-bit mode, 16 means 16-bit mode. return converted float format data. FR_2017 type code 0x1a 0 ~ 20 mA 0x7 4 ~ 20 mA 0x8 +/-10 V 0x9 +/-5 V 0xa +/-1 V 0xb +/-500 mV 0xc +/-150 mV 0xd +/-20 mA ****************************************************************/ short FRnet_ReadAI_Ch( int group, short bitMode,short typeCode, short chIndex, float* aiFloat); /*************************************************************** User use this function to read channel index and analog input data get from FR-2017, group: 8 ~ 15 bitMode: 12 means 12-bit mode, 16 means 16-bit mode. typeCode: the input range of FR-2017 chIndex: requested channel index of FR-2017 *aiFloat: requested float format analog input data from FR-2017 return: if return < 0 means Read AI timeout else means Read AI without timeout. Note: for most users, it is not convenient to use FRnet_ReadAIHex to get the analog input data from FR-2017 By using FRnet_ReadAI_Ch, program will blocked for about 0 to 45 ms to get certain channel index data. FR_2017 type code 0x1a 0 ~ 20 mA 0x7 4 ~ 20 mA 0x8 +/-10 V 0x9 +/-5 V 0xa +/-1 V 0xb +/-500 mV 0xc +/-150 mV 0xd +/-20 mA ****************************************************************/ short FRnet_ReadAI_All( int group, short bitMode,short totalCh,short typeCode[], float aiFloat[]); /*************************************************************** User use this function to read all analog input data get from FR-2017, group: 8 ~ 15 bitMode: 12 means 12-bit mode, 16 means 16-bit mode. totalCh: if 16-bit mode, totalCh =1, if 12-bit and differential mode totalCh = 8, if 12-bit and single-ended mode totalCh = 16, typeCode[]: the input range array of FR-2017 aiFloat[]: requested float format analog input data array. return: if return < 0 means Read AI timeout else means Read AI without timeout. Note: for most users, it is not convenient to use FRnet_ReadAIHex to get the analog input data from FR-2017 By using FRnet_ReadAI_ALL, program will blocked for about 0 to 45 ms to get all channels' data. FR_2017 type code 0x1a 0 ~ 20 mA 0x7 4 ~ 20 mA 0x8 +/-10 V 0x9 +/-5 V 0xa +/-1 V 0xb +/-500 mV 0xc +/-150 mV 0xd +/-20 mA ****************************************************************/ short FRnet_WriteAOHex(int group,short bitMode,short chIndex, short aoHexData, short needDelay); /*************************************************************** User use this function to write analog output data by FR-2024, group: 0 ~ 7 bitMode: 12 means 12-bit mode, at present only support 12-bit mode, reserved this parameter for future I/O with different bit mode. chIndex: channel index of FR-2024 aoHexData: analog output data. needDelay: if needDelay there will be delay 3 ms after FR-2024 write analog output data. return: 0. Note: for some application,program may use a for loop to write analog output by using FRnet_WriteAOHex, but for FRnet protocol, each command will have 3 ms delay for 250K setting and 1 ms delay for 1M setting. if there is no need to write analog output continuously, the delayTime may set as 0 ****************************************************************/ short FRnet_WriteAOFloat(int group,short bitMode,short chIndex, short typeCode, float aoFloat, short needDelay); /*************************************************************** User use this function to write analog output data by FR-2024, group: 0 ~ 7 bitMode: 12 means 12-bit mode, at present only support 12-bit mode, reserved this parameter for future I/O with different bit mode. typeCode: the input range of FR-2024 chIndex: channel index of FR-2024 aoHexData: analog output data. needDelay: if needDelay there will be delay 3 ms after FR-2024 write analog output data. return: 0. Note: for some application,program may use a for loop to write analog output by using FRnet_WriteAOFloat, but for FRnet protocol, each command will have 3 ms delay for 250K setting and 1 ms delay for 1M setting. if there is no need to write analog output continuously, the delayTime may set as 0 typeCode for FR-2024 0 ~ 20mA 0x30 4 ~ 20mA 0x31 0V ~ +10V 0x32 -10V ~ +10V 0x33 0V ~ +5V 0x34 -5V ~ +5V 0x35 ****************************************************************/