Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

modbus functions naming

Status
Not open for further replies.

syenidogan

Member level 1
Member level 1
Joined
Mar 6, 2014
Messages
41
Helped
2
Reputation
4
Reaction score
3
Trophy points
8
Visit site
Activity points
297
Read Coil Status (FC=01)
0A 01 04A1 0001 AC63
0A: The Slave Address (10 = 0A hex)
01: The Function Code (read Coil Status)
04A1: The Data Address of the first coil to read. (Coil 1186 - 1 = 1185 = 04A1 hex)
0001: The total number of coils requested.
AC63: The CRC (cyclic redundancy check) for error checking.

Read Holding Registers (FC=03)
A0 03 006B 0003 7687

A0: The Slave Address (10= A0 hex)
03: The Function Code (read Analog Output Holding Registers)
006B: The Data Address of the first register requested. (40108-40001 = 107 = 6B hex)
0003: The total number of registers requested. (read 3 registers 40108 to 40110)
7687: The CRC (cyclic redundancy check) for error checking.

what is the difference between these two functions? i mean why they are named read coil status and read holding registers? why we just do not name them like function 1 , function 2?

read holding register and read coil status . they both doing the same thing. the same operations. why different names? or why not just call them read data?
 
Last edited:

read holding register and read coil status . they both doing the same thing.
Nope. You really should read the MODBUS specification more thoroughly. Specifically the "MODBUS Application Protocol Specification", available at www.modbus.org

Coils are single bits, holding registers are 16 bit words. The functions are usually accessing different objects. But it's up to designer of a MODBUS server how he connects physical I/O with MODBUS addresses and function codes. Some devices are e.g. mapping input and holding registers to the same I/O objects.
 

Read Coil Status (FC=01)

Request

This command is requesting the ON/OFF status of discrete coils # 20 to 56
from the slave device with address 17.

11 01 0013 0025 0E84
11: The Slave Address (17 = 11 hex)
01: The Function Code (read Coil Status)
0013: The Data Address of the first coil to read. (Coil 20 - 1 = 19 = 13 hex)
0025: The total number of coils requested. (coils 20 to 56 = 37 = 25 hex)
0E84: The CRC (cyclic redundancy check) for error checking.

Response

11 01 05 CD6BB20E1B 45E6

11: The Slave Address (17 = 11 hex)
01: The Function Code (read Coil Status)
05: The number of data bytes to follow (37 Coils / 8 bits per byte = 5 bytes)
CD: Coils 27 - 20 (1100 1101)
6B: Coils 35 - 28 (0110 1011)
B2: Coils 43 - 36 (1011 0010)
0E: Coils 51 - 44 (0000 1110)
1B: 3 space holders & Coils 56 - 52 (0001 1011)
45E6: The CRC (cyclic redundancy check).




Read Holding Registers (FC=03)

Request

This command is requesting the content of analog output holding registers # 40108 to
40110 from the slave device with address 17.

11 03 006B 0003 7687

11: The Slave Address (17 = 11 hex)
03: The Function Code (read Analog Output Holding Registers)
006B: The Data Address of the first register requested. (40108-40001 = 107 = 6B hex)
0003: The total number of registers requested. (read 3 registers 40108 to 40110)
7687: The CRC (cyclic redundancy check) for error checking.

Response

11 03 06 AE41 5652 4340 49AD

11: The Slave Address (17 = 11 hex)
03: The Function Code (read Analog Output Holding Registers)
06: The number of data bytes to follow (3 registers x 2 bytes each = 6 bytes)
AE41: The contents of register 40108
5652: The contents of register 40109
4340: The contents of register 40110
49AD: The CRC (cyclic redundancy check).

- - - Updated - - -

slave just keeps some 1 and 0 in a variable, in a register, in a coil whatever. 8 coils one byte at adress 100 (unsigned char) 8 coils one byte at adress 101 (unsigned char) or just for 16 coils (a register) 2 bytes at adress 102 (lsb) and at 103 (msb)

im a slave . if i get a (Read Coil Status (FC=01) or Read Holding Registers (FC=03) for me its just a read request , as long as i know the address and how many bytes i have to send , why master cares how im storing the data as a slave. in a register (16 bits) or 16 bits saparete in two bytes (unsigned char)

tell the slave just read or write , from which addres it should start, howmany bytes it should read.

with function1 : read coil, start from a addres 16 coils to read( 2 bytes) (we are sending)
with function 3 :read register start from a adress read 1 register(2 bytes)

both function starts from a addres... reads 2 bytes. for those above two operation

just say read start from this addres, read two bytes. (never care of that two bytes if that consists of 16 saperate bit , or 2 unsgined char or one 16 bit register.

im asking this. i dont know if my english was enought to tell .
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top