Author Topic: 1kHz Square Wave  (Read 14036 times)

ccdubs

  • Full Member
  • Posts: 116
    • View Profile
1kHz Square Wave
« 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.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:1kHz Square Wave
« Reply #1 on: May 03, 2007, 02:41:56 PM »
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.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

ccdubs

  • Full Member
  • Posts: 116
    • View Profile
Re:1kHz Square Wave
« Reply #2 on: May 03, 2007, 02:55:09 PM »
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?

ccdubs

  • Full Member
  • Posts: 116
    • View Profile
Re:1kHz Square Wave
« Reply #3 on: May 03, 2007, 07:56:23 PM »
Another obstacle with the stepper motor is the duty cycle of the pulse.  Is the pulse set for 50% duty cycle?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:1kHz Square Wave
« Reply #4 on: May 04, 2007, 09:30:14 AM »
Yes, stepper motor pulses are setup for 50% duty cycle.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS