Here, I use this instruction to map the A/D converter digital value into the PWM duty cycle that it will adjust the speed of a DC motor. I create a piecewise linear table with three points on the graph A(x0,y0) B(x1,y1) and C(x2,y2).
A piecewise linear table that return a duty cycle value in term of the ADC0. |
- Reading the A/D converter value and converts it to the PWM duty cycle value via a piecewise linear table.
- Sending the current PWM duty cycle to the host PC via UART terminal
- Adjusting the motor speed via its PWM duty cycle.
The Ladder Diagram Program |
I selected PIC16F876 due a the ease of use.
Schematic Diagram |
Click here to download this ladder diagram example.
No comments:
Post a Comment