PWM on PICAXE-08M

Craftybytes

Senior Member
Hi group,

Q1:
Using an 08M @ 8MHz - for pwm, what is the timer 'reference' period - 2.5uS or 5uS ?
If I needed a pwm out @ 1200Hz, 50% mark/space - how would one code the "PWMOUT" command for this?

Q2:
Is it possible in Picaxe BASIC code or by inserted Assembly code to set an interrupt on the -ve edge of the pwm pulse from the internal hardware pwm module (probably on timer overflow in pwm module) - thus to perform some program code during the 'space' portion of the total pwm period - WITHOUT stopping the pwm module from providing a continuous pwm o/p ?
 

hippy

Ex-Staff (retired)
Q1 : At 4MHz, the lowest PWMOUT frequency is 3906.25Hz, at 8MHz it is 7812.5Hz. You won't be able to get 1200Hz without dividing the PWM down using external hardware, or by running the 08M at a lower speed than 4MHz - although there may be something on the forum about poking the pre-scaler or other timer registers to achieve what you want.

Q2 : Assembler can't be inserted into a PICAXE program. There's no way to trigger an interrupt from the PWM timer, although you could possibly poll the register which has the bit in it from which the interrupt would derive. The problem there is that the PWMOUT space period is probably so short that you wouldn't be able to respond or execute any commands during that time frame.

Edited by - hippy on 7/19/2005 1:58:39 PM
 
Top