Continue to Site

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 calculate frequency (40-60 Hz) of incoming signal using PIC16F877A

Status
Not open for further replies.

Kkrishn

Newbie level 1
Newbie level 1
Joined
Jul 14, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
9
hello everyone!

I am trying to find the frequency of incoming signal ( lab power supply properly transformed to small value) to my PIC. I used Zero Cross Detection ckt in such a way that at every zero cross detected point I get high pulse and low pulse elsewhere.

Can anyone provide me required c code for such operation. I am using proteus 7.7sp2 and hi-tech pic compiler in mplab 8.9 IDE, but I am unable to build my c program to hex. I am using Timer1 as counter.

kindly guide me through this. any other ideas of help content is highly appreciable.
thanks in advance. :)
 

I made measurements like this, the easiest way to do this is this:
• set up an interrupt to occur each 10 ms, count 100 of these, then set a flag (this will be set once every second)
• enable external interrupt and increment a variable each time the interrupt occurs (your zero cross waveshaper gave a pulse)

in your mainloop poll that second-counter flag bit, and when it's set, look at the variable you increment in the external interrupt service routine. That will give you the frequency.
Then, reset the flag bit, and reset the counter variable as well to prepare a new measurement.
I hope this makes sense, if you need any more help, ask.

pityu
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top