Dear Sir,
We are using TM4c129xCZAD design.
In our project we use external interuupt handler to sense -ve edge trigger pulses for frequency 60 KHZ.
The above fast frequency pulse are input to the controller two diffrent pin.
We have compare two 60kHZ pulses and calculate the % error through timer and getting % error =0. Its working fine
Now the frequency got change to 200 Khz and when we compare these we get %errror=0.00009 or 0.00019
Is it issue with such high frequency because when we checked with 100KHZ then also it is working fine.
We checked voltage level and amplitude that also OK.
Kindly suggest
ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
void External_pulseIntHandler(void)
{
MAP_GPIOIntClear(GPIO_PORTM_BASE, GPIO_PIN_6);
pulse_count++;
if(pulse_count==1000)
{
Edge_count++;
C_Edge_count++;
pulse_count=0;
}
if(timer_start_flag==0)
{
MAP_TimerIntClear(TIMER6_BASE, TIMER_CAPB_MATCH); // Clear the timer interrupt.
Timer6_start();
timer_start_flag=1;
Edge_count=0;
C_Edge_count=0;
pulse_count=0; //New added after observation
}
if((Edge_count!=0)&&((Edge_count)==master_meter_pulse)&&(Edge_mode_flag==0)&&(timer_start_flag))
{
MAP_TimerDisable(TIMER6_BASE, TIMER_B); //Disable Timer2
N_Actual = fout_intCount*0xffff + 65535 - MAP_TimerValueGet(TIMER6_BASE, TIMER_B); // counter fout pulses at the end of sacnner pulses
display_flag=1;
Flag.N_Actual_Ready=1; //Received all scanner pulses
Edge_count=0;
C_Edge_count=0;
pulse_count=0; //New added after observation
timer_start_flag=0;
zero_flag=1;
Flag.Pulse_Received = 0;
}
void Timer6_start(void)
{
MAP_TimerLoadSet(TIMER6_BASE, TIMER_B, 0xffff);
MAP_TimerMatchSet(TIMER6_BASE, TIMER_B, 0x0000);
MAP_TimerEnable(TIMER6_BASE, TIMER_B); //Enable fout counter
MAP_IntEnable(INT_TIMER6B);
fout_intCount=0;
}
N_Must is fixed value
error_calc = (((N_Must - N_Actual)/N_Actual) * 100)