vinayak joshi

about Timer on s12xDP512

Discussion created by vinayak joshi on Nov 24, 2007
Latest reply on Nov 26, 2007 by kef
hi,
      I am working on s12xdp512 16 bit controller on codewarrioer 4,5 version. in my program i am using ECT timer as measuring a pulses in normal manner ie i am not using capture mode.just i wait for pulse and start timer and next pulse i get timer count from TCNT reg. my code like this
main()
{
 TSCR2=0x06; //  prescaler /32 3200 nsec
 TCNT=0;
 TSCR1_TEN=0;// timer off  
for(;:smileywink:
   {
              
             while(PTP_PTP1==0); // wait for pulse going to be rise
                if(TSCR1_TEN== 0) // timer off
                     {TSCR1_TEN=1;  }// timer on
                 else
                {
                      Timercount=TCNT;
                      TCNT=0;                          //reset timer count
                       PORTB_PB3=1;        // on LED
                      do
                      {
                       Check_Time=TCNT;
                      }
                      while(Check_Time<1562); // LED on till 5 msec count
                      PORTB_PB3=0;                   //off LED
                }
}        
 }                    
                    
 i am using 4 mhz   crystal and using PLL i make it 20 Mhz.
everthing is fine working in Debug mode ie i am running this program in debug mode LED on 5 mesc at every pulse . but when i am going to dump the .s19 file of this project on controller and after power on my controller the progrm not working.i am using demo board of softec HCS12S STARTER KIT.  kindly help me in this reguard.
                  but insted of main timer if i am using modulus counter above,the program works fine both in debug and normal running mode.
 
plz waiting for help
 
vinay
              

Outcomes