Update README.adoc

Document concept.
pull/29/head
Thomas A 2021-04-08 15:08:45 +02:00
rodzic 117c1232f2
commit f27cda6cf9
1 zmienionych plików z 24 dodań i 0 usunięć

Wyświetl plik

@ -3,6 +3,30 @@
Drive a servo motor by using two PIO statemachines for pulse output.
== Concept
Servo motors are controlled by a pulse with modulated signal.
Please see Wikipedia for details: https://en.wikipedia.org/wiki/Servo_control
The angle is encoded by the pulse length. The positive pulse length from 1ms to 2ms describes the movement from minimum to maximum.
This pulse has to be repeated every 20ms.
This pulseform is generated by two different PIO statemachines.
Statemachine 1, running the servo_trigger program generates the 20ms carrier signal.
It counts down for 20ms, then clears the IRQ, allowing the 2nd statemachine to run.
Statemachine 2, running servo_prog waits for the IRQ to be cleared.
The cleared IRQ marks the beginning of a 20ms cycle, which means, that the pulse needs to be output.
After this, the statemachine outputs a pulse of 1 to 2 milliseconds.
The duration of this pulse can be input from the FIFO.
If a value of 0 is pushed to the FIFO, the output pulse will have 1ms, which is the lowest movevement position of the servo.
Pushing a value of 1000 to the FIFO outputs a 2ms pulse, which moves the servo to the maximum position.
After the pulse has been output, Statemachine 2 waits for Statemachine 1 to clear the IRQ again, so the next pulse can be output.
== PIO Use
Each output needs a statemachine running servo_trigger and one running servo_prog.
Due to the IRQ assignments, the statemachines need to be in ordered to have the servo_trigger program first, e.g.: