i am suppose to program a micro controller, and the program should have the number of rev of the rotating disc in a mechanical energy meter as one of its parameters.
can anyone tell me how to use a counter to count the number of rev?
I would use a Hall Effect,
tho ya could find more info on an Eng site, like EDU
a link to a very simply Application,
blast02.lns.mit.edu/targets/ion/manuals/Allegro_3503.pdf
Simple motor control link
http://www.simplemotor.com/hemotor.htm
My answer assumes you have little knowledge of programming a microcontroller. Your microcontroller has to have a scan time at least 3 times faster than the speed of revolution of the shaft, OR have a high-speed counter input. (At 600 RPM, you will have 0.1 second--100 milliseconds--for each revolution, so the scan time must be no longer than 30 milliseconds.) On a number of microcontrollers their first digital input is a high-speed one. Check the specifications.
Assuming you are not using the high-speed counter approach:
1. In the program you need a 1-shot (it will be "true" for only one program scan when the input from the sensor that sees that the shaft rotation input is "on". Almost all units have one in their instruction library, but if not, it can be programmed with two lines of instructions and two internal logical outputs---make the first line's output be "true" if the input is on and the second line's output is "false", and make the second line's output "true" if the input is on. That first line's output is your programmed 1-shot.
2. After these two lines of program you need the counter. If you have a counting instruction, it can be used. If not, you can use a math ADD instruction to add 1 to an integer address' value. Be careful, because when that address' value exceeds the maximum permitted by the microcontroller, you usually have an error condition which crashes and stops the unit. Therefore, you may also need a compare instruction to ensure that the maximum value is not exceeded.
3. Finally, whether you use a counter or an ADD instruction, you need a way to reset the count back to zero. Counters usually have a RESET instruction for this, but other means would be to MOVE a zero to the integer address, or CLEAR its value (to zero).
4. Also, you need a way to act on this counted value. If you are using a preset count, go for it. If you want an operator or other program to set the maximum count, there are a couple ways to do this--both use a compare instruction....
For greatest reliability, the suggestion of a hole in a rotating disk and a LED and photodetector is good, but probably a slot extending for about 180-degrees around the disk would be better because it will give a longer signal and work better at a higher shaft speed. Your input circuitry would all have to be DC, to avoid the limitation that an AC input signal cannot detect any counts faster than about 1/4 (or less) of the AC frequency.
number of rev <http://globalspec.ip09.com/rd/9z1zpbpuach0pu6telav9ipl70fagqp4k4cfcpr0cto> By gdallas2 in Electrical Engineering <http://globalspec.ip09.com/rd/9z1zce7s2vafis1fj8iilalq7e1a2ji2tbqcu358tug>
i am suppose to program a micro controller, and the program should have the number of rev of the rotating disc in a mechanical energy meter as one of its parameters. can anyone tell me how to use a counter to count the number of rev?
If by "mechanical energy meter" you mean something like the watt-hour meter found on many houses, then a retroreflective photoeye would probably work well to read the black line on the disc. You'd have to experiment a little, but at a certain distance, it is likely that it will ignore any small lines and only pickup the large line that these discs typically have.
These photoeyes are a combination of an led and a phototransistor in one package. A similar, but slightly different arrangement will read a notch or hole.
__________________
There is more to life than just eating mice.
hi allas thnx for the request but all i have to say is that there are some good ways of measurimg of number of revolutions of rotating objects. Here is one that may be of good help. All you have to have is a frequency out put. You can have that having a small gear (a tachometer is beter) that can send this out to an f/V converter to give you a signal in mV and then feed it to a V/I convertor to give you asignal in mA. you should also know the f/V conversion and the V/I out put.
An example is if the disc rotates at 3000 rev/min, knowing the f/V conversion of frequency into mV i.e V = 0.6f, V/I converter out put of 0.8 mA/m/V then you can get an output of 24 mA, which is the normally used signal I/O now days.