This shows you the differences between two versions of the page.
moacon:rtu_readinregs:index [2016/04/14 11:07] |
moacon:rtu_readinregs:index [2016/04/14 11:07] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== RTU_readInRegs ====== | ||
+ | |||
+ | ''short RTU_readInRegs(u8 comCh, u8 slaveAdr, u8* result, u16 targetAdr, u8 numOfRegs)'' | ||
+ | |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 | | ||
+ | |numOfRegss: Number of registers (words) to read | | ||
+ | |returns the status of this function call (-1=Success, 0=Timeout, 1=Data Error) | | ||
+ | |||
+ | Performs the same operation as RTU_readRegs but uses Modbus function code 4. The MOACON does not | ||
+ | distinguish between function codes 3 and 4, but some PLCs do. This function is provided so the MOACON | ||
+ | can interface properly with those PLCs that distinguish between function codes 3 and 4. | ||
+ | |||
+ | <code c> | ||
+ | u8 registerBuffer[100]; | ||
+ | res = RTU_readInRegs(0,1,registerBuffer,0,2); | ||
+ | </code> | ||
+ | |||
+ | [[moacon:about_modbus:index|About MODBUS]] | ||
+ | |||
+ | [[MOACON:index#System_Library:|go MOACON home]] | ||