AW: The PIT timer sample in MCF52211

"Mark Butcher" <[email protected]> Wed, 26 Mar 2008 14:29:37 +0100
Newsgroups gmane.comp.hardware.motorola.microcontrollers.coldfire
Message-ID <000b01c88f45$702b7230$7400a8c0@mjblp004>
X-SpamDetect-Info: ------------- Start ASpam results ---------------
X-SpamDetect-Info: This message may be spam. This message BODY has been altered to show you the spam information 
X-SpamDetect: *****: 5.300000 From3consonants=0.3, Suspicious proportion of text in CAPS=1.0, Some html comments=1.0, Aspam=3.0
X-SpamDetect-Info: ------------- End ASpam results -----------------

Sanjay
 
Here is code for PIT0 (replacing registers for PIT1 should do the
trick).

// Routine to initialise the Real Time Tick interrupt
//
#define REQUIRED_MS ((1000/TICK_RESOLUTION))
// the TICK frequency we require in kHz
#if TICK_RESOLUTION > 4
  #if TICK_RESOLUTION > 64
    #define TICK_DIVIDE (((BUS_CLOCK/2/32768) +
REQUIRED_MS/2)/REQUIRED_MS) // the divide ratio required (32k prescaler
assumed)
    #define PIT_PRESCALE PIT_PRESCALE_32K
  #else
    #define TICK_DIVIDE (((BUS_CLOCK/2/4096) +
REQUIRED_MS/2)/REQUIRED_MS)  // the divide ratio required (4k prescaler
assumed)
    #define PIT_PRESCALE PIT_PRESCALE_4K
  #endif
#else
  #define TICK_DIVIDE (((BUS_CLOCK/2/1048) + REQUIRED_MS/2)/REQUIRED_MS)
// the divide ratio required (1k prescaler assumed)
  #define PIT_PRESCALE  PIT_PRESCALE_1K
#endif
 
 
/**************************** Real Time Clock interrupt
******************************************/
static __interrupt__ void _RealTimeInterrupt(void)
{
  PIT_PCSR_0 = (PIT_PRESCALE | PIT_DBG | PIT_OVW | PIT_PIF | PIT_RLD |
PIT_PIE | PIT_EN); // Reset interrupt request flag
  fnRtmkSystemTick();
// operating system tick
}
 
extern void fnStartTick(void)
{
    PIT_PCSR_0 = (PIT_PRESCALE | PIT_DBG | PIT_OVW | PIT_PIF | PIT_RLD);
// prepare for load
    PIT_PMR_0 = TICK_DIVIDE;
// load interval value
 
    fnSetIntHandler(PIT0_VECTOR, (unsigned char *)_RealTimeInterrupt);
 
    IC_ICR_0_55 = TICK_INTERRUPT_PRIORITY;
// define interrupt level and priority
    IC_IMRH_0 &= ~(PIT_0_PIF_INT_H);
// unmask interrupt source
    IC_IMRL_0 &= ~(MASK_ALL_INT);
// clear global mask {5}
 
    PIT_PCSR_0 = (PIT_PRESCALE | PIT_DBG | PIT_OVW | PIT_PIF | PIT_RLD |
PIT_PIE | PIT_EN); // start PIT with interrupt enabled
}
 
Regards
 
Mark
 
 
 
 
Mark Butcher Bsc (Hons) MPhil MIEE
 
M.J.Butcher Consulting                
Obere Bahnhofstr. 13,  CH-5507 Mellingen,
Switzerland          <http://www.mjbc.ch/> www.mjbc.ch /
<http://www.utasker.com/> www.uTasker.com
056 491 48 10 / 079 402 26 37 / Skype: M_J_Butcher
 <http://www.uTasker.com>  
 
 
-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]]
Im Auftrag von Sanjay Morab
Gesendet: Mittwoch, 26. März 2008 14:12
An: [email protected]
Cc: [email protected]
Betreff: [ColdFire] The PIT timer sample in MCF52211
 
Dear All
 
Can anyone has the PIT0 timer in interrupt mode for MCF52211 . I am not
able to get the imterrupt.
 
 
Regards
Sanjay Morab
[email protected] Send a post to the list.
[email protected] Join the list. [email protected]
Join the list in digest mode. [email protected] Leave the
list.