01-20-2010 12:28 AM
Hello all,
I have an application in which I have both a main VI and a configuration VI. The latter configures how the the front panel will look as well as how the data acquisition system (that is driven by the main VI) will operate. In the configuration VI, the user selects the channels as well as the appropriate description of the channel (which is contained in a cluster of enums, booleans and numerics). I am able to write the description of each channel into the DAQmx channel description property as a string (example below) and then read the string back and reformat as some type of delimited string in which I understand the structure and can decode it appropriately using various string functions (such as the string tokenizer, string to numeric, etc). I thought that I would get a little bit more clever about this and simply flatten the clusters to string and write these binary strings to the description. However, when I read these back from the description, I get error 74 - memory or data structure corrupt. Has anyone tried something like this before? Is there a better way of doing this? What might I be doing wrong? Any help is appreciated. Peace, Matt
Solved! Go to Solution.
01-20-2010 07:34 PM
Hi Matt,
DAQmx string properties treat null characters as an end-of-string marker, so your strings are probably getting truncated. You will have to encode the data in a format that does not contain embedded null characters. Base64 is one example of such a format, but there are many others that would work.
Here's a snippet that shows the truncation:
Brad
01-27-2010 02:35 PM
Thanks for the reply, Brad. Based on what I am seeing, that actually makes a lot of sense. However, I still don't understand the conversion to Base64 (computer science is not my first area of study). Simply for my edification, do you have a short example of this? I already decided that I would just stick to the string based way that I did it before.
Cheers, Matt
01-27-2010 02:58 PM
Hi Matt,
There are some LabVIEW VIs for Base64 encoding/decoding: http://decibel.ni.com/content/docs/DOC-5544
I haven't tried them, but I would expect that you could flatten to string, convert the binary string to a Base64 string, then set the Base64 string on the DAQmx Channel property node's Descr property. Retrieving the data would be the exact reverse.
Brad
01-27-2010 04:12 PM
Thanks, Brad. Probably would be overkill for this application, but it is nice to know they are out there.
Peace, Matt