Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > stepper motor

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



stepper motor
Moderator:
ANCY

Post Reply
Follow this topic



stepper motor

mahmoud posted on 06 Apr 2013 12:15 PM PST
Top Contributor
67 Forum Posts

I am implementing a stepper motor half step driver in PSOC5 using the following techinque : http://www.8051projects.net/stepper-motor-interfacing/step-sequence.php

I am using a 3*4 LUT with the 3 inputs should be connected to a counter, but the problem is that the width of the 3 inputs is 1 bit while the width of the counter bus is 3 bits.

is there a way to seperate the bus into the original 3 bits??

the attached picture might help.

 




Re: stepper motor

Bob Marlowe posted on 06 Apr 2013 01:09 PM PST
Top Contributor
1768 Forum Posts

Drop the counter and use a registered LUT with 3 inputs and 7 outputs. The 3 inputs are to decode 8 states, from the 7 outputs 4 are for the stepper and three are the current states.

 

Bob



Re: stepper motor

mahmoud posted on 07 Apr 2013 03:56 AM PST
Top Contributor
67 Forum Posts

 do you mean that a registered LUT change states according to the input clock?? and why do I need 7 inputs?



Re: stepper motor

Bob Marlowe posted on 07 Apr 2013 05:58 AM PST
Top Contributor
1768 Forum Posts

I didn't say you need 7 Inputs, I said you need 3 inputs.

 

Bob



Re: stepper motor

danaaknight posted on 07 Apr 2013 06:18 AM PST
Top Contributor
1773 Forum Posts

A registered LUT changes state on the clock.

 

An unregistered LUT is simply combinatorial logic, so changes on inputs,

reflected within prop delays on output.

 

Generally speaking registered LUTs used to synch states, and allow for

fdbk from outputs back to inputs. An unregistered LUT can make a great osc-

illator if you fdbk outputs to inputs....

 

Regards, Dana.



Re: stepper motor

Bob Marlowe posted on 07 Apr 2013 07:45 AM PST
Top Contributor
1768 Forum Posts

I thought of something like this...

 

Bob



Re: stepper motor

mahmoud posted on 07 Apr 2013 08:41 AM PST
Top Contributor
67 Forum Posts

Thanks Bob it worked just fine :).

and this is the first time I notice that Dana ACTUALLY USED A SMILEY  .......... thanks Dana and welcome to the dark side :D



Re: stepper motor

Bob Marlowe posted on 07 Apr 2013 10:44 AM PST
Top Contributor
1768 Forum Posts

Fine to hear that!

To give you some more hints for your LUT, you may specify to have a Left/Right input which may switch direction....

 

Bob

I am not using any smileys here (though I would like to) because the forum software hangs with a window where I cannot make any selection.... (sh**!)



Re: stepper motor

mahmoud posted on 07 Apr 2013 05:15 PM PST
Top Contributor
67 Forum Posts

Hahahahaha and now Bob is cursing too!! I think that both of you just joined the dark side .

 

one more question: instead of using a clock I would like to use a simple low to high transition to activiate the LUT. I have thought of simple attaching a Pin and using the following API:

while(1)

{

Pin_Write(0);

Pin_Write(1);

}

but this did not give the desired outcome. what am I doing wrong and is there any other means of a low to high transition (using software to control it)??



Re: stepper motor

hli posted on 07 Apr 2013 09:49 PM PST
Top Contributor
675 Forum Posts

You might need an internal clock for the LUT (the data sheet just says 'you may select any clock in the system').

You could use an Edge Detector component to get a single pulse from an internal clock each time your input changes fro low to high.

Or you add another input to you LUT, which acts as enable input, and use a DFF as trigger to allow the LUT to advance exactly one time to the next state.



Re: stepper motor

Bob Marlowe posted on 08 Apr 2013 02:08 AM PST
Top Contributor
1768 Forum Posts

To generate a pulses controlled by your program directly i would suggest to use a Control Register UM connected to the LUT.

For a stepper motor it seems desirable to change the rotational speed on-the-fly according to the motor-specs. So the clock could be a varying clock made of a PWM (it has a Kill-input) and varying period.

Keep in mind: everything you put into the hardware parts of the project reduces the burden of the CPU.

 

Bob



Re: stepper motor

hli posted on 08 Apr 2013 02:54 AM PST
Top Contributor
675 Forum Posts

Silly me not to think of a control register :(

But using a PWM (or even better: a NCO) for controlling the PWM speed is even better. Together with a counter to control the number of pulses it sounds like a good component for the library.

(Sometimes one really wants to execute single steps under version control)



Re: stepper motor

mahmoud posted on 13 Apr 2013 02:14 AM PST
Top Contributor
67 Forum Posts

 the control register worked perfectly. thanks everyone :)



Re: stepper motor

hli posted on 13 Apr 2013 04:31 AM PST
Top Contributor
675 Forum Posts

You're welcome!






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20