Hello Guest it is April 23, 2024, 06:19:53 AM

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 - cjmerlin

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 »
171
Macros / Using the serial port for a toolchanger macro
« on: November 05, 2006, 03:24:05 PM »
Hi to all,

 Wow, the first to post a macro here.

I've been planning to update the way Mach3 sends signals to the toolchanger and decided on the serial port as the best option.

I'm using an 8051 microcontroller and have just finished the routines
and using the programmed micro, Try to get Mach3 to talk to it.

Using the info gathered from the forum, another thanks to Dave Murray's post for providing some of the code I have create this macro which shows how to use sendfifo () and getfifoentry () to communicate with a micro.


It features a simple handshaking to and from the micro and will display errors with the communication in Mach's message window.

All the code has been produced with helpful explaination

Mach3 now talks to the microcontroller and so the next job is to integrate the micro into some electronics and connect to my toolchanger. It'll be a while then!


All the usual diclaimers, This macro is intended to help you understand how to write your own macro for your machine.
Or you can alter this one if it suits your purpose.



cheers
John




'****************************************************************************
'Intellectual property of John Pearson (aka cjmerlin) created on 5th Nov 2006
'****************************************************************************

'This macro was designed for an 8051 microcontroller connected to a Denford Orac Toolchanger but can be
'used with any suitably programmed microcontroller.
'It uses a simple form of handshaking with the micro in the form of a carriage return value sent to, and received
'from the micro.

'it also has Error coding to get out of routine loops, which displays in the Mach message box

'First thing to do to enable Mach to talk and receive input from a micro is to click on 'config/ports & pins'
' and select event driven serial control.
'Next go to 'config/serial monitor' and configure the port,baud rate and click parity = none checkbox
'Click 'reconnect/save changes' button and then restart Mach.

'You should now be able to use this macro if your micro has been programmed to send and recieve the values below.
'Note to make them easier to see, all microcontroller values are in hexadecimal and start with '&H'


tool = GetSelectedTool()

ToolCommand = &H1E     'Tells microcontroller the job is tool change
JobDone = &HB6         'Micro sends this value when the job is done
CReturn = &H0D         'Value of carriage return in Hexadecimal


Sendval = 3           'Number of tries to send command before producing an error
RecVal = 10           'Number of time to wait for receive handshake value from micro before producing an error.


Select Case tool

Case 1
ToolN = &H1           'Tool value sent to microcontroller
Case 2
ToolN = &H2
Case 3
ToolN = &H3

Case 4

Case 5

End Select

message "Changing To Tool " & tool
 

'============================== Send Command and recieve return chr ===============================
Do
q =q +1
If GetInf = Chr(CReturn) Then Exit Do                  'if micro returned chr "1" ,job done exit loop to next routine

 
 For count = 1 To 5
 x = getfifoentry()                               'Flush buffer, Rule of thumb is to flush once per chr recieved during job.
 Next                                             'If Mach misses a carriage return it wont pickup what was sent
                                                  'and will add it to the next string of chr's sent causing errors

Call sendfifo (Chr(ToolCommand) & Chr(ToolN) & Chr(CReturn))   'send 3 chr's 'Tool Command,Tool Number,carriage return or something

 For t = 1 To 5                                  'Read buffer 5 times before sending command again
   GetInf = getfifoentry()                        'get buffer return chr
   If GetInf <> "None" Then Exit For              'if chr returned then exit
   SetTimer( 1 )
   While GetTimer(1) < 0.05                        'wait approx 0.5 seconds, this value works for me
   Wend
 Next t

Loop Until q= SendVal

If q = SendVal Then
Message "Sending Tool Command Error"
Exit Sub
End If

'====================================================================================================


'****************************** Waiting for Tool selected signal from micro **************************

 Mrec = "none"
 Do
    q= q+1
  If q = RecVal Then                    'Gets us out of the loop after 10 tries and produces an error.
    Message "Receive Error"
    Exit Sub
  End If           
 
    SetTimer( 1 )
  While GetTimer(1) < 0.05              'Wait
  Wend
    Mrec = getfifoentry()               'get return chr
    'message Mrec
Loop Until Mrec <> "None"

If Mrec = Chr(JobDone)  Then            'If returned chr correct then job done
message "Tool " & tool & " Selected"
SetCurrentTool(tool)

Else
Message "Tool Change Error"
End If
       


172
Tangent Corner / Re: Denford Orac problem
« on: September 20, 2006, 05:27:13 PM »
Hi Dave, Sorry for the long time between posts. Great comment, This was the last thing I thought of, I reduced the lookahead buffer which reduced the delay a little but still having the problem.

I finally got my cpu and heatsink for the upgrade.  The problem upgrading began with the size of the computer. It's a small form factor desktop Compaq EN which resides in the box space under the lathe and because it fits so nicely I would have had problems to find a newer computer to fit. I decided to upgrade the existing 733Mhz processor, relying on Ebay and alot of info hunting I found I could upgrade to 1400Mhz Tualatin cpu providing I had a converter socket for the differing voltages.

Well I ended up buying a 1266Mhz chip, big difference pricewise £20 or £60 for the 1400. Waited for the converter to arrive from Hong Kong and planned what I'd be doing before everything arrived, I'll upgrade the bios before doing anything else to it.

The next problem once the bits arrived was finding that once all the parts were assembled the heatsink was a tad too tall as the hard drive has to fold back down over the cpu to get the lid back on.

I trimmed the heatsink with the trusty linisher and mounted the fan on the side. I crossed fingers and switched on, Success! Booted first time and once convinced the heatsink was doing it's job I fitted the machine back into the Orac.

Once into Mach3 I took advantage of the highest kernel setting without a crash and setup a program to run.

I found immediately that the 'end chatter' problem I had miraculously disappeared completely and the delay between G1 then a G0 command is hardly noticeable.

I guess the moral of this is,
Just because you can load Mach3 on a slower computer than recommended, It isn't necessarily a good thing!


Many thanks for all your advice and I hope this post will be helpful to others

Kind Regards
John

173
Tangent Corner / Re: Denford Orac problem
« on: September 06, 2006, 02:38:05 PM »
Hi again, I have had a good idea, I have spent all afternoon configuring a copy of TurboCnC to work on the machine and I've run the same g-code. I have no problems at all with TurboCnC running, in fact I would say the machine is a lot smoother and quicker with no waiting between commands. Running in a Dos environment has some benefits.


So now I have the answer. Is it a Mach3 configuration problem or Mach3 itself or because I'm running a 733mhz computer. By the way I have no other software running other than Mach3 on Win 2000.


Cheers
John

174
Tangent Corner / Re: Denford Orac problem
« on: September 06, 2006, 11:03:41 AM »
Hi Dave, I'm running mach3 at 25khz. I've tried 35-45khz but that just crashes the computer. 

I can't find the 'time in int' value you mentioned but the step pulse is set to 0 in motor tuning. I'm using Gecko's for the drives.

I can understand what your friend was saying, I'm still guessing it's the speed of the computer. The tip I was using in the video was 0.4mm radius TPUN type and the material is stainless 5/8" bar, I've tried altering speeds and feeds from 700rpm to 1200 rpm and all the tools I've used including an HSS one I ground myself make the same chatter at the end of the cut. I say chatter, It's more like vibration like the tool is rubbing that ends up as chatter. Noticing that there is an obvious visual delay between commands whereas my Boxford with it's original hardware/software will run the same program with no discernable delay at all has led me to assume that this is where the problem lies. The tool is sitting there rubbing the stock until the next command is executed.


Because my computer is a Compaq in order to upgrade I have to buy an adapter from China to fit the later processors.

I'm hoping this will cure the problem.


Cheers

John


175
Tangent Corner / Re: Denford Orac problem
« on: September 06, 2006, 06:26:45 AM »
Hi David, I've started new topic in the main Mach3 forum as I think my problem is with the software/computer rather than the machine. The chatter only occurs at the end of a cut, The machining is actually very good until the end. This is happenning with all tools I've tried. Changing the chuck has reduced it from vibing the whole machine.

I have noticed that at the end of the cut when I command a G0 rapid off (about 0.5mm) just to clear tool, The machine just sits there for about 1 second before moving.

I have changed the G0 rapid to a G1 instead and this has reduced the problem by about 50%. Now it is at a level which doesn't offend my ears.

I presume that the delay I am experiencing is not due to software but my computer which is only a 733mhz.

I'm hoping to upgrade it to 1.2-1.4ghz and hope this sorts my problem.


Cheers


John

176
General Mach Discussion / Delay between commands
« on: September 04, 2006, 06:57:34 PM »


Hi, A couple of questions for the software guys, I've been having

problems with chatter on the end of a cut (see Tangent Corner-

Denford Orac problem)  Since renewing the chuck and trying different

things to solve the problem I have come to realise that there is a

delay when going from a G1 command to a G0 command.

After I have taken a cut and need to back up the tool a bit to rapid

back to take the next cut, the tool just sits there for a bit causing

the tool to rub on the work.

I have changed my G-code listing so that the  G0 rapid off after feed

cut to G1 and there is less of a wait before the next movement.


This has reduced the chatter problem 50%

I'm guessing that this may be due to using a 800mhz computer.


My question is, will increasing processor speed reduce the delay

between commands (G0 AND G1 etc:) and also will increasing the Kernel

speed help.   ???




Many Thanks

177
Tangent Corner / Re: Denford Orac problem
« on: September 02, 2006, 02:37:29 PM »
Hi, I've tried several speeds and feeds, the current program is below.


Headstock bearings? I've thought of that and tightened the end nut as tight as I could, I lost 200 rpm off top speed and It made no difference to the problem. I've since loosened it off one tab notch although the top of the headstock still gets warm pretty quick. I have tryed checking for radial play, cant perceive any.

I have listened to the spindle at 1000 rpm taken the front cover off the headstock to reveal the bearings and I can hear this sound (www.jtechdesign.co.uk/orac/SPINUN.wav)

You can just hear the races jingling in the background, I don't know if this is an indication of wear or not.


I've taken backlash off totally today and it made a slight difference to the delay.


I had been working in dead stop mode and changed to con-velocity and this has made no difference.


I'm working in stainless steel but I've also put the same diameter 5/8" in free cutting steel and although it's less pronounced I still get the same effect.




Cheers for the reply.

John





part code
--------------------

G18 G90 G94 G80

M09
M06 t0101
G0 Z0.00
M08
M03 S1100


G0 X17.6 Z0.8
F200
G0 X15.6
G1 Z-34.9
G0 X17.2 Z-34.2
G0 Z0.8
G0 X15.2
G1 Z-34.9
G0 X16.8 Z-34.2
G0 Z0.8
G0 X14.8
G1 Z-34.9
G0 X16.4 Z-34.2
G0 Z0.8
G0 X14.4
G1 Z-34.9
G0 X16 Z-34.2
G0 Z0.8
G0 X14
G1 Z-34.9
G0 X15.6 Z-34.2
G0 Z0.8
G0 X13.6
G1 Z-34.9
G0 X15.2 Z-34.2
G0 Z0.8
G0 X13.2
G1 Z-34.9
G0 X14.8 Z-34.2
G0 Z0.8
G0 X12.8
G1 Z-34.9
G0 X14.4 Z-34.2
G0 Z0.8
G0 X12.4
G1 Z-34.9
G0 X14 Z-34.2
G0 Z0.8
G0 X12
G1 Z-34.9
G0 X13.6 Z-34.2
G0 Z0.8
G0 X11.6
G1 Z-34.8974
G0 X13.2 Z-34.0974
G0 Z0.8
G0 X11.2
G1 Z-34.8762
G0 X12.8 Z-34.0762
G0 Z0.8
G0 X10.8
G1 Z-34.833
G0 X12.4 Z-34.033
G0 Z0.8
G0 X10.4
G1 Z-34.7664
G0 X12 Z-33.9664
G0 Z0.8


178
Tangent Corner / Re: Denford Orac problem
« on: September 02, 2006, 12:31:25 PM »

Hi, Well I got the chuck and after a few problems I fitted it, It has reduced my vibration problem about 50%. Now the vibration is just the tool and not the whole machine.

I have made a video which is about 10 meg and can be downloaded here, www.jtechdesign.co.uk/orac/lathe3.mpg
Please note the video and sound my not match exactly as I had to do them separately.

I've used different tools at different heights to the center and they all do the same to a lesser or greater degree, The only difference since I changed the chuck is the shoulder of the piece shows no chatter marks and looks well turned.

I'm starting to think that it may be something other than the machine it's self.

I have noticed that there is a delay before the retract from the cut allowing at least 5-10 revs of the spindle before retracting.

On my Boxford it retracts off the cut immediately

I'm wondering if, because the tool is just sitting there, it is just rubbing on the radius of the tool nose.

Why is there a delay between commands, I'm turning only using G1 and G0 commands.

Could it be that I'm using a 800mhz computer and it's just not quick enough?



Any idea's are welcome as I am almost at whits end.


Kind Regards
John

179
Tangent Corner / Re: Denford Orac problem
« on: August 25, 2006, 05:29:55 AM »
Hi David, Leaving the stepper pulsing away while stalled will drive you mad after a while. The one on my Boxford uses a stepper and when it reverses back onto the stop it still pulses for a second or so creating a very loud buzz that vibrates through the whole machine.
The ideal situation would be to use a small microcontroller to do the job and connect to the serial port leaving more printer port pins available.

Other than that you could use a couple of 555 timers, one to provide the pulses and use the position sensing gear already in the toolchanger and then another activated when you toggle the direction line to give say a 3 second reverse onto the stop. A powermax ll stepper with 2 amps per phase on a L297-298 setup driving the worm gear direct would be ideal.


Same about the power chuck, I've seen similar on ebay and wondered why anyone would want to use a power chuck if you cant run a bar through it.

Kind Regards
John

180
Tangent Corner / Re: Denford Orac problem
« on: August 24, 2006, 02:38:42 PM »
Hi David, I'm planning to use the old back plate as it has plenty of thickness, just machine off the old location step and turn a new one. I have made a tool that fits in the tool changer and has enough reach to do the job.

I've over hauled the tool changer completely. Well, tightned everything up and adjusted the bearings. I'd like to sort a better motor as the toolchange is dog slow. I thought it might be better using a stepper motor like the Boxford toolchanger.

You dont happen to still have the power chuck do you?

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 »