S7: Timer/Counter numbering and BCD decode need a real S7-300/400 CPU #616
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
python-snap7 resolves TM/CT as bit addresses, so TM/CT decode at a non-zero device number is unproven (test +
S7_TIMER_NUMBER_ADDRESSING=1ready). Classic C-area counters are BCD but S7.Net returns the raw word.Sources: docs/drivers/S7.md:140-145; S7Driver.cs:1349-1351; docs/plans/2026-08-17-perf-followups-r3.md.
Filed 2026-10-08 by the pending/deferred-work sweep after the #562–#591 issue sweep.
From #632: driver-gaps item #303 (S7 PLC password / protection) is tracked here.
Evaluated adalbertuschris/PLC_Sim as a substitute for a real CPU (2026-10-11) — not usable.
Reviewed its S7comm handler (
Packets/S7PacketGenerator.cs):More fundamentally, any community emulator would only echo our own assumptions about T/C numbering and BCD — the same problem we already have with python-snap7 — so it cannot close this issue.
Viable paths:
S7_TIMER_NUMBER_ADDRESSING=1) and a BCD counter check could run against it. Requires a Windows box with a STEP 7/TIA licence.Read-only source review found a readiness problem in the real-CPU Timer/Counter gate: C7 expects raw 31337, unsuitable as a meaningful classic SIMATIC count (documented range 0..999). Siemens documents binary L/CV and distinct BCD LC/CV_BCD representations; that does not establish the S7comm C-area wire representation. Keep the current decoder and this issue open pending independent raw response plus PLC-side binary/BCD reference evidence. Do not select wire decoding solely from CPU family. Suggested next slice is fixture/documentation readiness using a valid count and explicit unresolved wire evidence, with no driver behavior change. No hardware probe or test change performed.
Primary references: https://docs.tia.siemens.cloud/r/en-us/v21/stl-s7-300-s7-400/stl-mnemonic-s7-300-s7-400/counter-operations-s7-300-s7-400/l-load-counter-s7-300-s7-400 and https://docs.tia.siemens.cloud/r/en-us/v21/lad-s7-300-s7-400/counter-operations-s7-300-s7-400/simatic-counters-s7-300-s7-400/s_cd-assign-parameters-and-count-down-s7-300-s7-400?contentId=reR_xapFX_Ike2opHIvfzg