Read coil status (Function 1)
The Read coil status function can be used to read the digital outputs that have been set.
The first 10 digital outputs are read in this example. The start address is zero. An offset can be entered in the Start address field
Query
Byte name |
Sample |
---|---|
Function code |
1 |
Start address high |
0 |
Start address low |
0 |
Count high |
0 |
Count low |
10 |
The fieldbus coupler answers with byte count 2, i.e. 2 bytes of data are returned. The query was for 10 bits, and these are now distributed over 2 bytes. The third bit is set in the output process image, and the fieldbus coupler shows the value 4 in the first data byte.
Response
Byte name |
Sample |
---|---|
Function code |
1 |
Byte count |
2 |
Data bits 0...7 |
4 |
Data bits 8...18 |
0 |