Is your motor loaded?
Have you tried to test it with no load at all?
Ioannis
Is your motor loaded?
Have you tried to test it with no load at all?
Ioannis
How do you think you loaded?
I tried to test it and no-load, but it is the same.
problem is that when running the operation is complete, not return to the same starting point, but perhaps the real fault of a few steps, and I really should be the precise.
Going by your code it seems that you have a unipolar motor (6 wires) and 4 switches (transistors or whatever). If so, using pulsout is not the best way since there will be a short delay between each pulsout statement where no current is flowing in any of the coils. When no current is flowing the torque drops and the rotor can "jump" to the closest natural step (magnetic pole).
Now, there are other ways to "produce" the step sequence than this rather crude one but try this and see if it helps.Code:Delay VAR BYTE i VAR WORD TRISB = 0 ' All outputs. Delay = 10 ' ~100steps / second For i = 1 to 1000 '1000 steps forward. PORTB = %00000001 Pause Delay PORTB = %00000010 Pause Delay PORTB = %00000100 Pause Delay PORTB = %00001000 Pause Delay NEXT Pause 2500 For i = 1 to 1000 '1000 steps reverse. PORTB = %00001000 Pause Delay PORTB = %00000100 Pause Delay PORTB = %00000010 Pause Delay PORTB = %00000001 Pause Delay NEXT
Thks for help HenrikOlsson,
is work but is not precision,make mistake every 5-6 circle working.
I use this step motor,ST-28 have 5 wire uni polar step motor,
this is specification:
Rated voltage: 12VDC
Current: 32mA
Resistance/phase: 280
Fases: 4
Angle/step: 5.625 deg
Gear ratio: 1:64
detent torque: 350gfcm (0.034Nm)
pull-in torque: 6360g (0.059Nm)
max. starting pulse rate:700pps
max. slewing pulse rate:1400pps
max. speed: 20.5 rpm
steps/rev: 2048 (tested!!)
connector order:
B2: Blue
B1: Pink
A2: Yellow
A1: Orange
GND: Red
And one more question in your code I will see you dont use this like in my code:
and tell is when I change speed of motor maybe I must change some number of steps,of some else... I dont now!!!Delay VAR BYTE
i VAR WORD
TRISB = 0 ' All outputs.
Delay = 10 ' ~100steps / second
For i = 1 to 1000 '1000 steps forward.
PORTB = %00000001
Pause Delay
PORTB = %00000010
Pause Delay
PORTB = %00000100
Pause Delay
PORTB = %00001000
Pause Delay
NEXT here dont have i whay
Pause 2500
For i = 1 to 1000 '1000 steps reverse.
PORTB = %00001000
Pause Delay
PORTB = %00000100
Pause Delay
PORTB = %00000010
Pause Delay
PORTB = %00000001
Pause Delay
NEXT
Last edited by dragan77; - 5th September 2011 at 19:02.
Can you post the wiring diagram?
Al.
All progress began with an idea
Hi,
It's not easy to say what the problem is. It might be that you need to start even slower than ~100Hz and then ramp up the step frequency, in order to see if that is the case increase the pause time between each step to something like 25ms.
The above is also the answer to how you change the speed. There's the DELAY variable which, in my example gets assigned the value of 10. Between each step there's a delay of 10ms, change that and the motor speed changes.
A schematic of how you have it wired would help too. Usually you run step motors at much higher voltage than what they are rated for and then limit the current. For unipolar drive this was usually done by big series resistors. In todays bipolar drives it's done thru chopping/PWM.
With PBP you don't need to specify anything with the NEXT statement. It automatically belongs to the FOR that is "closest to it". You CAN definitely add a variable to the NEXT for added clarity but it's not needed.
Finally, you say the motor has a step angle of 5.625 degrees, that's 360/5.625=64 steps/rev. Then you have a gearbox with a ratio of 1:64, so 64*64 is 4096 and not 2048 as you've stated....something isn't correct there but it's not related to your problem so it doesn't really matter right now.
/Henrik.
HI,
do you now what is hapend,
when I write this code:
My motor turn round 360 degrees, and back - 360 degrees ,1 time!!!Delay VAR BYTE
i VAR WORD
TRISB = 0 ' All outputs.
Delay = 10 ' ~100steps / second
For i = 1 to 512
PORTB = %00000001
Pause Delay
PORTB = %00000010
Pause Delay
PORTB = %00000100
Pause Delay
PORTB = %00001000
Pause Delay
NEXT
Pause 1500
For i = 1 to 512
PORTB = %00001000
Pause Delay
PORTB = %00000100
Pause Delay
PORTB = %00000010
Pause Delay
PORTB = %00000001
Pause Delay
NEXT
and when I write this code:
my motor turn round 360 degrees,and back - 360 degrees, 4 time is correct?Delay VAR BYTE
i VAR WORD
TRISB = 0 ' All outputs.
Delay = 10 ' ~100steps / second
For i = 1 to 4096
PORTB = %00000001
Pause Delay
PORTB = %00000010
Pause Delay
PORTB = %00000100
Pause Delay
PORTB = %00001000
Pause Delay
NEXT
Pause 1500
For i = 1 to 4096
PORTB = %00001000
Pause Delay
PORTB = %00000100
Pause Delay
PORTB = %00000010
Pause Delay
PORTB = %00000001
Pause Delay
NEXT
Last edited by dragan77; - 5th September 2011 at 19:32.
Bookmarks