Hello Guest it is March 28, 2024, 05:55:30 PM

Author Topic: floating point information  (Read 896 times)

0 Members and 1 Guest are viewing this topic.

Offline Bill_O

*
  •  563 563
    • View Profile
floating point information
« 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
Re: floating point information
« Reply #1 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
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Bill_O

*
  •  563 563
    • View Profile
Re: floating point information
« Reply #2 on: June 04, 2019, 03:35:31 PM »
Craig,

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

Bill
Re: floating point information
« Reply #3 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?

Offline Bill_O

*
  •  563 563
    • View Profile
Re: floating point information
« Reply #4 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.