Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: c30232 on November 25, 2014, 12:15:19 PM

Title: Data Acquisition via Mach
Post by: c30232 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.

Title: Re: Data Acquisition via Mach
Post by: BR549 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
Title: Re: Data Acquisition via Mach
Post by: c30232 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? 
Title: Re: Data Acquisition via Mach
Post by: BR549 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
Title: Re: Data Acquisition via Mach
Post by: c30232 on November 25, 2014, 07:03:01 PM
Thanks,

Title: Re: Data Acquisition via Mach
Post by: c30232 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.   
Title: Re: Data Acquisition via Mach
Post by: BR549 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

Title: Re: Data Acquisition via Mach
Post by: c30232 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.



   
Title: Re: Data Acquisition via Mach
Post by: BR549 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
Title: Re: Data Acquisition via Mach
Post by: c30232 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.    
Title: Re: Data Acquisition via Mach
Post by: c30232 on November 26, 2014, 10:06:09 PM
Thanks for the reminder.  The afternoon of study really helped with the concept.  The DRO data I am after today is the "fence", which is X in machine coordinates.  I may add a second capture of Y.  That would allow the material to be measured in width and tracked.