Hello Guest it is April 24, 2024, 06:43:00 AM

Author Topic: Tool changer routine with hot swap  (Read 34623 times)

0 Members and 1 Guest are viewing this topic.

Offline Graham Waterworth

*
  • *
  •  2,673 2,673
  • Yorkshire Dales, England
    • View Profile
Re: Tool changer routine with hot swap
« Reply #50 on: March 27, 2008, 05:22:02 AM »
was not thinking when I typed it in, Byte is a reserved word in VB, try it like this :-

Dim command As String
Dim oneByte As String
command="B000013E------"
For a=1 To Len(command)
  oneByte=Mid(command,a,1)
  putportbyte(Ox378,Asc(oneByte)) ' Ox378 is the address of your serial port
  For b=1 To 1000
  ' this is a delay loop, adjust to get your 9 ms delay
  Next
Next
End

Graham.
Without engineers the world stops

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Tool changer routine with hot swap
« Reply #51 on: March 27, 2008, 06:05:41 AM »
Sorry Ian, its a reply to VMAX about his Denford ATC, I need to create a new thread, should not have hijacked this one.

Graham.

Hi Graham - no problem - I did wonder if I'd missed some posts somewhere  ;D

HI IAN, Same subject but a different project(;-)

 We have a denford mill with a tool changer that is converted to MACH control. Now we have to interface the ATC (toolchanger) to mach. THe atc runs from a serial connection. We have captured all the control codes needed to run the ATC and can make the TC cycle by sending the codes through Hyperterm to the atc.

Question? How do we get VB to send the controls codes over the com port when needed?

Hi Terry - according to this your ATC is on your serial port (COM). To write to that I think you must use "sendserial" not "putportbyte" and set up the baud rate and handshake etc. on the Config page.

I think we all may be getting a little confused because the port address that Graham has given you (Hi again Graham) is the address of the default PARALLEL port. (PS - for 0x378 (C hex style) use &H378 (BASIC hex style))

Question Can I send a copy of the tool table to a printer port? Say LPT1
Your second requirement is indeed for the parallel port (well assuming your printer is on the parallel port). BUT, you can't just write raw data to the parallel port and have it come out on a printer. You either have to figure out all the particular manufacturers formatting/hanshaking codes OR of course more usually, you need to print via their driver which does all that for you. However - I'm not sure whether Mach can tolerate a printer driver to exist along side it's pulse engine - maybe on two separate LPTs it can - I don't know.

Cheers

Ian

vmax549

*
Re: Tool changer routine with hot swap
« Reply #52 on: March 27, 2008, 09:14:56 AM »
Hi Ian,            THe machine has 3 lpts, 2 for MACH and one for windows(;-)  SO far they have behaved ok but???

Well I gleamed a little more info last night on serial ports and mach. Seems the sendserial only works IF you have NOT set up the event serial control, and it is send only.

If the event control is active it it bidirectional and you use getfifo, sendfifo
The SendSerial command is used only for sending one way traffic.
> It cannot
>> recieve.
>> The GetFifo is used only in 2 way serial communication. This two-
> way mode is
>> selected by
>> config/ports&Pins and selecting "Event driven Serial mode" .
> Then , to send
>> you use
>>
>> SendFiFo( "This is what I want to send')
>> and recieve using GetFiFo()
>>
>> Do not use SendSerial if you want to get a return, only the
> event driven
>> serial is separate threaded
>> and available for realtime back and forth..
>>
>> Thanks,
>> Art

*****  NO wonder I could not get the monitor to run and use sendserial (;-)

Documentation is a wonderfull thing IF you have any(;-)

Hi Graham, I thought that is what you intended but was not sure, thought I would ask first.

(;-) TP

vmax549

*
Re: Tool changer routine with hot swap
« Reply #53 on: March 27, 2008, 09:35:49 AM »
HI Graham, I tried the new code and I now get a complie error on the port address. Yes I know what is in there is  an lpt address(;-)  I used the com1 setting of  03f8.   It errors on the F8 part. I did notice the the 03 portion changes color to magenta????

The timing loop works well, I like that one(;-) it is going into my bag of tricks.

(;-) TP

vmax549

*
Re: Tool changer routine with hot swap
« Reply #54 on: March 27, 2008, 10:02:28 AM »
Heck I cannot get any of the comport commands to show up on the serial monitor.

Sendserial does not work
SendFIFO does not work

Tried it on two computers one was the mill?????? the other my work station.

SO I don't know if the serial monitor can see it when in VB to test????? THe serial monitor DOES work to send test commands to the port that part works.

Beats ME. (;-)

(;-) TP

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Tool changer routine with hot swap
« Reply #55 on: March 27, 2008, 10:08:59 AM »
Hi Terry
Hi Ian, THe machine has 3 lpts, 2 for MACH and one for windows(;-) SO far they have behaved ok but???
Cool

Well I gleamed a little more info last night on serial ports and mach. Seems the sendserial only works IF you have NOT set up the event serial control, and it is send only.

If the event control is active it it bidirectional and you use getfifo, sendfifo
The SendSerial command is used only for sending one way traffic.
> It cannot
>> recieve.
>> The GetFifo is used only in 2 way serial communication. This two-
> way mode is
>> selected by
>> config/ports&Pins and selecting "Event driven Serial mode" .
> Then , to send
>> you use
>>
>> SendFiFo( "This is what I want to send')
>> and recieve using GetFiFo()
>>
>> Do not use SendSerial if you want to get a return, only the
> event driven
>> serial is separate threaded
>> and available for realtime back and forth..
>>
>> Thanks,
>> Art

***** NO wonder I could not get the monitor to run and use sendserial (;-)
Cool again

Documentation is a wonderfull thing IF you have any(;-)
LOL - after 20+ years in software engineering I've learned there are two things that are as rare as rocking horse sh*t - code commenting and documentation updating... and no (Brian) I'm not volunteering.

Hi Stirling I almost missed your question. AS part of this project I would like to send a copy of the tool table AND a copy of the current slots assignment to a printer from a mach button. BUT it seems that the MACH VB does not support printing to an lpt port,at least not that I can get to work. It errors with,  not a supported object or command.
How are you trying to do this - i.e. what command/routine is failing?

Ian

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Tool changer routine with hot swap
« Reply #56 on: March 27, 2008, 10:12:50 AM »
Hi Terry - with regard to your last question to Graham - you need to read my earlier reply about the format of hex strings in BASIC. The syntax is &H0378 or whatever address you're using. The &H is instead of Grahams 0x at the front of the string.

A word of caution which I hope isn't too late. You have to be VERY careful which port or address you write to - you can seriously screw up your system - even trash the hard disk if you're not careful.

Ian

vmax549

*
Re: Tool changer routine with hot swap
« Reply #57 on: March 27, 2008, 10:17:35 AM »
I tried all variants of

Printer.Print " test STRING"  , etc

I can gather the info and send it to a file in notepad!!!!   but not to a printer

I gues that part is NOT supported in MACH VB

(;-) TP

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Tool changer routine with hot swap
« Reply #58 on: March 27, 2008, 11:21:34 AM »
Yes, It seems that although the printer object itself is recognised, none of its methods or properties are available (I tried a few) - zippo. Hence your message of "object doesn't support this property or method". I think this is one for Brian perhaps. I'm sure he'll be delighted. ;D

vmax549

*
Re: Tool changer routine with hot swap
« Reply #59 on: March 27, 2008, 11:56:04 AM »
YEP that is the funny part of mach I can always get within 1/64" of finishing a mile run in mach but just can;t seem to cross the finishline,  because of mach limitations.

OH well, (;-)  TP