How can I use timer capture with processor expert in a 56F8006 to measure a 20-30 Hz input?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How can I use timer capture with processor expert in a 56F8006 to measure a 20-30 Hz input?

1,916件の閲覧回数
lancefisher
Contributor III

I need to set up a 56F8006 timer capture for periods up to 600ms while running at the maximum clock speed.  It looks like I could either cascade Timer 0 and 1 but I haven't found a way to implement a capture function on a cascaded timer pair using Processor Expert.  Alternatively I ought to be able to set Timer0 up as a 10us clock source for Timer1 and just capture Timer1 but again there doesn't appear to be any way to do this with PE.  Can someone explain how to make either option work?

ラベル(1)
タグ(3)
0 件の賞賛
返信
7 返答(返信)

1,249件の閲覧回数
johnlwinters
NXP Employee
NXP Employee

Processor Expert components (a.k.a. "beans") are designed to quickly implement the most common use cases, and to provide starting points for your customization.

There are also the Processor Expert components designed to initialize the device.  These allow more choices in the configuration while still offering the GUI interface.

Together with the PESL (enabled in the left window), these allow practically any possible use case.

In this case, start by using the "peripheral intiialzation" components for the timer, then add teh PESL functions as required to control it in real time.


1,249件の閲覧回数
lancefisher
Contributor III

Thanks, that's the approach I'm currently implementing.  This is the first time I've had to go beyond the high level PE "beans" to use a peripheral in what I expected to be a common application (i.e. measuring a period longer than 65,000 times the bus clock).

0 件の賞賛
返信

1,249件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,Iance,

You can use the Peripheral Initialization beans as John said. But there is a dedicated capture beans in PE, I think you can use it directly. For CodeWarrior for DSP56800E ver8.3 tools, In the "Components Library" menu, pls click "Categories", then Pls click "CPU Internal Peripherals"->"Measurement"->"Capture", it is okay.

BR

XiangJun Rong

0 件の賞賛
返信

1,249件の閲覧回数
lancefisher
Contributor III

I had started with the capture bean but couldn't see how to set up a 32 bit capture.  I eventually figured out that this is accomplished by setting the "Capture Device" to "TMR01_Capture".  

0 件の賞賛
返信

1,249件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Iance,

as you know, the quadTimer is 16 bits timer, if you use 32 bit capture, you have to use cascaded counter mode, in the mode, one timer counts the tick, when the counter reaches up to Compare register value, a pulse will output. Another timer only counts the pulse with cascaded mode, when a capture happens, both of the timer counter value will be copied to capture register, you can read the capture register to compute the duty cycle or period.

it is okay to use TMR01_Capture, it works as I said above.

Hope it can help you

BR

XiangJun Rong

0 件の賞賛
返信

1,249件の閲覧回数
kdn
Contributor III

Hello  I am also working on same project with MC9S12XHZ512, My problem is that I am not getting interrupt In Input capture mode. I posted my code below. Is there any problem with timer or input capture mode setting ?

#pragma CODE_SEG __NEAR_SEG NON_BANKED

interrupt void  IC0_ISR(void)

  //  new_capture = TC0;   //save the value of input capture register

 

 

    LCD_Cmd(0x80);

              PORTA = 0xFF;

      

         t[i]=TC0;

      

          i++;

      

          if(i==2) {

          i=0;

       

       //    6.0742270546073012209196379760675e-8

      

         time_interval=(t[1]-t[0]);

         time_period=(float)(0.0000256* time_interval);

         frequency= 1/time_period;

   

      

    

         sprintf(buffer,"%f",frequency);

         for(j=0;j<4;j++)

         {

         LCD_Data(buffer[j]);

         }

 

}

   TFLG1 = 0x01;       //clear interrupt flag

}

interrupt void  TOI_ISR(void)

{

 

    TFLG2 = 0x80;       //clear interrupt flag

}

unsigned int TM;

/* User includes (#include below this line is not maintained by Processor Expert) */

void main(void)

{

  /* Write your local variable definition here */

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/

  PE_low_level_init();

  /*** End of Processor Expert internal initialization.                    ***/

  /* Write your code here */

        LCDIni();

//   LCD_Cmd(0x01);

   LCD_Cmd(0x80);

   LCD_Data('T');

    PPST_PPST0 = 0;  //set pull-up

    PERT_PERT0 = 1;  //enable pull-up 

   TSCR1 = 0xE7;       //enable timer, stop timer during wait and freeze, disable fast flag clear

   TIOS_IOS0 = 0;      //channel 0 as an input capture

    TCTL4 = 0x01;       //capture on rising edge

    TIE_C0I = 0x01;        //enable interrupt on channel 1 

    TSCR2 = 0x80;       //timer overflow interrupt enable, timer prescaler is 0

  for(;;){}

  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/

  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/

} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/

0 件の賞賛
返信

1,249件の閲覧回数
johnlwinters
NXP Employee
NXP Employee

Hi,

To get the right people looking at this, please select another forum for the S12 questions; perhaps an automotive group, or the Technical Information Center.

We addressed your DSC question, but are not here best suited for your S12 questions. Thank you for your forbearance.

Best Regards,

John L. Winters

Senior Applications Engineer

AMR/EU MCU & MPU AE Group

Freescale Semiconductor Inc.

2100 E. Elliot Road, Tempe, Arizona 85283

This e-mail and any associated attachments have been classified as:

Freescale Semiconductor Confidential and Proprietary

0 件の賞賛
返信