6/7/2025 10:11 PM | |
Joined: 7/5/2021 Last visit: 9/2/2025 Posts: 220 Rating:
|
I have given it a quick try on a S7-1212 G2, just out of curiosity. The PLC does not even notice the code being there: I have a 10000us cyclic interrupt that does the sampling conditionally:
in a fb I do the init and calculate the average
I was tempted to do it entirely in a FB, but 10 ms of sampling is a little too quick to achieve reliably in main. To do the full averaging of 12000 samples it the program cycle increases by ~5ms. My code has somewhere an off-by-one mistake, instead of averaging 9600 values it does 9601, but close enough... the project is attached, you cane rename it to zap20 and open directly in TIA AttachmentProject1_20250607_2358.zip (215 Downloads) |
Last edited by: alanTI at: 06/07/2025 22:20:47Last edited by: alanTI at: 06/07/2025 22:21:44 |
|
This contribution was helpful to
1 thankful Users |
Follow us on