BLUF: I am getting Error 74: Unflatten From String: Memory or data structure corrupt. after trying to unflatten a string from VISA read.
Here is what I am doing. I have several data types in a message that I am flattening to a string and then writing to a serial port using VISA. I am using a loopback connector on my serial port to then read what I wrote using VISA read. I am able to read the message in binary, but I would like to unflatten the string and unbundle all of the data types and display each to test my serial transmission. The problem is that I am getting the error mentioned in my BLUF above when trying to do this. Does anyone know how to correct this issue?
I am not sure what you are asking for. I always get ERROR 74 when I try to run the VI. I am wiring the Type connector on the Unflattened From String directly to my cluster of elements that I send to the Serial Write VI.
please provide a VI containing a string with data set to default and your conversion…
To say it the other way: when everything is set correctly the conversion will work without errors. As you get errors you (probably) did something wrong! But without any data/examples/VI we cannot check the source of the problem!
I attached an example of what I am trying to do. This a simplified version of a portion of my code that is giving me problems. The unflatten from string is what is giving me errors. Any help would be appreciated. Thank you.
your VI doesn't contain any string with some value set to default - as I asked for…
But what I can say from your VI: using BytesAtPort is wrong for (atleast) 99% of all use cases! You need to make sure you read enough bytes so yoou can parse your string into the cluster you want it to be!
So again I ask you to provide an example VI with a string containing data you have received from your serial port, which gives errors in unflattening!
And while you're working on this: remove BytesAtPort from your VI. Either use a TermChar (which might be problematic with your binary data) or send/receive messages of known length!
Compare 2 strings GerdW is asking for. (1 - sent, 2 - received). They should be _identical_. If not, conversion will fail.
Untill you receive identical strings, do not blame unflatten.vi
Check what is different between these 2 strings.
Different size, incomplete string?
Some bit order in your data makes LineFeed byte and transmission stops?