User Tools

Site Tools




short RTU_readCoils(u8 comCh, u8 slaveAdr, u8* result, u16 targetAdr, u8 numOfCoils)

comCh: The RS-232 channel to use
slaveAdr: The Modbus slave address of the device to read from
result: Buffer to store coil (bit) data to
targetAdr: The address of the data to read
numOfCoils: Number of coils (bits) to read
returns the status of this function call (-1=Success, 0=Timeout, 1=Data Error)

Reads numOfCoils bits from slave device slaveAdr, at address targetAdr, on RS-232 channel comCh and stores the data in result. Returns a number indicating whether or not the function call was successful.

u8 coilBuffer[100];
res = RTU_readCoils(0,1,coilBuffer,4,12);


go MOACON home

moacon/rtu_readcoils/index.txt · Last modified: 2019/05/28 11:39 by COMFILE Technology