I'm not the most experienced programmer, and I have some problems trying to program my PIC to use PWM to control some motors.
The PIC18F4431 is a powerull PIC specially designed for motor control, it has four PWM duty cycle registers and eight PWM pins.
The peripheral I'm using is the PCPWM (Power Control PWM).
But I just can't seem to find how to initialize this peripheral!
I would be very thankfull for a short summarization of what registers I have to program, and in what order. C code or assembly are also fine.
Also I'm not sure what to put in most of them.
This is my goal:
I want PWM0,2,5 and 6 to be independantly controllable PWM pins.
The period can be the same for all, but the duty cycle has to be modifyable in my code.
I more or less have these filled in:
but which ones do I also have to program? How do I program the period? the duty cycle?
And how does PWM "work" in code? Does it interrupt every period? Or what?
All I want is a peripheral outputting these four PWM signals, and I can change the duty cycle in my code.