Forum - MCS Electronics
View previous topic :: View next topic
Author
Message
georgestheking Joined: 06 May 2005 Posts: 134
Posted: Sun Jun 19, 2016 12:56 pm Post subject: XMEGA INT for Dummies
Hi,
I have an XMEGA 128B3 running at 32 Mhz.
How can I generate an Timer INTeRRUPT every milliseconde ?
Thanks for alll
Georges
(BASCOM-AVR version : 2.0.7.8 )
Back to top
Tiny Joined: 10 Nov 2010 Posts: 101 Location: The Netherlands
Posted: Sun Jun 19, 2016 3:13 pm Post subject:
this cod evil generate every 1mSec a interrupt
Code:
Config_tc0:
Config Tcc0 = Normal , Prescale = 128
Tcc0_per = 250 '32MHz/128 = 0.000004 * 250 --> 1mSecOne Tick
On Tcc0_ovf Tc0_isr 'Setup overflow interrupt of Timer/Counter C0 and
Enable Tcc0_ovf , Lo 'Enable overflow interrupt in LOW Priority
Config_priority:
Config Priority = Static , Vector = Application , Lo = Enabled , Med = Enabled 'Enable Lo Level Interrupts
Start_intterupts:
Enable Interrupts
main:
do
loop
'*******************************************************************************
' Timer 0 isr routine
'*******************************************************************************
Tc0_isr:
' do something
return
Tiny
Back to top
georgestheking Joined: 06 May 2005 Posts: 134
Posted: Sun Jun 19, 2016 5:24 pm Post subject: Timer
Hi,
I change prescale to 256 and PER to 125 and it work nicely.
Many thanks,
Best regards
Georges
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