To get a 10kHz square wave, you need to have BASE_PERIOD 50000 or lower.
Then simply set up a pwmgen.
Here's a starting point for you. it may require tweaking.
# Create one PWM generator. place this line early in your hal file.
loadrt pwmgen output_type=0
# Do the computations for the PWM generator
# Place this line after all other 'addf .. servo-thread' lines in your hal
# file
addf pwmgen.0.update servo-thread
# Place this line before the 'addf ...parport-write base-thread'
# line in your hal file
addf pwmgen.0.make-pulses base-thread
# Configure for 50% duty cycle, 10kHz
setp pwmgen.0.value .5
setp pwmgen.0.pwm-freq 10000
# Hook the PWM waveform to the parport pin
net amp-enable-wave pwmgen.0.pwm => parport.0.pin-16-out
# Enable the PWM signal when emc calls for the X axis amplifier to
# be enabled
net amp-enable axis.0.amp-enable-out => pwmgen.0.enable
The actual duty cycle and frequency depend on your base-period, but emc
will make a best effort to give 10kHz and 50%.
Jeff
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users