Hello Guest it is March 28, 2024, 03:57:20 PM

Author Topic: Data Acquisition via Mach  (Read 4606 times)

0 Members and 1 Guest are viewing this topic.

Offline c30232

*
  •  122 122
    • View Profile
Data Acquisition via Mach
« on: November 25, 2014, 12:15:19 PM »
I would like to capture the machine coordinate DRO data/value and send/store it for later use in Excel.  Any ideas on how this can be done?  The primary function would be to acquire the X DR0 reading upon the closing/opening of a limit switch.  X would be stationary at the time of capture.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Data Acquisition via Mach
« Reply #1 on: November 25, 2014, 05:59:20 PM »
IN the macropump you can monitor the LimitLED and IF it goes active then WRITE the Xdro to a file then save the file. It can all be done in Mach3 CB scripting.

Also instead of the limit switch you can use ANY input method to trigger the write/store.

Just a thought, (;-) TP

Offline c30232

*
  •  122 122
    • View Profile
Re: Data Acquisition via Mach
« Reply #2 on: November 25, 2014, 06:43:59 PM »
Thanks,

Before I delve into the process, can you tell me what format the file will be stored in?  And is the process suitable for multiple acquisitions such as 500 to 1,000 per shift.  That is, does it save to a continuing single file or will we see 1 file for each acquisition thus 1,000 individual files? 

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Data Acquisition via Mach
« Reply #3 on: November 25, 2014, 07:01:02 PM »
All that is going to depend on how YOU want it to write the file.  You format the file writing

It can process 100's of file write's in just a few seconds.

You can have it write individual files or LINES of 1 file .

(;-) TP

Offline c30232

*
  •  122 122
    • View Profile
Re: Data Acquisition via Mach
« Reply #4 on: November 25, 2014, 07:03:01 PM »
Thanks,

Offline c30232

*
  •  122 122
    • View Profile
Re: Data Acquisition via Mach
« Reply #5 on: November 26, 2014, 01:22:45 PM »
TP,

Would you please give a bit of a trail-head for the process.  Perhaps a reference to the manual section.  I think I can figure the script for capture and write, but I am somewhat lost on a location to write the data to.

Thanks.   

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Data Acquisition via Mach
« Reply #6 on: November 26, 2014, 09:35:53 PM »
This is a sample script that looks at an input and IF the condition exists it writes a new line of XY axis data to  a simple comma delimited file. Each time it goes active it adds a new line of data to the file.

Using it in a macropump the code will run 10 times per sec. So you need to add an interlock to prevent writing one than 1 time per occurance of the limit trip. Then when the limit resets it realeases the interlock to write.

If GetOemLED(28) = false Then   ' Look for X limt to be inactive for testing code
                            ' Normally this would = true
                                                               
DataX = GetDro(0)    ' X axis position    'Gather Axis Data
DataY = GetDro(1)    ' Y axis position


Open "c:\Mach3\TestLog.txt" For Append  As #1    'Write axis data to file
Print #1,"" &DataX  &" , " &DataY
Close #1
end if

(;-) Tested and working correctly, (;-) TP

Offline c30232

*
  •  122 122
    • View Profile
Re: Data Acquisition via Mach
« Reply #7 on: November 26, 2014, 09:43:46 PM »
Thank you!

I did find the Mach customizing manual today.  Also, I have been reading up on VBS all afternoon.

Thanks again for your help . . . without it and the help of others here I would still be looking for the start button.



   

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Data Acquisition via Mach
« Reply #8 on: November 26, 2014, 09:50:31 PM »
Remember Mach3 runs in CB(Cypress Basic) not VB.

There is a Mach3 CB specific programmers manual AND a Mach3 programmer guide that covers most of the mach3 scripting language

(;-) TP

Offline c30232

*
  •  122 122
    • View Profile
Re: Data Acquisition via Mach
« Reply #9 on: November 26, 2014, 09:51:12 PM »
Here is a snap of the screen to show what we are doing.  So far it works well.  The data capture will allow tracking of side-bend in the raw material.