greencardigan
Senior Member
Hi,
I have some code which reads some i2c chips, does a few calcs and sends some serial data to a PC. The i2c reads and calcs could take up to 500ms. This runs in a 1 second loop controlled by the timer variable. I'm not using interupts, just waiting until timer increments before looping.
Now I want to be able to output some slow PWM at 1 Hz with the duty able to range from 0 to 100%. The 500ms of i2c reads, calcs and serial out need to keep happening at regular 1 second intervals.
What are my options?
Use timer3 to control the main 1 second loop and timer with interrupts to do the pwm? Can timer3 be used to give me 1 second loops?
Using a second picaxe to do the 1 Hz PWM with the main picaxe sending the required duty value by serial?
Any better options?
I have some code which reads some i2c chips, does a few calcs and sends some serial data to a PC. The i2c reads and calcs could take up to 500ms. This runs in a 1 second loop controlled by the timer variable. I'm not using interupts, just waiting until timer increments before looping.
Now I want to be able to output some slow PWM at 1 Hz with the duty able to range from 0 to 100%. The 500ms of i2c reads, calcs and serial out need to keep happening at regular 1 second intervals.
What are my options?
Use timer3 to control the main 1 second loop and timer with interrupts to do the pwm? Can timer3 be used to give me 1 second loops?
Using a second picaxe to do the 1 Hz PWM with the main picaxe sending the required duty value by serial?
Any better options?