john120
Banned
- Joined
- Aug 13, 2011
- Messages
- 257
- Helped
- 11
- Reputation
- 22
- Reaction score
- 10
- Trophy points
- 1,298
- Activity points
- 0
Can some body plz help me to modify the following codes for counting the frequency up to 2Mhz of a square wave and sine wave:
#include <16f877a.h>
#use delay(clock=20M)
#include <lcd420.c>
#include <LCD_D.h>
#fuses hs,nowdt,nocpd,nolvp,noprotect
#byte portc=0x07
#bit led=portc.4
void LCD_D();
unsigned int16 value;
void main()
{
set_tris_c(0x00);
led=1;
delay_ms(500);
LCD_D();
delay_ms(50);
while(1)
{
set_timer1(0);
setup_timer_1(t1_external | T1_DIV_BY_1);
delay_ms(1000); // in protues, should be 1000/3
setup_timer_1(T1_DISABLED);
value=get_timer1();
lcd_gotoxy(11,4);
printf(lcd_putc,"%LU HZ ",value);
led=!led;
}
}
I got those codes from http://www.pic-tronics.com/Frequency-Counter-Using-PIC16F877A.php
Thanks
#include <16f877a.h>
#use delay(clock=20M)
#include <lcd420.c>
#include <LCD_D.h>
#fuses hs,nowdt,nocpd,nolvp,noprotect
#byte portc=0x07
#bit led=portc.4
void LCD_D();
unsigned int16 value;
void main()
{
set_tris_c(0x00);
led=1;
delay_ms(500);
LCD_D();
delay_ms(50);
while(1)
{
set_timer1(0);
setup_timer_1(t1_external | T1_DIV_BY_1);
delay_ms(1000); // in protues, should be 1000/3
setup_timer_1(T1_DISABLED);
value=get_timer1();
lcd_gotoxy(11,4);
printf(lcd_putc,"%LU HZ ",value);
led=!led;
}
}
I got those codes from http://www.pic-tronics.com/Frequency-Counter-Using-PIC16F877A.php
Thanks