Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Bill_O on June 03, 2019, 04:31:22 PM

Title: floating point information
Post by: Bill_O on June 03, 2019, 04:31:22 PM
I am currently using Mach3.
I have a camera that is used to find some fiducials and send some data letting me know how far of center they are.
The camera only sends floating point data and that does not work in Mach3.
So as of right now I bring the information into a Red Lion Data Station to send out fixed point information to Mach3.
My question is does Mach4 accept floating point data?

Thanks,
Bill
Title: Re: floating point information
Post by: joeaverage on June 04, 2019, 03:48:39 AM
Hi,
I think its possible.

What I have done is create a register that has a floating point value. I have a short macro to read the value and then
covert it to a string to display in a message box. Note that the displayed value is correct and that indicates that Machs
core correctly read and interpreted the float value.

Code: [Select]
function m115()
local inst=mc.mcGetInstance()
local hreg=mc.mcRegGetHandle(inst,'iRegs0/floatTrialReg')
local value=mc.mcRegGetValue(hreg)
wx.wxMessageBox(tostring(value))

end
if (mc.mcInEditor()==1)then
m115()
end

Craig
Title: Re: floating point information
Post by: Bill_O on June 04, 2019, 03:35:31 PM
Craig,

Thanks.
Now i will need to buy the expensive a$$ camera and test it.

Bill
Title: Re: floating point information
Post by: Ya-Nvr-No on June 04, 2019, 06:10:00 PM
How do you go about sending the float from the camera to a register so you can read it? Reading and writing from within Mach4 or an attached PLC is easy enough just not sure how a generic device can send and read to a predefined register. Only thing I can think of is reading an analog signal and sending that to the reg. That makes me wonder also, will it be real time data?
Title: Re: floating point information
Post by: Bill_O on June 05, 2019, 08:18:48 AM
I move to the point where the fiducial is supposed to be.
I then have a custom m code which gets the information from the camera.