View previous topic :: View next topic |
Author |
Message |
seravitae
Joined: 10 Feb 2009 Posts: 7
|
Posted: Tue Feb 10, 2009 12:15 pm Post subject: OC1A/OC1B triggers, OC0 and OC2 do not?? |
|
|
Hi there,
I am trying to get PWM going on all 4 channels, using TIMER0, TIMER1 and TIMER2. TIMER0 and TIMER2 have one 'channel' each, whereas TIMER1 has 2.
I am trying to interrupt the pwm inside my code.
watching in simulator, the following code works *Only* for overflow interrupt, never for OC1A, OC1B, OC0, OC2... even though the button is enabled and i click it, it never jumps to the interrupt routine.
---------------------------------------------------------------------------
Enable Timer1
Config Timer1 = Pwm , Prescale = 64 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up
Enable Interrupts
On Oc1a Blah
On Ovf1 Blah
Mainloop:
nop
nop
Goto Mainloop
Blah:
nop
nop
Return
-------------------------------------------------------------
Since im using LEDs i dont mind if bascom can't interrupt and jump to routine, as long as the pin state is masked across the four pins as normal and the leds light up. However using this OC1A,OC1B leds are working fine, but likewise the leds on OC0 and OC2 pins do nothing)...
Any ideas what im doing wrong? Am i meant to be setting OCR0 and OCR2 or TCNT0/TCNT2....for the pwm value?
Any assistance is greatly appreciated! |
|
Back to top |
|
|
Evert :-)
Joined: 18 Feb 2005 Posts: 2156
|
|
Back to top |
|
|
seravitae
Joined: 10 Feb 2009 Posts: 7
|
Posted: Tue Feb 10, 2009 12:50 pm Post subject: |
|
|
1.11.9.0 bascom version
1.11.9.0.001 bascom compiler version
the chip is a Mega16, using an STK500 for ISP.
cheers |
|
Back to top |
|
|
seravitae
Joined: 10 Feb 2009 Posts: 7
|
Posted: Tue Feb 10, 2009 3:09 pm Post subject: |
|
|
Okay, i fixed it.. It seems i had a subtle but critical misunderstanding of the help file.
I had enable interrupts assuming that would enable all interrupts. Not enable interrupts flag allowing interrupts to be enabled.
Thus, i needed to go:
Enable interrupts
enable OC0
enable OC2
to get the desired interrupts working.
cheers! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|