# libmodbus modbus_read_bits() returns illegal function

It is all okay when it comes to read registers with:

modbus_read_registers(ctx,0,32,destination);


It gives me values of 32 different registers. But when it comes to reading bits(coils) in registers i get illegal function error.

modbus_read_bits(ctx,0,1,dest)


After getting this error again and again i made a scanning program like:

for(int i=0; i<100000; i++)


All gives me the same error. I have altivar 930(ATV 930). What to do to read CMD register that has 15 bits with logic address 16#2135 = 8501?

ps: I also tried inputting 0x2135 and 2135. I also get invalid address when i try to read

modbus_read_registers(ctx,8501,1,destination);


• Some Modbus implementations don't support reading less than 8 coils (one byte) at a time, try requesting 8 coils. Also, what is dest? Is it an array or a single byte? – Ron Beyer Oct 14 '17 at 12:29