Internet PLC Forum
General => Technical support => Topic started by: ccdubs on May 03, 2007, 02:25:13 PM
-
Hi,
Thanks for the answer yesterday. I have a new query. What is the best way to generate a 1 kHz square wave output (PWM, stepper controller, internal clock)? This signal needs a 50% duty.
I am also wanting to turn the 1kHz output off and on every 500ms so that I can feed a repetative beep to a speaker.
Thanks for the help.
-
It depends on how accurate you need the 1KHz pulse. The PWM output can produce very accurate pulses but there is no 1KHz frequency. You can generate 2KHz PWM pulses and use a frequency divider IC to divider it by two.
If high accuracy is not so important You can use the STEPSPEED function and STEPMOVE to generate the pulses. The max pps is not meant to be very accurate but can vary the number of acceleration steps and the pps parameterto experimentally obtain a 1KHz pulse train.
-
Thanks for the reply.
I would prefer to avoid external circuitry if possible.
What sort of accuracy are you talking about with regards to the stepper motor? It sounds like trial and error may be needed.
Is there no way to do this using the internal clock and for statments?
Another option I have used with PWM and PICAXE micros is changing the clock speed which therefor changes the base frequencies. Is this possible?
-
Another obstacle with the stepper motor is the duty cycle of the pulse. Is the pulse set for 50% duty cycle?
-
Yes, stepper motor pulses are setup for 50% duty cycle.