Hi this is the cypress enable script to run the spindes this loads the rom on the controller board
with the file duet.dat which exists within the boxford software which you can download sorry
its not simple but that is the way it is you must talk directly to the serial ports and send six bytes
use a null modem cable you will know you have it working because there are two led's on the board
which flash and then stop, see the manua, try it ouot if you have problems place a post.
********************* M2000 **********************************
' This is a working initialisation procedure modified 051208
Sub intialise_boxford() ' Boxford Duet1 9600 8 data 1 stop even parity
'******************************** file send routine *****************************
Dim counter As Integer
Dim bytes As Integer
Dim flag As Integer
counter = 0
bytes = 0
flag = 0
Do
If (getportbyte(1021) And 1) <> 0 Then
inbyte = getportbyte(1016)
bytes = bytes + 1
End If
counter = counter + 1
If counter > 10000 Then
flag = 0
Exit Do
End If
If bytes > 6 Then
'Print "Boxford Already Initialised"
flag = 1
Exit Do
End If
Loop
If flag =1 Then
GoTo Boxford_already_initialised
Else
GoTo Initialise_boxford
End If
Initialise_boxford:
putportbyte(888,(GetPortByte(888) Or 128)) 'This is the TX register
For i = 1 To 1000000
Next i
putportbyte(888,(PortByte And 127)) 'This is the TX register
For i = 1 To 1000000
Next i
Open "c:\mach3\data\duet\duet.dat" For Input As #1 ' Open file.
Open "c:\mach3\data\duet\Dout.dat" For Output As #2 ' Open file.
Do While Not EOF(1) ' Loop until end of file.
outint = Asc(Input (1,#1)) ' Read value into variable.
loop_1: If (getportbyte(1021) And 32)<>0 Then 'Line Status Register bit 5 TX holding reg empty
putportbyte(1016,outint) 'This is the TX register
Else
GoTo loop_1
End If
Loop
For i = 1 To 1000000
Next i
bytes = 0
counter = 0
Do
If (getportbyte(1021) And 1) <> 0 Then
inbyte = getportbyte(1016)
Print #2,inbyte
bytes = bytes + 1
End If
counter = counter + 1
If counter > 10000 Then
Print "Boxford not initialised"
Exit Do
End If
If bytes > 6 Then
Exit Do
End If
Loop
Close #1 ' Close file.
Close #2 ' Close file.
Boxford_already_initialised:
DeActivateSignal(11) 'A
DeActivateSignal(10) 'B This will set the index input
DeActivateSignal(9) 'C
code "M05"
End Sub
' M03 start the spindle in CW as viewed from the chuck towards the tail stock (correct view)
Dim outint(7) As Integer
outint(1) = Asc("S")
outint(2) = 0
outint(3) = 255
outint(4) = 0
outint(5) = 0
outint(6) = 0
outint(7) = 16
If (getuserLED(1010) =1 And getuserLED(1011) = 0) Then
Message "Spindle Already CW"
Else
For i = 1 To 7
putint = outint(i)
loop_1: If (getportbyte(1021) And 32)<>0 Then 'Line Status Register bit 5 TX holding reg empty
putportbyte(1016,putint) 'This is the TX register
Else
GoTo loop_1
End If
Next i
Call setuserLED(1010,1) 'Sets the LED variable to be read by getuserLED(1010)
Call setuserLED(1011,0) 'for spindle cal CW and CWW as these are different
'both are set so an error check can be performed
message "Spindle CW"
DoSpinCW()
End If
Sub Mach_Code(Code_String)
Code Code_String
While ismoving()
Wend
End Sub
' M04 start the spindle in CCW as viewed from the chuck towards the tail stock (correct view)
Dim outint(7) As Integer
outint(1) = Asc("S")
outint(2) = 255
outint(3) = 0
outint(4) = 0
outint(5) = 0
outint(6) = 0
outint(7) = 16
If (getuserLED(1010) =0 And getuserLED(1011) = 1) Then
Message "Spindle Already CWW"
Else
For i = 1 To 7
putint = outint(i)
loop_1: If (getportbyte(1021) And 32)<>0 Then 'Line Status Register bit 5 TX holding reg empty
putportbyte(1016,putint) 'This is the TX register
Else
GoTo loop_1
End If
Next i
Call Mach_Code("G04 P200")
Call setuserLED(1010,0) 'Sets the LED variable to be read by getuserLED(1010)
Call setuserLED(1011,1) 'for spindle cal CW and CWW as these are different
'both are set so an error check can be performed
Message "Spindle CCW"
DoSpinCCW()
End If
Sub Mach_Code(Code_String)
Code Code_String
While ismoving()
Wend
End Sub