CAD CAM EDM DRO - Yahoo Group Archive

new Step and Direction

on 2002-12-17 20:25:33 UTC
' this program writes directly to pin 2,(D0) and pin 3,(D1)
Private Sub Fwd_Click()
i = 0
j = 0
delay = 25000

For j = 1 To 400

DlPortWritePortUchar &H378, 0 ' (D1 - 0), (D0 - 0)
For i = 1 To delay
Next i
DlPortWritePortUchar &H378, 1 ' (D1 - 0), (D0 - 1)

Next j
End Sub
' Same sub for the other direction
' doing this with the pins/D port
' (D1 - 1), (D0 - 0)

' (D1 - 1), (D0 - 1)

'Pin Signal Name Function
' 2 D0 X Direction
' 3 D1 X Step
' 4 D2 Y Direction
' 5 D3 Y Step
' 6 D4 Z Direction
' 7 D5 Z Step
QUESTION

why does this work?
my pinout has D0 as the direction and D1 as the step,
is this inncorrect info, or is my for/next(outer J loop)
coincidentally, acting as my pulse width, and if so,
I don't see what the inner delay (i loop) is doing,
except it doesn't go slow enough to work without it....

This works, but now I'm a little confused.

any help is appreciated, thanks

(this is a visual basic subroutine, for a button,
the mill is a sherline, 400 half steps per revolution
for an inch of linear movement)

Discussion Thread

rdenn25 <rdenn25@y... 2002-12-17 20:25:33 UTC new Step and Direction