300 likes | 401 Views
The PC GadgetMaster II. Stepper Motor Control. Developed by Frank Shapleigh. Edited by Jim Tuff. X. 4. Stepper Control Variables Explained. Simple Variable “Contains” numbers, characters or strings of characters. Contents of a variable change each time an assignment is made. Eg. X = 1
E N D
The PC GadgetMaster II Stepper Motor Control Developed byFrank Shapleigh Edited byJim Tuff
X 4 Stepper ControlVariables Explained Simple Variable “Contains” numbers, characters or strings of characters. Contents of a variable change each time an assignment is made. Eg. X = 1 X = 2 X = 3 X = 4
Stepper ControlArray Variables Explained Array Variable Array “Elements” can also store numbers, characters or strings of characters. Elements and their contents are referenced by an “index”. Eg. A(1) = 128 A(2) = 64 A(3) = 32 A(4) = 16 One Dimensional array A( )
Text1 Displays the value ofA(1) S = (1) = 128 Digital Output 1 (128) is 12 volts Stepper ControlArray Variables / Digital Output Example: Private Sub Command1_Click() A(1) = 128 A(2) = 64 A(3) = 32 A(4) = 16 S = 1 Text1 = A(S) End Sub
Text1 Displays the value ofA(3) S = (3) = 32 Digital Output 3 (32) is 12 volts Stepper ControlArray Variables / Digital Output Example: Private Sub Command1_Click() A(1) = 128 A(2) = 64 A(3) = 32 A(4) = 16 S = 3 Text1 = A(S) End Sub
Stepper Motor Control Clockwise Motion
Stepper ControlClockwise Motion 01 2 3 4 Stepper Code: Private Sub Command1_Click() If S < 4 Then S = S + 1 Else S = 1 End If Out 888, A(S) End Sub The Stepper Control Cycle begins with the Array Variable value of ‘S=0’ S = 0 + 1 = 1 A(S) = A(1) = 128 12 volts is sent to Digital Output 1
Stepper Control Clockwise Motion 01 2 3 4 Stepper Code: Private Sub Command1_Click() If S < 4 Then S = S + 1 Else S = 1 End If Out 888, A(S) End Sub The Stepper Control Cycle now has an Array Variable value of ‘S=1’ S = 1 + 1 = 2 A(S) = A(2) = 64 12 volts is sent to Digital Output 2
Stepper Control Clockwise Motion 0 1 23 4 Stepper Code: Private Sub Command1_Click() If S < 4 Then S = S + 1 Else S = 1 End If Out 888, A(S) End Sub The Stepper Control Cycle now has an Array Variable value of ‘S=2’ S = 2 + 1 = 3 A(S) = A(3) = 32 12 volts is sent to Digital Output 3
Stepper ControlClockwise Motion 0 1 234 Stepper Code: Private Sub Command1_Click() If S < 4 Then S = S + 1 Else S = 1 End If Out 888, A(S) End Sub The Stepper Control Cycle now has an Array Variable value of ‘S=3’ S = 3 + 1 = 4 A(S) = A(4) = 16 12 volts is sent to Digital Output 4
Stepper ControlClockwise Motion 0 1 2 34 Stepper Code: Private Sub Command1_Click() If S < 4 Then S = S + 1 Else S = 1 End If Out 888, A(S) End Sub The Stepper Control Cycle now has an Array Variable value of ‘S=4’ S is not less than 4!! S = 1 A(S) = A(1) = 128 12 volts is sent to Digital Output 1 (cycle repeats)
5 4 3 2 1 Private Sub Command1_Click() Forward End Sub Public Sub Forward() If S < 4 Then S = S + 1 Else S = 1 End If Out 888, A(S) End Sub PC GadgetMaster IIStepper Control Clockwise Motion Demo (CW)
5 4 3 2 1 Private Sub Command1_Click() Forward End Sub Public Sub Forward() If S < 4 Then ‘S is 0 S = S + 1 Else S = 1 ‘S is 1 End If Out 888, A(S)‘A(1) is 128 End Sub PC GadgetMaster IIStepper Control Clockwise Motion Demo (CW) 12 volts
5 4 3 2 1 Private Sub Command1_Click() Forward End Sub Public Sub Forward() If S < 4 Then‘S is 1 S = S + 1‘S is 2 Else S = 1 End If Out 888, A(S)‘A(2) is 64 End Sub PC GadgetMaster IIStepper Control Clockwise Motion Demo (CW) 12 volts
5 4 3 2 1 Private Sub Command1_Click() Forward End Sub Public Sub Forward() If S < 4 Then‘S is 2 S = S + 1‘S is 3 Else S = 1 End If Out 888, A(S)‘A(3) is 32 End Sub PC GadgetMaster IIStepper Control Clockwise Motion Demo (CW) 12 volts
5 4 3 2 1 Private Sub Command1_Click() Forward End Sub Public Sub Forward() If S < 4 Then‘S is 3 S = S + 1‘S is 4 Else S = 1 End If Out 888, A(S)‘A(4) is 16 End Sub PC GadgetMaster IIStepper Control Clockwise Motion Demo (CW) 12 volts
5 4 3 2 1 Private Sub Command1_Click() Forward End Sub Public Sub Forward() If S < 4 Then‘S is 4 S = S + 1 Else S = 1 ‘S is 1 End If Out 888, A(S)‘A(1) is 128 End Sub PC GadgetMaster IIStepper Control Clockwise Motion Demo (CW) 12 volts
Stepper Motor Control Counter Clockwise Motion
Stepper ControlCounter-Clockwise Motion0 1 2 34 Stepper Code: Private Sub Command1_Click() If S > 1 Then S = S - 1 Else S = 4 End If Out 888, A(S) End Sub The Stepper Control Cycle begins with the Array Variable value of ‘S=0’ S is not greater than 1!! S = 4 A(S) = A(4) = 16 12 volts is sent to Digital Output 4
Stepper ControlCounter-Clockwise Motion0 1 2 3 4 Stepper Code: Private Sub Command1_Click() If S > 1 Then S = S - 1 Else S = 4 End If Out 888, A(S) End Sub The Stepper Control Cycle now has an Array Variable value of ‘S=4’ S = 4 – 1 = 3 A(S) = A(3) = 32 12 volts is sent to Digital Output 3
Stepper ControlCounter-Clockwise Motion0 1 2 34 Stepper Code: Private Sub Command1_Click() If S > 1 Then S = S - 1 Else S = 4 End If Out 888, A(S) End Sub The Stepper Control Cycle now has an Array Variable value of ‘S=3’ S = 3 – 1 = 2 A(S) = A(2) = 64 12 volts is sent to Digital Output 2
Stepper ControlCounter-Clockwise Motion0 1 2 34 Stepper Code: Private Sub Command1_Click() If S > 1 Then S = S - 1 Else S = 4 End If Out 888, A(S) End Sub The Stepper Control Cycle now has an Array Variable value of ‘S=2’ S = 2 – 1 = 1 A(S) = A(1) = 128 12 volts is sent to Digital Output 1
Stepper ControlCounter-Clockwise Motion0 1 2 34 Stepper Code: Private Sub Command1_Click() If S > 1 Then S = S - 1 Else S = 4 End If Out 888, A(S) End Sub The Stepper Control Cycle now has an Array Variable value of ‘S=1’ S is not greater than 1!! S = 4 A(S) = A(4) = 16 12 volts is sent to Digital Output 4 (cycle repeats)
5 4 3 2 1 Private Sub Command1_Click() Forward End Sub Public Sub Forward() If S > 1 Then S = S - 1 Else S = 4 End If Out 888, A(S) End Sub PC GadgetMaster IIStepper Control Counter Clockwise Motion Demo (CCW)
5 4 3 2 1 Private Sub Command1_Click() Forward End Sub Public Sub Forward() If S > 1 ‘S is 0 S = S - 1 Else S = 4 ‘S is 4 End If Out 888, A(S)‘A(4) is 16 End Sub PC GadgetMaster IIStepper Control Counter Clockwise Motion Demo (CCW) 12 volts
5 4 3 2 1 Private Sub Command1_Click() Forward End Sub Public Sub Forward() If S > 1 Then‘S is 4 S = S - 1‘S is 3 Else S = 4 End If Out 888, A(S)‘A(3) is 32 End Sub PC GadgetMaster IIStepper Control Counter Clockwise Motion Demo (CCW) 12 volts
5 4 3 2 1 Private Sub Command1_Click() Forward End Sub Public Sub Forward() If S > 1 Then‘S is 3 S = S - 1‘S is 2 Else S = 4 End If Out 888, A(S)‘A(2) is 64 End Sub PC GadgetMaster IIStepper Control Counter Clockwise Motion Demo (CCW) 12 volts
5 4 3 2 1 Private Sub Command1_Click() Forward End Sub Public Sub Forward() If S > 1 Then ‘S is 2 S = S - 1 ‘S is 1 Else S = 4 End If Out 888, A(S)‘A(1) is 128 End Sub PC GadgetMaster IIStepper Control Counter Clockwise Motion Demo (CCW) 12 volts
5 4 3 2 1 Private Sub Command1_Click() Forward End Sub Public Sub Forward() If S > 1 ‘S is 1 S = S - 1 Else S = 4 ‘S is 4 End If Out 888, A(S)‘A(4) is 16 End Sub PC GadgetMaster IIStepper Control Counter Clockwise Motion Demo (CCW) 12 volts
The PC GadgetMaster II Stepper Motor Control END