LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Network Variable array to write data

Hi,

I'm trying to write a single dimension 32 element array (UInt16) to a network variable but I'm struggling to create the CNVData using CNVSetArrayDataValue().

Extract of code below which compiles but gives the runtime error -6352 Data handle is invalid. 

 

int status = 0;
unsigned int dump[DUMPSIZE];
unsigned long dim[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
CNVData data = 0;

for(int i=0;i<DUMPSIZE;i++)
dump[i] = DumpList[1].MemoryLocation[i];

// convert data to integer array
status = CNVSetArrayDataValue (data, CNVUInt16, dump, 1, dim);
// write data
status = CNVWrite (wtr, data, 35);
CNVDispose(data);

 

Anyone have an working example on how to use this function?

 

Mike

0 Kudos
Message 1 of 3
(1,094 Views)

Not sure whether this is the correct answer, but unsigned long is a 4-byte variable, so I would use CNVUInt32 data type.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(1,064 Views)

Hi,

Thanks for your reply, that may not have helped but I found out I was being a bit of an idiot and needed to use the function CNVCreateArrayDataValue.

 

It's been a while since I've used LabWindows, quite a pleasant change to write a bit of C after years of LabVIEW.

 

Mike

0 Kudos
Message 3 of 3
(1,047 Views)