Cruise
Motor Speed Hold Exercise
Task
A car's cruise control holds the speed the driver set, up hills and down them, whatever the car is carrying.
Hold the motor's shaft at 9,000 RPM for 300 ms, whatever load the rig puts on it, then print: DONE The motor's registers are in the Circuit figure.
Circuit
Pass condition
From 50 ms to the end of the run, the shaft stays within 300 RPM of 9,000 RPM. DONE comes once the 300 ms are up, and the motor never latches a fault.
Notes
The rig's load changes between runs and during a run, and can slow the shaft by up to 2,500 RPM. Duty is how hard the motor is driven, in thousandths of full power. The drive's tuning is a duty of 300, plus 1 for every 2 RPM the shaft runs below 9,000 RPM, or minus 1 for every 2 RPM above it, kept from 0 to 500. Set the duty at least once a millisecond.