02-23-2012 06:02 AM
Hello,
I am creating an Inline Hardware Interface custom device to communicate over serial bus in Veristand. As I only want to communicate values of veristand channels over RS232, I am using flatten/unflatten to string to transfer my data. I choose it because VISA Write/Read uses strings, and it would use always the same size of string (Veristand channels = 64 bits double => 8 characters string).
But when it comes to try it with veristand, I have the error 74 : Memory or data structure corrupt. I saw this error comes from the "unflatten from string" function.
So I wired a "clear errors" vi just after "unflatten to string" function, so that my custom device runs but gives me false results. Then I used the NI TO Trace tool to see what I was writing to the RS232 bus. You can find attached the result of this. When we take a look at the viWriteasync functions, we can see that the data written on the bus is already wrong "?..W...M" which is translated by 0,000232195, even if the value I transmitted to the bus was above 1.
I wired the constant "false" to "prepend array or string size" of the "flatten to string" and "unflattend to string" functions.
Does anybody have any idea of what is wrong ?
Regards,
Maxime
Solved! Go to Solution.
02-27-2012 03:03 AM
Hello MaximeD,
Welcome at National Instruments Discussion Forums.
Error 74 usualy happens when the input string of "Unflatten from String" function is not flattened. As it's mentionned in LabVIEW manual, this kind of format is obtained by using "Flatten to String" function.
Does-that solve your problem ?
Regards,
Mathieu P. | Certified LabVIEW Associate Developer
National Instruments France
02-27-2012 03:57 AM
Hello Mathieu,
Thank you for replying.
I am already using "Flatten to string" function when I write data to the RS232 bus, and I think the problem comes from this function when it is used in Veristand.
Maybe looking through my VI will help ?
Regards,
Maxime
02-27-2012 09:11 PM
02-29-2012 05:36 AM
Hello,
Thanks to your reply I realised the problem came from the termination character. I set it to the original value ('\n') and did not add any termination caracter to the string I sent.
Now I am using the null character as termination character which actually make things better instead of making things worse.
I also tried the other method (format doubles as text with specified precision) which is working perfectly ! But as you said it is less accurate and takes more bytes.
Thank you for your help.
Maxime
PS : As my problems are solved, I have a Serial Custom Device which is working (not perfect, but working), so should I post it somewhere ?