/********************************************************************/ /* XW507 API Functions for uPAC-5000 Series */ /* */ /* [Dec 22, 2015] by Liam version 1.00 */ /********************************************************************/ #ifndef __XW507_H #define __XW507_H #ifdef __cplusplus extern "C" { #endif int XW507_Init(void); /* Initiate the XW507 library Return On success, returns zero On error, returns a non-zero value Bit7: 1 => XW507 cannot be found */ unsigned XW507_GetLibVersion(void); /* Get the version number of XW507 library Return It always returns a non-zero value to indicate the current version 0x100 indicates the version is 1.00 */ void XW507_GetLibDate(char *date); /* Get the build date of the current version of XW507 library Argument date: Buffer where function writes the string */ int XW507_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 XW507_Read_One_DI(int channel); /* Read the input status of the specified channel Argument channel: Channel number, represented as 0, 1, 2, 3 and 4 Return 0 for ON (short to GND) and 1 for OFF (Open) */ void XW507_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 XW507_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 and 4 status: An integer specifying the output value, 0 for OFF and 1 for ON */ int XW507_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 XW507_Read_One_DO(int channel); /* Read back the current status of the specified channel Argument channel: Channel number, represented as 0, 1, 2, 3 and 4 Return An integer representing the output state, 0 for OFF and 1 for ON */ #ifdef __cplusplus } #endif #endif