Sten Martin
New Member
Hi,
I need help and have newer used PICAEXE before. I have questions about the pwmout, toggle and pausus commands.
I have four coils I have to pulse and switch at 7 kHz (period= 143 micro seconds).
Duty cycle 50%.
Each of the four coils must be switched on and off in a certain order as shown below.
Step Coil 1 Coil 2 Coil 3 Coil 4
___________________________________
1 1 0 0 1
2 0 1 1 0
1 1 0 0 1
If we look at the table, we notice that Coil 2 and Coil 3 is always the opposite (or logical NOT) of coil 1 & 4.
Questions
1. Is it possible to cut down the number of micro controller pins required to just two by the use of two additional NOT gates.
2. What command is best suited for the application, pwmout or toggle?
pwmount
(The coils are pulsed with opposite polarities)
Main: pwmout B.7, 142, 286 ‘ PWM output on pin B.7 = coil 1
pwmout B.6, 142, 286 ‘ PWM output on pin B.6 = coil 3
(Use Not gates: to coil 2 & 4 - opposite pulse polarity but from same clock)?
Or
toggle
Main: toggle 1, 4 ‘ Toggle pin 1, 4 = coils 1,4
pauseus 7 ‘ Wait 70 micro sec
toggle 1, 4 ‘ Toggle pin 1,4 = coils 1,4
pause 7 ‘ Wait 70 micro sec
goto Main ‘ Loop
(Use Not gates: to coil 2 & 4 - opposite on/of polarity)?
The driver need to be able to drive 3-4 Amps through the coils.
Note: the stability of the frequency is very critical to function and can not be allowed to drift. The pulse rise time has to be < = to 10 micro seconds.
I need help and have newer used PICAEXE before. I have questions about the pwmout, toggle and pausus commands.
I have four coils I have to pulse and switch at 7 kHz (period= 143 micro seconds).
Duty cycle 50%.
Each of the four coils must be switched on and off in a certain order as shown below.
Step Coil 1 Coil 2 Coil 3 Coil 4
___________________________________
1 1 0 0 1
2 0 1 1 0
1 1 0 0 1
If we look at the table, we notice that Coil 2 and Coil 3 is always the opposite (or logical NOT) of coil 1 & 4.
Questions
1. Is it possible to cut down the number of micro controller pins required to just two by the use of two additional NOT gates.
2. What command is best suited for the application, pwmout or toggle?
pwmount
(The coils are pulsed with opposite polarities)
Main: pwmout B.7, 142, 286 ‘ PWM output on pin B.7 = coil 1
pwmout B.6, 142, 286 ‘ PWM output on pin B.6 = coil 3
(Use Not gates: to coil 2 & 4 - opposite pulse polarity but from same clock)?
Or
toggle
Main: toggle 1, 4 ‘ Toggle pin 1, 4 = coils 1,4
pauseus 7 ‘ Wait 70 micro sec
toggle 1, 4 ‘ Toggle pin 1,4 = coils 1,4
pause 7 ‘ Wait 70 micro sec
goto Main ‘ Loop
(Use Not gates: to coil 2 & 4 - opposite on/of polarity)?
The driver need to be able to drive 3-4 Amps through the coils.
Note: the stability of the frequency is very critical to function and can not be allowed to drift. The pulse rise time has to be < = to 10 micro seconds.