Capture measurement data, collect, export as CSV – Best Practices

Hello everyone,

I would like to log 5 thermocouple values in real time, with a 2-second interval, repeated 10 times.
The logging should start on a rising edge (HMI button). After 10 samples, the data should be saved to a CSV file, and then the array should be reset for the next acquisition.

I’ve heard it’s better to use a cyclic interrupt OB (e.g. OB31) instead of timers in OB1 or TON.

So in short:

  1. Rising edge → start logging
  2. Every 2 s → capture 5 values → write to an array
  3. After 10 samples → stop, save to file, reset array

My question: What is the simplest way to implement this in TIA Portal (SCL or Ladder)?
Has anyone already built a similar program and could share an example or some guidance?

Thanks a lot!
 
Top