You are here

How to generate step pulses for a stepper motor using PWM or counter ? | Cypress Semiconductor

How to generate step pulses for a stepper motor using PWM or counter ?

Summary: 5 Replies, Latest post by Bob Marlowe on 25 Nov 2016 06:20 AM PST
Verified Answers: 0
Last post
Log in to post new comments.
arbj's picture
User
33 posts

Hi,

I am developing a cnc controller using a CY8CKIT-049-41xx kit. For this I need to generate specific number of pulses of set pulse width (equal pulse widths no PWM), pulses for both X and Y axis is required.

The first approach I used consists of pulsing an output high and low, however I also want the kit to send back UART data to a PC. There must be no delays as this can affect the pulse motion.

Is this possible to do this using PWM or the Counter components, ?

My scheme is to do this...

I set the pulse widths, count values, then start the pulsing, since the main program loop is not involved in the actual pulsing I can send data to a PC via UART using the UART component 

 

thanks

a

user_1377889's picture
User
9606 posts

You will have to instantiate counters (in software or hardware) counting your PWM pulses for x- and y- direction. Depending on the max. pulse frequency of the PWM (less than 1kHz) you can use interrupt driven counters and shut down the PWM when the limit is reached.

 

Bob

arbj's picture
User
33 posts

Thanks for the help.

I tried using the counter but it does not work on clocks over 20khz, I need to use clock at 200khz, so I am using is component instead to count pulses. Since there are two motors, there will be 2 isr components Do I have to increase the system clock to 48mhz instead of default 24mhz ?

Thanks

a

user_1377889's picture
User
9606 posts

Is your motor step really with a frequency of 200kHz?? Can you provide a link to datasheet, please.

 

Bob

arbj's picture
User
33 posts

http://www.yankong.com/EN/index.php/proview-34-16.html

With a 2khz clock the motor is really slow.

user_1377889's picture
User
9606 posts

The motor diagram shows a usable frequency of up to 10kHz which is quite more than I expected. This would result in 2000 rpm which is quite a lot for a stepper.

 

Bob

Log in to post new comments.