AnsweredAssumed Answered

Count between two inpulsion

Question asked by Pillot benjamin on Apr 20, 2006
Latest reply on Apr 20, 2006 by Pillot benjamin
Hello Friend,
 
 
I work on the MC9S12XDP512EVB and I work whith code warrior 4.1.
 
Now I want to count a time between two inpulsions but a i have 2 or 3 small problem or/and questions.
 
First Question
is It  possible not to use an interruption to manage the flags?  Or rather the microcontrollor can make it of him same ?
 
Me i don't use the interruption.
 
My Program:
 
#define TCTL_3 (*((char*)0x004A))
#define TCTL_4 (*((char*)0x004B))
#define LECTURE (*((short int*)0x0050))
#define TEMPS (*((short int*)0x3000))
 
//////////////////////////////////////////////////////////////////////////////////////////// 
void main(void) {
 
init_timer();  
   
 for(;:smileywink: {

 if ( TFLG1_C0F ) {
   TEMPS=LECTURE;
      }
}
//////////////////////////////////////////////////////////////////////////////////////////// 
 static void init_timer(void)  {
  
  TEMPS=0x0034;
  TIOS = 0xFE;
   TIE =0x00;
  TSCR2 =0x06;
   TCTL_3=0x00;
  TCTL_4=0x01;
  TSCR1=0xE8;
  
 } 
////////////////////////////////////////////////////////////////////////////////////////////// 
My program makes first of all an initialization of the module timer and after i wait an inpulsion on IOS0.
 
But the problem the microcontrollor don't put the flags at 0 and me i can't it too.
this fact my count don't restart and i don't take a good count between two inpulsion.
 
Now I turn to you for your assitance. I looking for of information and assistance on this programmme so that it realise the operation which I wish.
 
But if you have a other similar program of this you can take me please.
 
thank you for your assistance
 
 
PS: I'm sorry for my bad english
 
 
 

Outcomes