fernando_g
Senior Member
Here is an application where the PICAXE assists to implement an accurate counter.
Designers have long known that powerline frequencies in (most) developed countries maintain a long term accuracy that rivals and sometimes exceeds crystal oscillators.
Thus this is a suitable timebase for long term counters, like clocks, energy monitors and the like.
Precisely this snippet is used in a solar installation where an accurate assesment of total energy (KWhr) produced over a long period of time is a must.
The KWhr conversion has a resolution of 1 pulse per watt-hour, thus it will produce 10,000 pulses per hour at the project's maximum (10 KW) output.
The frequency comes out at 2.777 Hz maximum.
The primary counter is an old and proven 74LS93 binary counter. The PICAXE's role is to produce an accurate timebase derived from the powerline, read and reset the counter at prescribed intervals, and accumulate the results for further processing down the road.
The circuit and listing are simple and self explanatory.
Transistors Q1 and Q2 produce a clean 500 usec pulse for the PICAXE to count using an interrupt on input0. The keyword here is clean.
The role of transistor Q3 is to provide a blanking signal during the falling edge of the pulses to be counted. The 7493 increments its counts during falling edges, but since it is a ripple counter, its outputs may spike during certain transitions, yielding erroneous results. Thus during all falling edges, Q3 will produce a positive pulse that is verified by the PICAXE's PortC to determine wheter is safe or not to read QA thru QB.
The 7493 is reset after each read via output 1. The time interval between reads is defined by the constant timing_pulses which is the product of the powerline frequency and the time interval.
Designers have long known that powerline frequencies in (most) developed countries maintain a long term accuracy that rivals and sometimes exceeds crystal oscillators.
Thus this is a suitable timebase for long term counters, like clocks, energy monitors and the like.
Precisely this snippet is used in a solar installation where an accurate assesment of total energy (KWhr) produced over a long period of time is a must.
The KWhr conversion has a resolution of 1 pulse per watt-hour, thus it will produce 10,000 pulses per hour at the project's maximum (10 KW) output.
The frequency comes out at 2.777 Hz maximum.
The primary counter is an old and proven 74LS93 binary counter. The PICAXE's role is to produce an accurate timebase derived from the powerline, read and reset the counter at prescribed intervals, and accumulate the results for further processing down the road.
The circuit and listing are simple and self explanatory.
Transistors Q1 and Q2 produce a clean 500 usec pulse for the PICAXE to count using an interrupt on input0. The keyword here is clean.
The role of transistor Q3 is to provide a blanking signal during the falling edge of the pulses to be counted. The 7493 increments its counts during falling edges, but since it is a ripple counter, its outputs may spike during certain transitions, yielding erroneous results. Thus during all falling edges, Q3 will produce a positive pulse that is verified by the PICAXE's PortC to determine wheter is safe or not to read QA thru QB.
The 7493 is reset after each read via output 1. The time interval between reads is defined by the constant timing_pulses which is the product of the powerline frequency and the time interval.
Attachments
-
17.2 KB Views: 231
-
1.1 KB Views: 129