I am using a PMAC turbo without DPR. A HMI written in VB.NET is used to setup various recipes parameters and also to collect cycle data. I have setup Data Gathering to collect position and following errors along the cycle. It is all working fine as shown on the cycle plot attached.
The problem I am having is to add gathering for an analog input value that is defined as
[color=#FF0000][b]M105->Y:$78005,12,12,S (only 12 bits)[/b][/color]
I use the following routines from PcommServer:
PcommServer.SetGather(_deviceNumber, 16, "Y:$78005", True, bStatus)
Once the HMI is notified that data is avaialble I get the data as follows:
PcommServer.CollectGatherData(_deviceNumber, iNumSources, iNumSamples, bPmacStatus)
iUpperBound = iNumSamples - 1
ReDim AnalogInput1(iUpperBound)
PcommServer.GetGatherSamples(_deviceNumber, 16, AnalogInput1, bStatus)
AnalogInput1 is defined as a Double in VB which is 8 bytes.
The question is::
How do I unpack the value being returned by GetGatherSamples – AnalogInput1 which is 8 bytes.
I have tried all sorts of masks but I am not getting the correct value (If I just poll the M105 values with calls to GetResponseEx I get the correct values so I know the input is good.
I must be doing something wrong with my mask. The latest I have tried is:
Ai1(iSample) = AnalogInput1(iSample) And &HFFFFFF (get the lower 3 bytes)
Thanks