short RTU_writeCoil(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 a bit value 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.
res = RTU_writeCoil(0,1,0x0000,1); //Write a 1 to slave device 1, //address 0x0000