Hello Guest it is April 24, 2024, 02:34:23 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - The_black_cat_dies

Pages: 1 2 »
1
General Mach Discussion / Re: Serial Port control under cypress enable
« on: January 04, 2011, 02:46:21 PM »
Well done :-) so far so good. I think it's too many "end if" 's remove the last one (too many bourbons and coke for xmas). Careful with this the spindle can work at 3000 RPM also this is for the Duet MKI  I believe the MkII is different, also the guard needs to be down otherwise it won't start, you should hear the relay click on, also sorry my mistake it is 7 bytes. It could do with someone else confirming the codes I used the old software and put a COM serial sniffer to record the sent and received codes but my old dos pc is now dead.
I hope you noted that M03 and M04 are included in the post they need to split these out also I didn't include M05 I'm not near my lathe at the moment I think it's the same as M03,M04 just 0 in place of the 255 in  bytes  2&3

2
General Mach Discussion / Re: Serial Port control under cypress enable
« on: December 29, 2010, 03:17:35 PM »
Sorry forgot the speed  I hope this is enough to get you started.

   ' *************** RPM setting code *******************

   speed = RPM(requested_rpm)
   
outint(1) = Asc("S")
outint(2) = 255
outint(3) = 255
outint(4) = 0
outint(5) = 128
outint(6) = Speed
outint(7) = 16

   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

   
   End If

3
General Mach Discussion / Re: Serial Port control under cypress enable
« on: December 29, 2010, 03:12:23 PM »
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


4
General Mach Discussion / Re: Mach3 and Boxford Duet
« on: August 27, 2010, 10:50:29 AM »
hotwire : The duet works fine with Mach especially when you add limit switches.

In answer to some of the more radicals. Removing the electronics if they work, seems to me to be a waste of time the duet operates from the parallel port so can be driven directly by Mach. The spindle is a bit more of a problem but the solution is simple just send duet.dat via serial to the spindle board using cypress enable the macro program that comes with Mach, the contents of duet.dat is the program that the duet uses to control the spindle but this must be loaded into the duets own memory. Then a few bytes sent to the boxford set the speed, the secret is knowing which bytes, I used a serial cable attached to two PC's to sniff the boxford program and find what codes were being sent. after this I added limit switches and touch probe facility which is more difficult than it sounds. the tool setting was a matter of programming the touch probe function to use the tools as probes and use a settting standard in the chuck.  I am now in the process of writing CAM software for lathe.  I also got the duet to make PCB's but that is even more difficult as the table is not flat, once you have a probing function established it is easy to plot the surface defects and find out the table is warped it would seem, however this is not the case the way the duet holds the table means the table can never be flat so I had to write software to compensate for the warp. I did have to modify the power supply box to link some of the signals through to the parallel port but this was a minor modification the more difficult one was adding the limit switches. you can see where I have added a small connector box between the original cable and socket this allows me to take off signals to my interface box for the switches.

Tweakie.CNC :  I think you may have misplaced your post as this post relates to the boxford duet.

5
General Mach Discussion / Re: Mach3 and Boxford Duet
« on: September 11, 2007, 05:04:31 AM »
Hi
How are you getting on with the Duet, Have you measured its spindle Run Out yet mine is awful 70um, I'm trying to find a solution, I think the outers of the bearings are rotating and moving from the manufactured position resulting in the excessive radial run out, what do you think?

6
General Mach Discussion / Re: Mach3 and Boxford Duet
« on: September 05, 2007, 08:19:12 AM »
There is some work involved in getting the Duet running on Mach 3 but not that much, the steppers are controlled by the LPT port so can be linked to Mach with no problem but the spindle control is serial, I have managed to initialise and control the spindle of the Duet but the more complicated part is the tool changer and tool offsets, I am working on that now.

7
General Mach Discussion / Re: Serial Port control under cypress enable
« on: September 05, 2007, 08:11:30 AM »
Hi
Thanks for that I've been on holiday for a week (Spain in the SUN compared to the rainy UK it's been bliss)

I tried the code but I only have the inbuilt cypress enable VB scripter and this code does not work with it.

I have had some sucess and have now moved on to the tool changer "if anyone wants the code for the serial give us a shout" the peculiarity of the boxford tool changer is that tools are changed using X and Y , I need to first detect which tool is pesently in use ie GetCurrentTool(), GetSelectedTool() and SetCurrentTool() then this determines which direction to goto the safe zone then the tool holder has to goto the front or back depending on which tool is to be selected, one of the problems is that the tool offset has a Y component, so I need to add a Y position indicator to Mach turn. as usual any ideas greatfully received.

8
General Mach Discussion / Re: Mach3 and Boxford Duet
« on: September 05, 2007, 07:40:56 AM »
Hi
Do a search on "serial" you will see we are trying to control a boford Duet with Mach 3

9
General Mach Discussion / Re: Serial Port control under cypress enable
« on: August 25, 2007, 06:23:23 AM »
Hi
Thanks for that I will not be using Modbus so I have a dedicated serial port to the Boxford, I will be looking for anything that helps

The general idea is :-

1) start Mach
2) load G code file

The G code File then includes

3) Initialise Boxford Macro ( this is the one we are talking about)
4) Send speed control to Boxford (next TODO list )
5) Get gaurd information/ speed ( continually)
5) run G code
 
The initialise_boxford part of the macro is run only once at the beginning of work( does not need to be sent again unless the machine is switched off/on), if the boxford is already initialised then it will be programmed not to do it again, I do intend however to have this macro home the axis and basically set the machine up, the Guard  postion is also found ( closed / open) and dependant on this I can run the rest of the G code or not, it would be nice however for a gaurd open to control a stop, this means having a serial reception running all the time, I have run out of inputs in mach so I can't use hardware.

The Boxford speed control is also set by serial commands these I will attach to the relevant macro, the spindle speed is reported back by serial @ once a second but as I have already interfaced the spindle read to Mach so it is not that important.

I have the initialise script written, however this does not yet check that the initialisation has already been done, I dropped the messages as they pop up even before the macro is run?

*****************************************************************************************

Sub intialise_boxford() ' Boxford Duet1 9600 8 data 1 stop even parity

'******************************** file send routine *****************************
message "Initialising Boxford"
Open "c:\mach3\duet.dat" For Input As #1 ' 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
message "Boxford Initialised"
playwave "c:\tada.wav"
Close #1 ' Close file.
'***********************************************************************************
End Sub


**** The read macro looks at the momment like this it's saving to a file so I can see the results


***************************************************************
' This works and reads just the available serial byte received

Open "c:\mach3\Dout.dat" For Output As #1 ' Open file.

For i = 1 To 10000
If (getportbyte(1021) And 1) <> 0 Then ' receive status register
inbyte = getportbyte(1016)
Print #1,inbyte
End If
Next i

*************************************************************

Thanks Again


10
General Mach Discussion / Re: Serial Port control under cypress enable
« on: August 24, 2007, 12:48:35 PM »
Hi
the file is a simple text file containing the microcode for the Boxford Duet the program simple reads it out byte by byte.

The Boxford duet requires that a file is sent to the machine to initialise it, it is more than usefull to do this within the Mach environment as I wish to fuilly integrate the Duet and it works!, on the subject of serial reads the macro may or may not be able to be understood  by Mach but I believe the macro can understand Mach variables and that is all I need as the duet also sends details of gaurd positon, I need to receive one or two bytes just to confirm that the gaurd is in place I am sure I can poke a few bits to acheive this. I have only just within thae last few days started programing with the Macros so I need ideas of what can be acheived. Is the macro multitasking in its own thread?


Cheers

Pages: 1 2 »