From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-30-2018 06:42 AM
Hi,everyone!
I am a beginner of LabVIEW and I am trying to setup an desktop digitizer that I bought from CAEN. The model number of the digitizer is DT5743. I have been able to use the digitizer in c and c++ successfully using the dll from CAEN. Now I want to implement the same code in LabVIEW(I am using the 2015 version).
I have used the “Import Shared Library” function to create VIs from the dll, and most of the vi that I have built are working fine. Only two have problems. They both use "void **". The function declarations of them are:
CAEN_DGTZ_AllocateEvent(int handle, void **Evt);
CAEN_DGTZ_DecodeEvent(int handle, char *evtPtr, void **Evt);
They are used for allocating memory for buffers to contain the events and Decode the event.
The only variable that can be at fault is the "void **" declaired Evt. The functions are hidden in the dll and only the prototypes are available in the h-file. And the structure of Evt is as follows:
CAEN_DGTZ_X743_EVENT_t *Event;
typedef struct
{
uint8_t GrPresent[8];
CAEN_DGTZ_X743_GROUP_t DataGroup[8];
}CAEN_DGTZ_X743_EVENT_t;
typedef struct
{
uint32_t ChSize;
float *DataChannel[2];
uint16_t TriggerCount[2];
uint16_t TimeCount[2];
uint8_t EventId;
uint16_t StartIndexCell;
uint64_t TDC;
float PosEdgeTimeStamp;
float NegEdgeTimeStamp;
uint16_t PeakIndex;
float Peak;
float Baseline;
float Charge;
} CAEN_DGTZ_X743_GROUP_t;
I have tried to set up the parameter as "C string Pointer" and "Adapt to type" but they didn't work, both of them have the error 1097.
So how can I calling void** in labview to use this two function successfully?
10-30-2018 07:27 AM
Any help would be greatly appreciated! (づ ̄3 ̄)づ╭❤~
Need help! (ㄒoㄒ)
10-30-2018 07:28 AM - edited 10-30-2018 07:31 AM
You'll need a handle (pointer to pointer) to a byte array with a sufficient amount of memory.
"Sufficient amount of memory" comes down to an array of bytes, with enough elements. Then when done cast\convert the data to the actual data type. The required number of elements can be calculated, as all array sizes are fixed. So simply add all array sizes * type size, and use that as input.
You can do the same with (correctly sized) strings, but bytes is usually a bit more intuitive.
EDIT: BTW: if the size is to big, it's no problem. To small is a problem. So to begin with, you can simply supply a 5000 byte array. If you see any values, you're in. Then, either trim the size or decode the result until you fully understand how it works.
10-30-2018 08:11 AM
Thanks for your advice! It seems that the decode function still has error in this way but I'll check it further with my partner later, thanks again!
10-30-2018 08:22 AM
@Wangky wrote:
Thanks for your advice! It seems that the decode function still has error in this way but I'll check it further with my partner later, thanks again!
Of course the array of u8's will not match the expected data directly. You'll need to do some fiddling. For I\U16s, you might need to swap bytes (little vs big endian). For I\U32s you might need to swap bytes and swap ints. Note that these functions also work on clusters and arrays.
11-04-2018 11:37 PM
Check the calling convention, make sure you have the correct convention in the call library node.
You may refer to this knowledgebase for more info.