short RTU_writeCoils(u8 comCh, u8 slaveAdr, u16 targetAdr, u8 value)
|comCh: The RS-232 channel to use|
|slaveAdr: The Modbus slave address of the device to read from|
|targetAdr: The address of the data to read|
|value: Bit value (0 or 1) to write|
|returns the status of this function call (-1=Success, 0=Timeout, 1=Data Error)|
Writes an array of bits, value, to slave device slaveAdr, at address targetAdr, on RS-232 channel comCh. Returns a number indicating whether or not the function call was successful. Although function code 15 is for writing several bits, this function can write at most 8 bits.
res = RTU_writeCoils(0,1,0x0000,0x12); //Write bit array 0x12 to slave //device 1, address 0x0000