Rick Calder wrote:
> No, neither.  I have made a few tachometers using Atmel microcontrollers.  The
> sensor, either a hall effect or optical, just sends pulses and the
> microcontroller counts them up and handles the display.  Another one I made 
> had
> counter chips and the microcontroller basically just handled the display part.
>
> I would like emc2 to do the counting and display.  It seems simple enough, I
> just haven't found anything in the docs that describes it.
>   
The EMC encoder HAL component has an option to count pulses from a 
single signal (as opposed to a standard encoder with two signals in 
quadrature).  The problem is that a low-res pulse (like once per rev) 
produces very few counts per servo cycle.  So, this will provide a very 
coarse speed indication.  You can then feed this through a low pass 
filter to smooth the output.  It may be the velocity estimation scheme 
with last pulse timestamps will help this greatly.

Add this line to your .ini file :

POSTGUI_HALFILE =            spindle.hal

The file spindle.hal should be in the same directory with the .ini file, and 
contain this line :
linksp SpindleRPM pyvcp.SpindleRPM

In your hal file, you should add something derived from this :

loadrt mult2 count=1
addf mult2.1            servo-thread
loadrt encoder num_chan=1
addf encoder.update-counters servo-thread
addf encoder.capture-position servo-thread

# spindle speed display
setp encoder.0.counter-mode 1
net sensor <your.digital-input.here> encoder.0.phase-A
net spinraw    encoder.0.velocity mult2.0.in0
setp   mult2.0.in1 185.185185            # (60/encoder count/rev)
newsig SpindleRPM float
linkps mult2.0.out => SpindleRPM

Then, the velocity output of the encoder module would feed the signal spinraw.
The constant 185.185.... is the conversion factor to convert pulses per 
millisecond to RPM
for my particular encoder.  In your case, if it is one pulse per rev, the 
factor would be just 60.0

Jon




------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to