/********************************************************************/ /* XW107/XW107i API Functions for uPAC-5000 Series */ /* */ /* [Mar 29, 2012] by Liam version 1.00 */ /********************************************************************/ #ifndef __XW107_H #define __XW107_H #ifdef __cplusplus extern "C" { #endif int XW107_Init(void); /* Initiate the XW107 library Return On success, returns zero On error, returns a non-zero value Bit7: 1 => XW107/XW107i cannot be found */ unsigned XW107_GetLibVersion(void); /* Get the version number of XW107 library Return It always returns a non-zero value to indicate the current version 0x100 indicates the version is 1.00 */ void XW107_GetLibDate(char *date); /* Get the build date of the current version of XW107 library Argument date: Buffer where function writes the string */ int XW107_Read_All_DI(void); /* Read the input status of all channels Return All digital inputs are packed as one channel per bit of the return data. Status is indicated as 0=ON (short to GND) and 1=OFF (Open) For example: The status of inputs is shown as the byte value 0C hex, or binary 0000 1010. DI3 is in the fifth bit position from the left, and DI0 is the LSB of this byte. */ int XW107_Read_One_DI(int channel); /* Read the input status of the specified channel Argument channel: Channel number, represented as 0, 1, 2, 3, 4, 5, 6 and 7 Return 0 for ON (short to GND) and 1 for OFF (Open) */ void XW107_Write_All_DO(int value); /* Set the output status for all channels Argument value: All digital outputs are packed as one channel per bit of the writing value */ void XW107_Write_One_DO(int channel, int status); /* Set the output status for the specified channel Argument channel: Channel number, represented as 0, 1, 2, 3, 4, 5, 6 and 7 status: An integer specifying the output value, 0 for OFF and 1 for ON */ int XW107_Read_All_DO(void); /* Read back the current status of all channels Return All digital outputs are packed as one channel per bit of the return data. Status is indicated as 1=ON and 0=OFF For example: The status of outputs is shown as the byte value 0C hex, or binary 0000 1010. DO3 is in the fifth bit position from the left, and DO0 is the LSB of this byte. */ int XW107_Read_One_DO(int channel); /* Read back the current status of the specified channel Argument channel: Channel number, represented as 0, 1, 2, 3, 4, 5, 6 and 7 Return An integer representing the output state, 0 for OFF and 1 for ON */ #ifdef __cplusplus } #endif #endif