Have a look to following pages:
https://en.wikipedia.org/wiki/PID_controller#PID_controller_theoryhttps://de.mathworks.com/help/control/ref/pid.html?requestedDomain=www.mathworks.com#responsive_offcanvas.It may help to understand PID and the dependency of sample time for a PID algorithm tranformed out of a continous time system into a discrete time system (using Laplace- and Z-transformation).
In discrete systems you normally run the PID algorithm/function after each measurement (measure time = PID loop time = sample time). To call the PID more often does not make sense, just waste performance.
If you want to run the PID slower (less often) than after each measurement, the easiest method is, just to skip a number (n) of measurements (to be still syncronous with sampling and to keep the PID calculation simple).
If you like to create a flexible system that is a flexible sample time system (or better more or less skipped measurments).
Lets say, you measure a value every 1ms (1 ms measurement time), but you run the PID just every 10ms (you skip 9 times the PID) your PID sample time is = 10ms.
In that case you have to adopt the time correcting factors in dependency of that "PID" sample time.
So easiest way is to define the system based on the shortest/fastest sample time and just use correcting factors if you use run the PID less often (slower).
For example:
You define KP, KI and KD based on Ti = Td = 1 second, and the fastest sample time of 1 ms.
Then the PID adopting factors is easy to calculate:
at a PID loop time of
1ms => 1000 and 1/1000
10ms = 100 and 1/100...
100ms = 10 and 1/10...
/PeLuLe