Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to Make a Simple frequency counter using pic16f877a

Status
Not open for further replies.

Dejanvkh

Newbie level 4
Joined
Jun 9, 2010
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
india
Activity points
1,335
hi all..
I'm newcomer to here, these days I'm studying about pic microcontroller programming and now I can make very simple circuits like led running and ect.. I'm using pic16f877a microcontroller. recently i have found a very interesting circuit in a site its a simple frequency counter based on my favorite MC, I hope to make it. but its seems a bit complecated for me<i think because I'm a beginner for MCs>,
this is the project that I going to develop >> https://sites.google.com/site/ehobbyprojects/make-a-simple-frequency-counter

please give me some advise regarding this project, It would be helpful for my success.. specially I'm expecting instruction about how I can make this without troubles. thank you very much...

sorry for my bad English writing..
 

Dejanvkh

Newbie level 4
Joined
Jun 9, 2010
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
india
Activity points
1,335
this one want to connect with computer, I want to a portable one.. i think its better to make the first one, I got the components for that.. if I got problems I'll post here for getting solutions.. thanks.. :D
 

dohi

Junior Member level 3
Joined
Aug 8, 2011
Messages
29
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,457
hi i need an information about frequency counter using pic16f877a >>>
uses ... application ... specific considerations ... and penfit on our life
i wanna try it
thanks...
 

john120

Banned
Joined
Aug 13, 2011
Messages
257
Helped
11
Reputation
22
Reaction score
10
Trophy points
1,298
Activity points
0
can you please help me to get the useful codes in ccs c compiler,I am counting the frequency from 500KHZ to 1.7Mhz;what I tried is not running;could you please help me:
see mine here:
#include <16F877A.H>
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT,NOLVP
#use delay(clock=12000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#include "lcd.c"
int32 isr_ccp_delta;


#int_ccp1

void ccp1_isr(void)
{
int32 current_ccp;
static int32 old_ccp = 0;
current_ccp = CCP_1; // From 16F877.H file
isr_ccp_delta = current_ccp - old_ccp;
old_ccp = current_ccp;

}
//=======================
void main()
{
int16 current_ccp_delta;
int32 frequency;

set_timer1(0);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_4);
//setup_timer_1(T1_EXTERNAL);

//setup_timer_1(T1_INTERNAL);
setup_ccp1(CCP_CAPTURE_RE);
clear_interrupt(INT_CCP1);
enable_interrupts(INT_CCP1);
enable_interrupts(GLOBAL);

lcd_init();
lcd_gotoxy(1,1);
disable_interrupts(GLOBAL);
current_ccp_delta = isr_ccp_delta;
enable_interrupts(GLOBAL);
while(1)
{
frequency = (int32)(16000000L / current_ccp_delta);
printf(lcd_putc,"\f%lu \n\r", frequency);
delay_ms(1000);

}

delay_ms(1000);
}

//}
 

john120

Banned
Joined
Aug 13, 2011
Messages
257
Helped
11
Reputation
22
Reaction score
10
Trophy points
1,298
Activity points
0
Thank you for your response,but the problem I have I do not know MicroC,can you plz help me with the codes in ccs c compiler or just correct mine posted above,so I can read real values.

Thanks
 

john120

Banned
Joined
Aug 13, 2011
Messages
257
Helped
11
Reputation
22
Reaction score
10
Trophy points
1,298
Activity points
0
Thanks for your response,I do not know how TOCKI can be programmed for measuring frequency?can you plz provide some explainaitions for me to get started?I used CCP1 in capture mode for measuring the time Timer1 counts elapsed from the first rising edge to the next rising edge so I convert this in frequency.
Tell me about TOCKI. plz


Thx
 

Joined
Dec 4, 2012
Messages
4,294
Helped
822
Reputation
1,654
Reaction score
793
Trophy points
1,393
Location
Bangalore, India
Activity points
0
I have posted the code in post #8. No mikroC library is used for frequency measurement using T0CKI pin in that project. Just try to understand that code. It is explained with comments. You can then implement it in CCS C. I will try to write that code in CCS C but I need one or two days time.
 

john120

Banned
Joined
Aug 13, 2011
Messages
257
Helped
11
Reputation
22
Reaction score
10
Trophy points
1,298
Activity points
0
Just what I want to do is to make a moisture meter using the square wave oscillator When I load the grain the frequency changes,I want to read that frequency and convert it in RH of the grain;can you help me to know the relationship between frequency and RH?

But as you see the first thing is to read the freq

Thanks
 

JackSanji

Newbie level 4
Joined
Jul 20, 2012
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,316
Just what I want to do is to make a moisture meter using the square wave oscillator When I load the grain the frequency changes,I want to read that frequency and convert it in RH of the grain;can you help me to know the relationship between frequency and RH?

But as you see the first thing is to read the freq

Thanks

you can try one of examples from CCS with directory "C:\Program Files\PICC\Examples\EX_FREQC.C", this example using delay
 

Attachments

  • EX_FREQC.zip
    1.6 KB · Views: 23

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top