sayf alawneh
Junior Member level 3
- Joined
- Aug 15, 2014
- Messages
- 27
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 256
guys i really need help my project is to make a frequency counter (frequency meter) can cout frequency up to 5Mhz using TMR1 or TMR0 i am lookig since 2 weeks in every where but still cant understand cause every body explain it different way than the other ,,,, i just need to know the maximum frequency i can count using both timers and whatt is the relation between the max frequency i can count and the crystal oscillator ?
also lot of guys told me to use TMR1 but why TMR1 and not TMR0 ??? i know TMR1 is 16 bit and TMR0 is 8 bits
for my project i used TMR1 and i really dont know why
as a test i used PWM from pic16f877a and sent the pWM pulse to T1CkI in another 16f877a
but the accuracy wasnt good !! for example a pwm of 15 k HZ was read 15252 HZ an error of 252 HZ ???
also i couldnt read more than 30Khz i couldnt get the needed range from 1 hz to 5Mhz !! also i need good accuracy is the problem in the code??? here is the counter code guys
and the PWm code is simple just to generate a pulse with 15Khz
guys am really a newbie please i need help i really need it please explain to me as a newbie
i only have 5 days to finish this project
also lot of guys told me to use TMR1 but why TMR1 and not TMR0 ??? i know TMR1 is 16 bit and TMR0 is 8 bits
for my project i used TMR1 and i really dont know why
as a test i used PWM from pic16f877a and sent the pWM pulse to T1CkI in another 16f877a
but the accuracy wasnt good !! for example a pwm of 15 k HZ was read 15252 HZ an error of 252 HZ ???
also i couldnt read more than 30Khz i couldnt get the needed range from 1 hz to 5Mhz !! also i need good accuracy is the problem in the code??? here is the counter code guys
Code dot - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 sbit LCD_RS at RB4_bit; sbit LCD_EN at RB5_bit; sbit LCD_D7 at RB0_bit; sbit LCD_D6 at RB1_bit; sbit LCD_D5 at RB2_bit; sbit LCD_D4 at RB3_bit;sbit LCD_RS_Direction at TRISB4_bit; sbit LCD_EN_Direction at TRISB5_bit; sbit LCD_D7_Direction at TRISB0_bit; sbit LCD_D6_Direction at TRISB1_bit; sbit LCD_D5_Direction at TRISB2_bit; sbit LCD_D4_Direction at TRISB3_bit; void main() { int c=0,i=0,n=0; char txt[5],txt1[5],*res;; lcd_init(); lcd_cmd(_LCD_CLEAR); lcd_cmd(_LCD_CURSOR_OFF); TRISC=1; TRISB=0; TRISD=0; PORTD= 0; TMR1L=0; TMR1H=0; LCD_OUT(1,1,"WORKING.."); delay_ms(500); lcd_out(1,1," WORKING."); delay_ms(500); lcd_out(1,1," WORKING "); T1CON= 0B00000011;delay_ms(1000); T1CON= 0B00000010; c= TMR1L; i= TMR1H * 256; n= c+i; IntToStr(n,txt); lcd_cmd(_LCD_CLEAR); delay_ms(100); lcd_out(1,1," FREQUENCY IS"); delay_ms(100);lcd_out(2,0,txt); lcd_out(2,7," Hz "); }
and the PWm code is simple just to generate a pulse with 15Khz
guys am really a newbie please i need help i really need it please explain to me as a newbie
i only have 5 days to finish this project
Last edited by a moderator: