Capture module in code warrior 8

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Capture module in code warrior 8

1,563 Views
rickross
Contributor I

Hi everyone. Here's my problem. I have zero crossing detector circuit that sends a 50Hz PWM to my timer D capture module (DSP56f807). I am using the timer1 pin as the input pin. I want to detect this PWM on the rising edge and this will start a timer. On the second rising edge the timer must stop. I want to retrieve this value and use it to determine the period of the signal. I used the following code in my interrupt service routine to do this:

void Cap1_OnCapture(void)
{
  /* Write your code here ... */
if(u==2)
{
Cap1_DisableEvent();
/
Cap1_GetCaptureValue(&SAMPLES_Current[t]);

if(t==MAXSAMPLES)
{
for(p=20;p<40;p++)   
printf("ms - %u\n" , SAMPLES_Current[p]);
}
   

u=0;   
if(t<MAXSAMPLES)
t++;
else
t==0;
Cap1_Reset();

}




else u++;

}

I just used the printf to test if it was capturing the time. My problem is the value it reads isn't constant even though the input PWM is constant. Please help!!!! I have included my code.

 

eaw_code.zip

Message Edited by t.dowe on 2009-10-15 05:59 PM
Labels (1)
Tags (1)
0 Kudos
1 Reply

309 Views
trytohelp
NXP Employee
NXP Employee
Hello,
 

I suggest you to log your request to the Freescale CRM system.
Can I suggest you to have a look to your request via the web access ?
Please use Freescale on line support web page.
  - Go to following URL: http://www.freescale.com/TechSupport
  - Click on Submit a Service Request to create a new one or Manage Existing Service Request.
  - You will come to a login page.
  - You can submit your request through the web from there or view the activities of a SR.
Please provide us more details about the Tool version used.
To do that you must:
* CW:
Start the IDE and click on Help | About Metrowerks CodeWarrior.
Click on Installed Products 
Provide us all info displayed.
Or you can save them in a txt file.
Can you please provide us your example reproducing the issue ?
 
Pascal
0 Kudos