Reading Bit Values with SINA_PARA FB286/FB287 in TIA Portal
Overview: SINA_PARA and SINAMICS Parameter Access
SINA_PARA is the Siemens application interface used to read and write individual SINAMICS drive parameters from a SIMATIC controller over PROFIBUS, PROFINET, or a direct internal backplane connection. It maps the cyclical acyclic parameter channel of the drive onto a structured function block interface, so that the PLC programmer does not have to handle DPV1 read/write request/response mechanics manually. The block ships in two variants:
| Block | Name | Purpose | Number of Parameters per Call |
|---|---|---|---|
| FB286 | SINA_PARA (multi) | Read/write up to 16 parameters in one job | Up to 16 (configurable via NumberOfPara) |
| FB287 | SINA_PARA (single) | Read or write a single parameter in one job | 1 |
Both blocks exist in three separate library variants supplied by Siemens: one for S7-300/S7-400 (used with STEP 7 V5.x or TIA Portal with compatible S7-300/400 targets), one for S7-1200, and one for S7-1500. The data structures and pin names are identical across targets, but the underlying call wrappers differ. The official Siemens FAQ documents the multi-parameter block under "How to read or write multiple parameters using FB286" and the single-parameter block under "How to read or write a single parameter using FB287".
Block Architecture and I/O Pins
FB286 declares an INPUT structure called Para of the data type SINA_PARA_PARAM, an OUTPUT structure called ParaOut of the same type (echoes the input after the call), and the standard job-control pins listed below.
| Pin | Direction | Data Type | Meaning |
|---|---|---|---|
Start |
IN | BOOL | Rising edge triggers a new read/write job. |
ReadWrite |
IN | BOOL | 0 = read parameter from drive, 1 = write parameter to drive. |
NumberOfPara |
IN | INT | 1..16; defines how many entries in Para are processed. |
Para |
IN | SINA_PARA_PARAM[1..16] | Array of job definitions (parameter number, index, value, type). |
DriveObjectNo |
IN | INT | Drive object number (1 = Control Unit, 2 = first drive, etc.). |
Busy |
OUT | BOOL | 1 = job is in progress. |
Done |
OUT | BOOL | 1 = job finished without error (one-cycle pulse). |
Error |
OUT | BOOL | 1 = job finished with error. |
StatusID |
OUT | WORD | PROFIdrive error code (DWORD/DINT format per Siemens Industry Online Support acyclic error reference). |
Status |
OUT | WORD | Local block status (execution phase indicator). |
ParaOut |
OUT | SINA_PARA_PARAM[1..16] | Mirror of Para after the call (contains srValue/sdValue with the read result). |
AxisNo |
IN | INT | Axis index, used when several axes share the same PROFIdrive connection. |
HW_IDSTW / HW_IDZSW
|
IN | HW_IO | Hardware identifiers of the control/status word slots (used internally for telegram routing). |
HW_ID_Parameter |
IN | HW_IO | Hardware identifier of the parameter channel slot. |
FB287 has the same interface but NumberOfPara is fixed to 1, and the parameter structure is called Parameter with a ValueRead / ValueToWrite split for clarity.
SINAMICS Parameter Data Types and the srValue / sdValue Decision
SINAMICS exposes every parameter with a BICO datatype. The two data types engineers encounter most often when reading bits are:
| Data Type | Length | SINAMICS Sample Parameters | Reads into |
|---|---|---|---|
| Unsigned16 / Integer16 / Word | 2 bytes / 16 bits | r52, r53, r54, r833, p864 |
srValue (REAL field, contains 16-bit value) |
| Unsigned32 / Integer32 / Float / DWord | 4 bytes / 32 bits | r21, r80, r482, r977, p2155 |
sdValue (DINT field) |
| Unsigned8 / Integer8 / Byte | 1 byte / 8 bits | Some status sub-fields | srValue |
The Siemens documentation quoted from the function block internals states:
"All of the parameters of the type DWORD or DINT must be written in theParameter[x].sdValuefield. The block logic automatically detects the DWORD / DINT format, and theParameter[x].sdValuejob field is used for writing or reading. For all other parameters, theParameter[x].srValuefield is used."
That decision is internal and is not driven by the programmer. The engineer's job is to read the parameter's declared datatype from the SINAMICS Parameter Manual (LH1 or FW version) and then pick the right PLC variable width to hold the result.
r52.13 you must read the full 16-bit parameter r52, then extract bit 13 locally in the PLC.
The r52.13 Example: Reading a Single Status Bit
Parameter r52 is the Status Word 1 of a SINAMICS drive. It is 16 bits long and exposed with the SINAMICS datatype Unsigned16. Bit 13 in many firmware revisions is mapped to "Motor overtemperature alarm" (the exact bit meaning is drive-specific; verify against the active SINAMICS List Manual for your firmware). The bit notation r52.13 is display notation only; on the wire, the drive returns the entire word r52 as a 16-bit integer.
Step 1 - Build the request
- Create a global data block (e.g.
DB_SinaPara) of typeSINA_PARA_PARAM(or one that contains an array of 16 of these). - Set
siParaNo := 52. - Set
siIndex := 0(no sub-index; if your parameter has one, set it to the required value). - Set
syType := 0(type not forced; the block reads the declared type from the drive). - Leave
srValueandsdValuecleared for a read job.
Step 2 - Trigger the job
Provide a one-shot rising edge on the Start input of FB286 or FB287.
Step 3 - Wait for Done
When the call returns Done = TRUE without Error = TRUE, the result is in ParaOut[1].srValue as a 16-bit unsigned integer cast to REAL.
Step 4 - Convert and extract the bit
The conversion is the most error-prone step. The srValue field of SINA_PARA_PARAM is declared REAL, but the bit pattern stored in it is the 16-bit integer returned by the drive. Two field-proven ways to extract bit 13 are shown below.
Method A: Word cast and bit test (SCL)
// Read job for r52
#Para[1].siParaNo := 52;
#Para[1].siIndex := 0;
#Para[1].syType := 0;
IF #Start AND NOT #Busy THEN
#StartTrig := TRUE;
END_IF;
// FB287 call (single parameter)
FB287_DB(siParaNo := #Para[1].siParaNo,
siIndex := #Para[1].siIndex,
syType := #Para[1].syType,
srValue := 0.0,
ReadWrite := FALSE,
Start := #StartTrig,
Done => #bDone,
Busy => #bBusy,
Error => #bError,
StatusID => #wStatusID,
ValueRead => #ParaOut[1].srValue);
// Extract bit 13 of r52 from the result
// r52 is Unsigned16, so the 16-bit value lives in the low word of srValue
#StatusWord_52 := WORD_TO_INT(SHR(REAL_TO_DWORD(#ParaOut[1].srValue), 16));
#MotorOvertempAlarm_52_13 := (#StatusWord_52 AND 16#2000) <> 0;
The mask 16#2000 equals 2^13 = 8192, so the result is TRUE when bit 13 of r52 is high.
Method B: AT overlay on a DWORD
// Interpret the REAL storage as DWORD without changing the type
overlayData AT %DB100 : STRUCT
srValueRaw : DWORD; // physical bits of the REAL
END_STRUCT;
// Read returns; use bit address
#MotorOvertempAlarm_52_13 := %DB100.srValueRaw.X13;
Method A is portable across TIA Portal versions; Method B is faster at runtime and easier to read in trending, but it requires the user to know that the parameter is 16 bits wide and will occupy the upper or lower 16 bits of the 32-bit REAL storage depending on the platform. On S7-1500 the conversion is to a DWORD via REAL_TO_DWORD, then shifted right by 16 to obtain the actual 16-bit parameter value before the AND-mask is applied.
Why You Cannot Read a Single Bit Directly
SINAMICS does not support a true bit-level PROFIdrive request. Every Read job returns the full 16- or 32-bit value of the parameter, and the drive resolves the index field only as a sub-index, not as a bit selector. To work around this in the PLC you have two options:
- Read the parent word once, extract many bits. If you need r52.0, r52.13, and r52.14, call SINA_PARA once with siParaNo = 52, then use AND-mask bit tests on the result. This is the lowest-overhead approach and matches the original question.
- Use p2099 / p2051 BICO routing to expose the bit as a separate word on the cyclical process data. The bit then arrives in the cyclical I/O image every few milliseconds without any SINA_PARA call at all, at the cost of a configurable bit in the SINAMICS telegram. This is the right answer for very fast (<10 ms) alarm reactions.
Library Versions and TIA Portal Compatibility
| Library | Target PLC | TIA Portal Version | Notes |
|---|---|---|---|
| SINAMICS blocks V15 | S7-1500 | V15, V15.1, V16 | Includes FB286 + FB287, supports up to 16 parameters per call. |
| SINAMICS blocks V16 | S7-1500 / ET 200SP | V16, V17, V18 | Adds S7-1500R/H redundancy support. |
| SINAMICS blocks V18 | S7-1200 / S7-1500 | V17, V18, V19 | Adds multi-axis AxisNo and hardware identifier handling. |
| DriveLib V14 | S7-1200 | V14, V14 SP1 | Legacy; S7-1200 SINA_PARA limited to 4 parameters per call. |
Always check the library's revision counter after installation. FB286/FB287 in older libraries do not support DriveObjectNo and may produce a StatusID = 16#0001 ("invalid parameter number") when pointed at a non-Control Unit object. The latest library is available on Siemens Industry Online Support under entry ID 109475973 (FB286) and 109475970 (FB287).
Reading Control/Status Words Without SINA_PARA
For the most common 16-bit words (Status Word 1 = r52, Status Word 2 = r53, Control Word 1 = r54, etc.), do not use SINA_PARA at all. These parameters are mapped to the standard PROFIdrive Telegram 1, 2, 3, 4, 6, 7, 9, 102, 103, 105, 106 etc. The S7-1500 hardware identifier of the ZSW1 slot is wired into the HW_IDZSW input of the standard "SINAMICS" library block, and the entire word arrives in the cyclical I/O image. The bit to read is then accessed via:
#MotorOvertempAlarm_52_13 := "DB_Telegram".ZSW1.X13;
Use SINA_PARA only for:
- Drive parameters that are not mapped to the standard telegram (r21, r482, r977, p2155, custom user-defined words).
- Reading parameter sub-indices (e.g. r977[0..30] — the drive firmware version array).
- Writing parameters at commissioning (e.g. p1120, p1121 ramp times; p2155 thresholds).
Step-by-Step Commissioning Procedure for FB287
- Open the TIA Portal project containing the S7-1500 station that is wired to the SINAMICS drive.
- Install the matching "SINAMICS blocks" library from Siemens Industry Online Support. Restart TIA Portal so the master data is refreshed.
- Insert a new global DB (e.g.
DB_Commission) and create a static variablefbParaof typeFB287(single instance). - Add a tag
StatusWord_52of typeWORDand a tagbBit13of typeBOOL. - From the project tree, drag the required hardware identifier (right-click the parameter channel slot under the drive's PROFINET interface, "Properties", "System constants") and wire it to
HW_ID_Parameterof the FB287 instance. - Write the request:
siParaNo := 52; siIndex := 0; syType := 0; ReadWrite := FALSE; Start := rising-edge trigger. - Add an OB1 / OB35 call of the FB287 instance with the wired inputs.
- Compile and download to the S7-1500.
- Force
Start := TRUEonce from the watch table. ConfirmBusy = TRUE, thenDone = TRUEwithError = FALSE. - Open the watch table, monitor
StatusWord_52as HEX, and confirm the upper 16 bits of thesrValuecast match the expected r52 content from STARTER / Startdrive / the SINAMICS web server. - Apply the AND-mask
16#2000and verifybBit13toggles with the alarm state.
Verification Procedure
| Check | Expected | How to Verify |
|---|---|---|
Busy rises on Start
|
TRUE for one acyclic call (typically 30-80 ms on PROFINET) | Watch table or trace |
Done pulse |
TRUE for one cycle after the drive replies | Watch table |
Error stays FALSE |
TRUE if PROFIdrive error | If TRUE, read StatusID
|
StatusID |
0x0000 on success | Compare against PROFIdrive error list |
StatusWord_52 HEX value |
Matches STARTER / Startdrive online view of r52 | Cross-check at the same moment |
| Bit 13 toggle | Flips between 0 and 1 with the alarm condition | Force alarm in STARTER / Startdrive |
| Repetition rate | Equals the period of the Start trigger |
Trace Start and Done
|
Troubleshooting Matrix
| Symptom | Likely Root Cause | Corrective Action |
|---|---|---|
StatusID = 16#0001 "Invalid parameter number" |
siParaNo is wrong for the selected drive object, or the parameter does not exist on the loaded firmware |
Verify the parameter number against the active List Manual; check DriveObjectNo (1 = CU, 2 = drive object 1, etc.) |
StatusID = 16#0002 "Invalid sub-index" |
siIndex is out of range |
Read the parameter documentation for valid sub-indices; reset to 0 for non-indexed parameters |
StatusID = 16#000B "No operator access rights" |
Write job against a parameter that requires an access level above the current key | Use the appropriate access key (p7763, p7766, p7768, p7769) at commissioning time only |
| Busy never returns, no Done |
HW_ID_Parameter points to the wrong slot, or no PROFINET connection |
Re-check the hardware identifier; check drive LED / diagnostic buffer |
srValue always shows 0.0 |
Parameter is DWORD / DINT, result is in sdValue
|
Switch to sdValue; do not AND-mask srValue for 32-bit parameters |
| Bit test always FALSE | Mask error: 16-bit parameter loaded into a WORD but compared with bit 13 of a DWORD | Apply SHR(DWORD,16) before the AND-mask; or use the Method B AT overlay |
| Bits appear "shifted by one" | Confusion between S7 bit numbering (X0 = LSB) and the displayed parameter bit (r52.0 = X0) | S7 Xn maps directly to the SINAMICS bit n; verify with r52 = 16#0001 → X0 must be TRUE |
| Slow response (>200 ms) | Multiple SINA_PARA calls per cycle; PROFIdrive acyclic stack is serial | Batch all needed parameter reads into a single FB286 call with up to 16 entries; consider cyclical BICO for critical bits |
| Value flickers between two different readouts | Two OB contexts call the same SINA_PARA instance | Move the call to a single OB (typically OB1 or OB35); the instance DB is non-reentrant |
Performance and Cycle Time Considerations
Each SINA_PARA call opens a single PROFIdrive acyclic transaction. The request is queued behind the cyclical I/O data, so the typical round-trip time on PROFINET IRT is 30 to 60 ms, on PROFINET RT 40 to 80 ms, and on PROFIBUS DP-V1 20 to 50 ms. The acyclic channel is also serialized at the drive — calling the same drive object with FB286/FB287 from multiple OBs does not parallelize the traffic; only one request is processed at a time. The recommended practice is:
- Bundle all required parameter reads into a single FB286 call with
NumberOfParaequal to the number of distinct parameters. - Trigger the call from a time-controlled OB (OB30-OB38) rather than the OB1 freewheel to bound the load on the controller.
- Do not poll faster than 50 ms; faster cycles do not speed up the acyclic channel and consume both controller and drive CPU time.
- For bit-level alarms that need <10 ms reaction time, route the bit via p2099 / p2051 to the cyclical PZD rather than using SINA_PARA.
Field-Proven Patterns and Edge Cases
- Storing the 16-bit read in an INT and using
x%DBxy.int_value X13is not legal SCL: the AT-view or the shift-and-mask pattern is required. - If the parameter is declared as 32-bit (DWORD) in the drive, the value lands in
sdValue(DINT), and you can directly testsdValue.X13after reading. - For firmware-version reads (r977[0..30]), use siIndex = 0..30 and read each sub-index in a separate SINA_PARA request — there is no array read support in PROFIdrive.
- On a S7-1200, FB286 is limited to 4 parameters per call. If you need more, do two consecutive calls but respect the busy handshake between them.
- Make sure the
DriveObjectNoinput matches the topology: writing r52 to the wrong drive object is not an error (the write succeeds at the wrong place); reading r52 from the wrong object returns zeros with no error flag.
Alternative: Direct PROFINET Cyclic Bits
When only one or two bits are needed at high update rate, use SINAMICS free p2099 + p2051 routing. The procedure is documented in the SINAMICS S120 Function Manual. After configuration, the bit lands in the cyclical PZD and is accessible in the PLC without any acyclic call. This is the right answer for "Overtemperature alarm" bits that are part of a safety or fast-stop chain.
Can SINA_PARA read a single bit, e.g. r52.13, directly?
No. SINAMICS does not support bit-level acyclic access. SINA_PARA returns the full 16-bit word for r52; you must read bit 13 by AND-masking the result with 16#2000 (= 2^13).
Where does the result of a S7-300/400 r52 read go — srValue or sdValue?
r52 is declared Unsigned16 (2 bytes), so the result is returned in the srValue field as a REAL storage containing the 16-bit value. Use REAL_TO_DWORD then shift right 16 bits to recover the raw 16-bit value before applying a bit mask.
What is the difference between FB286 and FB287?
FB286 is the multi-parameter variant that processes up to 16 parameter jobs in one call (driven by NumberOfPara). FB287 is the single-parameter variant, simpler to wire, and identical in result. Use FB286 for batch reads, FB287 for one-off commissioning reads or writes. Official documentation: FB286 PDF and FB287 PDF.
How long does a SINA_PARA call take?
A single acyclic read on PROFINET takes 30-80 ms depending on network load and firmware version. Calling FB286 with 16 parameters is not 16x slower — the drive answers each one as part of the same acyclic stack — but is still bounded by the acyclic timeout. Drive a SINA_PARA call no faster than every 50 ms.
How do I interpret a non-zero StatusID from FB286?
StatusID is a WORD carrying the PROFIdrive error code. Common values are 0x0001 (invalid parameter number), 0x0002 (invalid sub-index), 0x000B (no operator access). The full list is in the "PROFIdrive Profile Drive Technology" specification and the Siemens FAQ on SINA_PARA error codes.
Why is the bit value always 0 even when the alarm is active in STARTER?
Usually the bit mask is wrong: the 16-bit parameter value sits in the upper 16 bits of the REAL storage on S7-1500 and must be extracted with SHR(REAL_TO_DWORD(srValue), 16) before the AND-mask is applied. Verify against r52 = 16#0001 → bit 0 must be TRUE.