Stepper motor problems
I recently got stepper motors from parallax to use in my project. It involves outputting to the parallel port and using that to drive the motor.
setup is as follows:
computer->parallel port->ULN2803A->stepper motor
I am using visual studio c# 2008 to code it (for project reasons), and my stepping works perfectly for full stepping (normal and high torque).
The problem that I am having is when I do Half Stepping, the first step is very small, maybe a 1/8 step, then the 2nd step will be 7/8 step, so although every 2 steps is = to a full step, the individual steps are not half steps, to ease this i will post my code so far.
try to only look at the values going out from the PortAccess command. Address is 0x378(parallel port).
I am outputting so that a 0 on a bit would give power to that phase
bit0=phase1
bit1=phase2
bit3=phase3
bit4=phase4
any help for this would be appreciated as technical support cannot solve the problem, and I am thinking the issue might be hardware, and not software(which is why i provided the code i used).
thanks
Eric Therriault
Computer Engineering Technology Student
setup is as follows:
computer->parallel port->ULN2803A->stepper motor
I am using visual studio c# 2008 to code it (for project reasons), and my stepping works perfectly for full stepping (normal and high torque).
The problem that I am having is when I do Half Stepping, the first step is very small, maybe a 1/8 step, then the 2nd step will be 7/8 step, so although every 2 steps is = to a full step, the individual steps are not half steps, to ease this i will post my code so far.
[color=#0000ff]private[/color] [color=#0000ff]void[/color][color=#000000] btnhalfstep_Click([/color][color=#0000ff]object[/color][color=#000000] sender, [/color][color=#2b91af]EventArgs[/color][color=#000000] e)[/color] { stopnow();//stops any other stepping being done interval = [color=#2b91af]Int32[/color].Parse(maskedtxtinterval2.Text); halfsteptimer.Interval = interval; halfsteptimer.Tick += [color=#0000ff]new[/color] [color=#2b91af]EventHandler[/color](half_step); halfsteptimer.Enabled = [color=#0000ff]true[/color]; }
[color=#0000ff]void[/color][color=#000000] half_step([/color][color=#0000ff]object[/color][color=#000000] o1, [/color][color=#2b91af]EventArgs[/color][color=#000000] e1) [/color][color=#008000]//Makes the leds counting in binary form[/color] { [color=#0000ff]if[/color] (rdclockwise.Checked == [color=#0000ff]true[/color]) { [color=#0000ff]if[/color] (halfstep < 8) { [color=#0000ff]switch[/color] (halfstep) { [color=#0000ff]case[/color] 0: [color=#2b91af]PortAccess[/color].Output(address, 1); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 1: [color=#2b91af]PortAccess[/color].Output(address, 3); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 2: [color=#2b91af]PortAccess[/color].Output(address, 2); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 3: [color=#2b91af]PortAccess[/color].Output(address, 6); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 4: [color=#2b91af]PortAccess[/color].Output(address, 4); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 5: [color=#2b91af]PortAccess[/color].Output(address, 12); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 6: [color=#2b91af]PortAccess[/color].Output(address, 8); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 7: [color=#2b91af]PortAccess[/color].Output(address, 9); [color=#0000ff]break[/color]; } } halfstep += 1; [color=#0000ff]if[/color] (halfstep == 8) { halfstep = 0; } } [color=#0000ff]if[/color] (rdcounterclockwise.Checked == [color=#0000ff]true[/color]) { [color=#0000ff]if[/color] (halfstep < 8) { [color=#0000ff]switch[/color] (halfstep) { [color=#0000ff]case[/color] 0: [color=#2b91af]PortAccess[/color].Output(address, 1); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 1: [color=#2b91af]PortAccess[/color].Output(address, 9); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 2: [color=#2b91af]PortAccess[/color].Output(address, 8); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 3: [color=#2b91af]PortAccess[/color].Output(address, 12); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 4: [color=#2b91af]PortAccess[/color].Output(address, 4); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 5: [color=#2b91af]PortAccess[/color].Output(address, 6); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 6: [color=#2b91af]PortAccess[/color].Output(address, 2); [color=#0000ff]break[/color]; [color=#0000ff]case[/color] 7: [color=#2b91af]PortAccess[/color].Output(address, 3); [color=#0000ff]break[/color]; } } halfstep += 1; [color=#0000ff]if[/color] (halfstep == 8) { halfstep = 0; } } }
try to only look at the values going out from the PortAccess command. Address is 0x378(parallel port).
I am outputting so that a 0 on a bit would give power to that phase
bit0=phase1
bit1=phase2
bit3=phase3
bit4=phase4
any help for this would be appreciated as technical support cannot solve the problem, and I am thinking the issue might be hardware, and not software(which is why i provided the code i used).
thanks
Eric Therriault
Computer Engineering Technology Student