Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

OC1A/OC1B triggers, OC0 and OC2 do not??

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
seravitae

Bascom Member



Joined: 10 Feb 2009
Posts: 7

blank.gif
PostPosted: Tue Feb 10, 2009 12:15 pm    Post subject: OC1A/OC1B triggers, OC0 and OC2 do not?? Reply with quote

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
View user's profile
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2165

netherlands.gif
PostPosted: Tue Feb 10, 2009 12:21 pm    Post subject: Reply with quote

What type AVR do you use? with which compiler version.
_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
seravitae

Bascom Member



Joined: 10 Feb 2009
Posts: 7

blank.gif
PostPosted: Tue Feb 10, 2009 12:50 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile
seravitae

Bascom Member



Joined: 10 Feb 2009
Posts: 7

blank.gif
PostPosted: Tue Feb 10, 2009 3:09 pm    Post subject: Reply with quote

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
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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