Shop OBEX P1 Docs P2 Docs Learn Events
stepper code — Parallax Forums

stepper code

ArchiverArchiver Posts: 46,084
edited 2002-06-10 03:14 in General Discussion
Below is the saw code that I started on. As you can see I did the code the same
as yours "for the stepper comands". I tried the pulsout and it also worked
great. I just never got the desired speed. If anyone is interested In the vb
code I will attempt zipping it and sending It to them. The vb code was written
by Jared Hoylman.

'{$STAMP BS2}
' \\ WARNING
' \\ When aborting from the VB interface, it will not immediately
' \\ abort the operation. It will abort after the current cut is complete.
' \\ So, do not use the "Abort" button as an Emergency Off button.
' \\ Make sure to hard wire in a mechanical switch to kill power to the
' \\ saw, micro, and whatever other equipment is used in operating the saw.
' \\ WARNING


' \\ Constant Declarations
PC_Pin Con 16
PC_Baud Con 16780
PC_StatusUpdate Con 127
Process_Complete Con 255
Abort_Now Con 1

' \\ Variable Declarations
Steps Var Word
Length Var Word
Quantity Var Byte
Control_Char Var Byte
Completed Var Byte


DirA = $F
OutS = 1
Dir4 = 1



Main:
Steps = 0
Length = 0
Quantity = 0
Control_Char = 255
Completed = 0

Serin PC_Pin, PC_Baud, [noparse][[/noparse]WAIT(255),Control_Char, Length.LowByte, Length.HighByte,
Quantity]
Branch Control_Char, [noparse][[/noparse]StartCutting, RaiseSaw, LowerSaw]

Goto Main




StartCutting:
Completed = 0
For Completed = 1 To Quantity
Pause 1500

' \\ Step Now
For Steps = 1 To Length
Out0 = 0
Pause 100
Out0 = 1
Pause 100
Next

' \\ Cut Now
Cut:
High 4
Pause 1000
If (IN11 = 0) Then Cut

' \\ Raise
Low 4


Serout PC_Pin, PC_Baud, [noparse][[/noparse]PC_StatusUpdate, Completed]
Serin PC_Pin, PC_Baud, [noparse][[/noparse]WAIT(255), Control_Char]
If (Control_Char = Abort_Now) Then Abort
Next
Serout PC_Pin, PC_Baud, [noparse][[/noparse]PC_StatusUpdate, Process_Complete]
Goto Main



RaiseSaw:
Low 4
Pause 1500 ' Wait for saw to raise
Serout PC_Pin, PC_Baud, [noparse][[/noparse]PC_StatusUpdate, Process_Complete]
Goto Main

LowerSaw:
High 4
Pause 1000
If (IN11 = 1) Then raisesaw'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Serout PC_Pin, PC_Baud, [noparse][[/noparse]PC_StatusUpdate, Process_Complete]
Goto Main


Abort:
Low 4 ' \\ Make sure saw is raised
Serout PC_Pin, PC_Baud, [noparse][[/noparse]PC_StatusUpdate, Process_Complete]
Goto Main




Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup

[noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.