Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
ezeio2:scriptref:pid_new [2020-08-14 23:39] – andreh | ezeio2:scriptref:pid_new [2022-03-30 23:44] (current) – andreh | ||
---|---|---|---|
Line 5: | Line 5: | ||
=== Description === | === Description === | ||
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | < | + | < |
=== Parameters === | === Parameters === | ||
- | | '' | + | | '' |
| '' | | '' | ||
| '' | | '' | ||
- | | '' | ||
| '' | | '' | ||
| '' | | '' | ||
Line 36: | Line 35: | ||
| | ||
{ | { | ||
- | // Initialize the PID with mid range input and no output | + | // Initialize the PID with target |
PID_new(p, 50.0, 0.0); | PID_new(p, 50.0, 0.0); | ||
| | ||
Line 55: | Line 54: | ||
| | ||
// Read and scale a sensor input (0-100psi from 4-20mA sensor) | // Read and scale a sensor input (0-100psi from 4-20mA sensor) | ||
- | psi = 100.0 * ((GetInputValue(1)-4000)/ | + | psi = 100.0 * ((GetInputValue(1, INVAL_RAW)-4000)/ |
| | ||
// Update the PID with the feedback value | // Update the PID with the feedback value |