Hi @pb632146.
To assist you more effectively, could you please clarify the specific functionality you need to accomplish? Are you looking for a delay function using the PIT, or are you trying to measure execution time?
If you need to implement a blocking delay with the PIT, I suggest to follow the structure shown in the image below. It was tested for a 1 second delay and it works as expected:

The PIT is configured to interrupt every millisecond which updates the "counter" variable. The PitDelay function starts the timer and continuously checks for the "counter" to reach the delay value. Once it does, the variable restarts, and the PIT is stopped.
If you need to measure execution time, you can update a counter variable each time the PIT gets into the interruption. This will provide an accurate estimation of the running time of your program.
Please let me know if this helps.
- RomanVR.
Best Regards!