<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>c program for rotating  stepper motor to particular angle in 8051 microcontroller</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/29872/c-program-for-rotating-stepper-motor-to-particular-angle-in-8051-microcontroller</link><description> 
Sir, i am using stepper motor of 2 degree step angle. I m using
following c program: 

 
 #include&amp;lt;reg51.h&amp;gt;
 void main()
 {
 while(1)
 { void delay (int);
 P1=0xCC;
 delay(1);
 P1=0x66;
 delay(1);
 P1=0x33;
 delay(1);
 P1=0x99;
 delay(1);
 }
 }
 void</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: c program for rotating  stepper motor to particular angle in 8051 microcontroller</title><link>https://community.arm.com/thread/143392?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2013 22:37:20 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:172182ec-3119-42f4-a7cd-7c08aa233fcb</guid><dc:creator>Fuchs Leonhard</dc:creator><description>&lt;p&gt;&lt;p&gt;
I just sketched an idea.&lt;/p&gt;

&lt;p&gt;
&amp;quot;counter variable&amp;quot; was not meant to be the timer itself rather a
counter to count the steps of the motor. The timer should be running
independently. Favoured with autoreload if supported.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: c program for rotating  stepper motor to particular angle in 8051 microcontroller</title><link>https://community.arm.com/thread/140536?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2013 08:33:01 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ab2c2c26-472e-4ba8-820d-5eab3d7a449e</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Note that &amp;quot;counter variable&amp;quot; in the post you commented on was not
the counter register for the timer, but a normal variable to keep
track of total movement of the stepper motor.&lt;/p&gt;

&lt;p&gt;
And correct - better timers will support continuous operation
while issuing an interrupt. So they do not leak time before the ISR
have time to restart the timer again.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: c program for rotating  stepper motor to particular angle in 8051 microcontroller</title><link>https://community.arm.com/thread/136986?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2013 07:45:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:61cd7453-4b1d-4e17-bea3-6f0c8023b718</guid><dc:creator>&amp;#178;erik malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
you msy not have zero in the timer, some timers keep running after
triggering the interrupt which happened &lt;b&gt;when the count passed
zero&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;
Erik&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: c program for rotating  stepper motor to particular angle in 8051 microcontroller</title><link>https://community.arm.com/thread/128095?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2013 07:40:35 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d71ccf85-317a-40ec-993c-fd6fdfcc806e</guid><dc:creator>&amp;#178;erik malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;on timer irq:&lt;br /&gt;
* check counter-variable, if not zero&lt;/i&gt; you have a malfunctioning
chip.&lt;/p&gt;

&lt;p&gt;
Erik&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: c program for rotating  stepper motor to particular angle in 8051 microcontroller</title><link>https://community.arm.com/thread/117232?ContentTypeID=1</link><pubDate>Wed, 03 Apr 2013 23:48:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:45e474a3-95fa-44ad-a3c4-3f1504bccc8c</guid><dc:creator>Fuchs Leonhard</dc:creator><description>&lt;p&gt;&lt;p&gt;
I agree with Andrew. Delays written in C are not exactly
brillant.&lt;/p&gt;

&lt;p&gt;
If I remember correctly I have read something about timers and
interrupts on micro-controllers. This combination is nearly
unbeatable by software.&lt;/p&gt;

&lt;p&gt;
Idea:&lt;/p&gt;

&lt;p&gt;
* setup timer to start speed&lt;br /&gt;
* setup counter-variable, how many steps&lt;br /&gt;
* enable timer irq&lt;/p&gt;

&lt;p&gt;
on timer irq:&lt;br /&gt;
* check counter-variable, if not zero do next step an decrement
variable&lt;br /&gt;
* possibly correct timer period to realize
acceleration/deceleration&lt;/p&gt;

&lt;p&gt;
Be aware! Stepper motors are a challange. If you are going to
optimize noise, torque, engine efficiency, ramps, detent torque and
so on: you will be busy for a while. Not even thought about
microstepping, stall detection or sinusoidal phase currents.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: c program for rotating  stepper motor to particular angle in 8051 microcontroller</title><link>https://community.arm.com/thread/106987?ContentTypeID=1</link><pubDate>Sat, 30 Mar 2013 11:11:01 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:07888db5-38a7-4f4e-83c3-a01428acad99</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Think about it. What happens if you try to step too fast? You
think the stepper motor is able to have infinite acceleration?&lt;/p&gt;

&lt;p&gt;
So if you want a stepper motor to run fast, you have to gradually
increase the step frequency.&lt;/p&gt;

&lt;p&gt;
Same thing when it&amp;#39;s time to stop the rotation - you can&amp;#39;t just
instantly stop generating pulses but have to slow down the frequency
until you have reached a speed where the stepper motor is able to
finally stop if no more pulses are generated.&lt;/p&gt;

&lt;p&gt;
The need for acceleration/retardation will obviously depend on
used motor, how you drive the current through the windings and what
load you have that the motor should drive. So time for you to spend
some time experimenting. We can&amp;#39;t do it for you.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: c program for rotating  stepper motor to particular angle in 8051 microcontroller</title><link>https://community.arm.com/thread/81106?ContentTypeID=1</link><pubDate>Sat, 30 Mar 2013 10:09:32 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5995a0fe-4fd7-4b7d-8bc0-d0e5e1edb5b9</guid><dc:creator>Ankit Bhatt</dc:creator><description>&lt;p&gt;&lt;p&gt;
thank u for your valuable reply.....&lt;br /&gt;
bt m having problem for increasing the speed of rotation, I am using
following code for delay :&lt;/p&gt;

&lt;p&gt;
void delay(int a)&lt;br /&gt;
{ for(i=0;i&amp;lt;1275;i++)&lt;br /&gt;
for(j=0;j&amp;lt;a:j++);&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;
But when i am putting minimum value of a i.e. a=1, then i m
getting the speed of 5.5 rpm.....&lt;br /&gt;
So &lt;b&gt;please tell me how can i increase the speed of rotation more
than 20 rpm&lt;/b&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: c program for rotating  stepper motor to particular angle in 8051 microcontroller</title><link>https://community.arm.com/thread/68189?ContentTypeID=1</link><pubDate>Sat, 30 Mar 2013 02:57:20 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fde78f5b-c14a-420c-b835-a966c12dbe3a</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
So you want to rotate 80 degrees. And every step is 2 degrees. And
you _really_ can&amp;#39;t figure out how to stop the rotation after 40
steps???&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>