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.

code for counting pulses from zero crossing detector

Status
Not open for further replies.

sjjm

Junior Member level 1
Joined
Apr 17, 2006
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,410
looking for a code for accepting and counting the pulses from a zero crossing detector using a pic 16f872
 

Any zero crossing detector generates pulses at the output I belive.

If so the output will be connected to a timer input or external interrupt pin of the micro.

If it is connected to timer input you have run in capture mode to count the number of pulses. Here timer register is loaded with the time base, the cap register will have the count of pulses in that time which can be read in over flow interrupt.


If it is connected to external interrupt, you have to run a timer for certain time period say 1 sec, and in external interrupt you can increment the count of the pulses. In the timer over flow interrupt the count is the number of pulses in 1 sec.

Am I correct :!::!::!:

Cheers
idlebrain
 

Hi,

If you are talking about power line zero crossing, then have a look at microchip application note AN958, you will find the answer there.

Good luck.
 

Hmmmm, you are rounding on the same point. The most important thing here is using external interrupt pin for this purpose, either postive edge or negative edge.
When the square pulses pulsed on that pin, it makes interrupt then you can count each interrupt action which is equal to one pulse.
I suggest you to use CCS from www.ccsinfo.com

Good luck in your project ya sa7

Hani
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top