Hello Guest it is March 28, 2024, 04:13:44 AM

Author Topic: Display Spindle Temperature on Mach3 ??  (Read 6273 times)

0 Members and 1 Guest are viewing this topic.

Display Spindle Temperature on Mach3 ??
« on: May 17, 2010, 12:41:05 PM »
I have a USB temperature probe, which writes the temperature to a textfile every 10 seconds.

I want Mach3 to:
1)  read the temperature from the textfile and display it in a DRO every 10 seconds.
2) estop if the temperature exceeds some setpoint.


Any ideas how to do this?    I'm fluent in vbscripts.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Display Spindle Temperature on Mach3 ??
« Reply #1 on: May 17, 2010, 02:02:41 PM »
Afraid I am the exact opposite to you regards VB but if you can read this text file then all you would need to do is write the VB  in the macropump and if it sees the high temp do the E-Stop.


Hood

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Display Spindle Temperature on Mach3 ??
« Reply #2 on: May 19, 2010, 09:34:10 PM »
Just an idea but from past experiements trying to do a timed loop in VB may tie up a lot of CPU time.

An option would be set up a Brain to do a 10 sec timout loop  and set a UserLed on. Then when the simple VB script sees the Led go active THEN it reads the last line of the text file into a variable and then VB can do the compare and act on it.

What does each line of the text file look like?

Just a thought

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Display Spindle Temperature on Mach3 ??
« Reply #3 on: May 30, 2010, 04:26:45 AM »
Put this in your macropump, modify the path to where it dumps your USB txt file. Also the script below will only
read and post the FIRST line of data in that file, so make sure each time it updates you file, it only puts the data
in the first line, overwritting any old data there. I used UserDRO 2000 but you can use what ever, just change it.
it ASSUMES that the ONLY thing on that first line is DIGITS!! any none digits will throw an error.

Open "C:\User\MyAccount\Desktop\UsbSpindleTemp.txt" For Input As #1   ' Open to read file.
Line Input #1, FileData                  ' Read the first line of data.
SetUserDRO(2000, FileData)        'Puts the temp as digits from the 1st line of your txt file.
Close #1

'scott
fun times

Offline Zaae

*
  •  120 120
    • View Profile
Re: Display Spindle Temperature on Mach3 ??
« Reply #4 on: May 31, 2010, 08:00:45 PM »
If you don't require up to the millisecond data, It might be a good idea to use a timer in your macropump script (not a loop) so it only does that file read every few seconds. Otherwise it will be reading that file as fast as it possibly can. Just a thought.

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Display Spindle Temperature on Mach3 ??
« Reply #5 on: June 02, 2010, 03:25:22 AM »
Zaaephod,

    has a good point, but it might be easier to do a counter in the macropump, that when it loops through and counts up to 5 (1/2 second), or 10 (one second), it does the read, then resets the counter to Zero, then you dont have the overhead of a VB timer in your macropump, as well.

scott
fun times

Offline Zaae

*
  •  120 120
    • View Profile
Re: Display Spindle Temperature on Mach3 ??
« Reply #6 on: June 02, 2010, 10:11:36 AM »
poppabear,

I considered the same, but I wasn't sure if a macropump ran at a set interval, or if it was dependent on CPU speed for its cycle time. I presume by what you said that the macropump, by default, runs at 1/10 second intervals? Is there any way to change the interval for it? If so, I might just change some of my macropump code.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Display Spindle Temperature on Mach3 ??
« Reply #7 on: June 02, 2010, 10:26:28 AM »
it would be best to set up the timer in a brain to set an led. Sometimes trying to do a timer loop in the macropump causes problems with CPU hogging.

Set the brain to set an LED /on. Then when the macropump sees the LED/ON then do" code whatever" AND set the LED to OFF.

Just a thought