Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

ATMEGA 128 and TIMER3, TIMER4, INT3, INT4,

 
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
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 1161
Location: France

france.gif
PostPosted: Fri Nov 26, 2004 10:20 am    Post subject: ATMEGA 128 and TIMER3, TIMER4, INT3, INT4, Reply with quote

hi everybody,

just a question, it seems these interruption are not supported yet do some guy know a solution to use them ?


thanks for your help

JP

_________________
pleasure to learn, to teach, to create
Back to top
View user's profile Visit poster's website
sonero

Bascom Member



Joined: 01 Nov 2004
Posts: 28

PostPosted: Fri Nov 26, 2004 3:00 pm    Post subject: Reply with quote

Hi,


This is also for Timer2 with M8/16 the same. Then you have to look at the datasheet how to set the timers and the interrupts.
This should work with a mixture of manual settings and bascom.

For example the Timer2:

Config Timer2...blabla doesn't work, you have to set TCCR2 manually (prescaler, PWM settings and so on).
On Timer2 ... works
Compare2 is unknown, you have to use "on Oc2 isr"
The same for enable/disable.
To set the value for the output compare match you have to use the register ocr2. ocr2 = blabla
One tricky thing: "Stop Timer2" works, but "Start Timer2" doesn't!!!
Just write the settings to TCCR2 again to start the timer again.
The timer runs if there is a valid prescaler written to the 4 LSB of TCCR2. If it's zero, the timer is stopped. This is supported by Bascom, but not to start it again (write the first defined prescaler again to the register).

This is only an example but like this you should get everything working like this.
Look at the datasheet for the settings of the registers and at the def-file for the names of the interrupts.

Make a simple test program to check the functions you want to use.
The compiler complains, if you use an unknown interrupt, but "Start Timer2" is accepted, even if it does nothing in fact, it simply doesn't restart the timer.
Test it in hardware, the simulator you can forget for this.

Good luck, tell us how it works.

Best regards,
Norbert
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