Mohamed Slama
Member level 4
Hi friends
I have designed a system to read frequency as follow :
when a coin passed through 2-coils that connected in oscillation circuit the frequency will
change according to the position of coin .
changing of frequency occurs every a bout 10 ms .
i want to read this values and put it in a vector , i have write the code but didnt work
correctly . this is the part of code that measure frequency and put into a vector
I have designed a system to read frequency as follow :
when a coin passed through 2-coils that connected in oscillation circuit the frequency will
change according to the position of coin .
changing of frequency occurs every a bout 10 ms .
i want to read this values and put it in a vector , i have write the code but didnt work
correctly . this is the part of code that measure frequency and put into a vector
Code:
for(;;)
{
if(flag==1) //if one second elapsed
{
tmr1_Val = (TMR1H << 8) + TMR1L; //get high and low from timer1
Freq = (OverNumb*65536) + tmr1_Val; //calculate frequency
s_vector[i]=Freq;
Delay_ms(12); // put values every 12 ms
i++ ;
if (i>5)
{
flag=0 ;
i=0;
}
}
else
{ // printing values on LCD to ensure that the values is put coorectly
for (i=0; i<6;i++)
{
intToStr(s_vector[i],txt5);
Lcd_Out(2,1,txt5);
delay_ms(100);
Lcd_Cmd(_LCD_CLEAR);
}
}