The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

30
The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff

Transcript of The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Page 1: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

The PC GadgetMaster IIStepper Motor Control

Developed by Frank ShapleighEdited by Jim Tuff

Page 2: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

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

X4

Stepper Control Variables Explained

Page 3: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

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( )

Stepper Control Array Variables Explained

1 128

2 64

3 32

4 16

Page 4: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Example:Private Sub Command1_Click()

A(1) = 128

A(2) = 64

A(3) = 32

A(4) = 16

S = 1

Text1 = A(S)

End Sub

Stepper Control Array Variables / Digital Output

Text1 Displays the value of A(1)

S = (1) = 128

Digital Output 1 (128) is 12 volts

Page 5: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

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 Control Array Variables / Digital Output

Text1 Displays the value of A(3)

S = (3) = 32

Digital Output 3 (32) is 12 volts

Page 6: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Stepper Motor ControlClockwise Motion

Page 7: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Stepper Code:Private Sub Command1_Click()

If S < 4 Then

S = S + 1

Else

S = 1

End If

Out 888, A(S)

End Sub

Stepper Control

Clockwise Motion 00 1 2 3 4The 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

Page 8: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Stepper Code:Private Sub Command1_Click()

If S < 4 Then

S = S + 1

Else

S = 1

End If

Out 888, A(S)

End Sub

Stepper Control

Clockwise Motion 0 1 1 2 3 4The 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

Page 9: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Stepper Code:Private Sub Command1_Click()

If S < 4 Then

S = S + 1

Else

S = 1

End If

Out 888, A(S)

End Sub

Stepper Control

Clockwise Motion 0 1 22 3 4The 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

Page 10: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Stepper Code:Private Sub Command1_Click()

If S < 4 Then

S = S + 1

Else

S = 1

End If

Out 888, A(S)

End Sub

Stepper Control

Clockwise Motion 0 1 2 33 4The 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

Page 11: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Stepper Code:Private Sub Command1_Click()

If S < 4 Then

S = S + 1

Else

S = 1

End If

Out 888, A(S)

End Sub

Stepper Control

Clockwise Motion 0 1 2 3 44The 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)

Page 12: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

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

5

4

3

2

1

PC GadgetMaster II Stepper Control

Clockwise Clockwise Motion Demo Motion Demo

((CWCW))

Page 13: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

12 volts

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 II Stepper Control

Clockwise Clockwise Motion Demo Motion Demo

((CWCW))

Page 14: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

5

4

3

2

1

12 volts

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 II Stepper Control

Clockwise Clockwise Motion Demo Motion Demo

((CWCW))

Page 15: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

5

4

3

2

1

12 volts

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 II Stepper Control

Clockwise Clockwise Motion Demo Motion Demo

((CWCW))

Page 16: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

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 II Stepper Control

Clockwise Clockwise Motion Demo Motion Demo

((CWCW))

Page 17: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

5

4

3

2

1 12 volts

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 II Stepper Control

Clockwise Clockwise Motion Demo Motion Demo

((CWCW))

Page 18: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Stepper Motor ControlCounter Clockwise Motion

Page 19: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Stepper Code:Private Sub Command1_Click()

If S > 1 Then

S = S - 1

Else

S = 4

End If

Out 888, A(S)

End Sub

Stepper Control Counter-Clockwise Motion 0 1 2 3 44

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

Page 20: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Stepper Code:Private Sub Command1_Click()

If S > 1 Then

S = S - 1

Else

S = 4

End If

Out 888, A(S)

End Sub

Stepper Control Counter-Clockwise Motion 0 1 2 3 3 4

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

Page 21: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Stepper Code:Private Sub Command1_Click()

If S > 1 Then

S = S - 1

Else

S = 4

End If

Out 888, A(S)

End Sub

Stepper Control Counter-Clockwise Motion 0 1 22 3 4

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

Page 22: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Stepper Code:Private Sub Command1_Click()

If S > 1 Then

S = S - 1

Else

S = 4

End If

Out 888, A(S)

End Sub

Stepper Control Counter-Clockwise Motion 0 11 2 3 4

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

Page 23: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

Stepper Code:Private Sub Command1_Click()

If S > 1 Then

S = S - 1

Else

S = 4

End If

Out 888, A(S)

End Sub

Stepper Control Counter-Clockwise Motion 00 1 2 3 4

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)

Page 24: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

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

5

4

3

2

1

PC GadgetMaster II Stepper Control

Counter Counter Clockwise Clockwise

Motion Demo Motion Demo ((CCWCCW))

Page 25: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

12 volts

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 II Stepper Control

Counter Counter Clockwise Clockwise

Motion Demo Motion Demo ((CCWCCW))

Page 26: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

5

4

3

2

1

12 volts

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 II Stepper Control

Counter Counter Clockwise Clockwise

Motion Demo Motion Demo ((CCWCCW))

Page 27: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

5

4

3

2

1

12 volts

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 II Stepper Control

Counter Counter Clockwise Clockwise

Motion Demo Motion Demo ((CCWCCW))

Page 28: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

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 II Stepper Control

Counter Counter Clockwise Clockwise

Motion Demo Motion Demo ((CCWCCW))

Page 29: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

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 II Stepper Control

Counter Counter Clockwise Clockwise

Motion Demo Motion Demo ((CCWCCW))

Page 30: The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.

The PC GadgetMaster IIStepper Motor Control

END