From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 74 Unflattened From String for VISA Read

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?

0 Kudos
Message 1 of 16
(4,686 Views)

Hi Scaz,

 

check your string for completeness and correctness!

 

Otherwise give "good" and "bad" examples of your string conversion to let us check them…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 16
(4,677 Views)

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.

0 Kudos
Message 3 of 16
(4,672 Views)

Hi Scaz,

 

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 16
(4,669 Views)

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.

0 Kudos
Message 5 of 16
(4,640 Views)

Hi Scaz,

 

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 16
(4,634 Views)

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?

Etc...

0 Kudos
Message 7 of 16
(4,585 Views)

Maybe something like this would work better?


I'm using two ports and a null modem.

 

Unflatten String from Visa Read_BD.png

0 Kudos
Message 8 of 16
(4,575 Views)

What would be the best way to compare the sent and receive strings?

0 Kudos
Message 9 of 16
(4,472 Views)

The "Equals" function.

0 Kudos
Message 10 of 16
(4,445 Views)