02-02-2009 11:12 AM
Hello
I have to comunicate via serial port to aa analyzer and it uses a funny way to communicate.
Thus, I have to send a string with several characters, which, some of them, are not printable
I have seen some posts to this type of problem and I think that if I use ~and then the decimal number corresponding to the character, I can manage
However, the question is:
What if I need to send only one string with several non-printable characters? is there a simple way to write them all together?
I am trying to convert the following string from Visual Basic to Labview
Chr(224)&chr(87)&chr(10)..., etc
Thanks for the help
02-02-2009 04:53 PM - edited 02-02-2009 04:53 PM
It's not clear to me which is your development environment, since you are posting in the CVI board and speaking of LabVIEW...
If programming in CVI you could simply fill the elements of a char array for example with
array[0] = 224;
array[1] = 87;
array[2] = 10;
or with
sprintf (array, "%c%c%c", 224, 87, 10);
In case some of the characters to write is a null character, is mandatory to pass to ComWrt the exact number of bytes to write to the port avoiding the use of strlen () operator which will terminate counting on the first null character found.
A similar method can be used inLabVIEW:
02-03-2009 04:30 AM
Hello
Firstly, I would like to thank for your reply. I forgot to tell that I'm starting on labview and on this forum, so please, go easy with me...
One question: What is CVI??
I am programing in Labview and I will try to use your solution
Once again thanks for the help
02-03-2009 04:38 AM
Hello again
I'm sorry, but could you please tell me the name of the commands you used to join the characters and then transform them into a string?
I'm using labview 8.5 and I can't find them...
Thank you
02-03-2009 04:57 AM
First of all, CVI is an acronym for " 'C' for Virtual Instrumentation ": it's the Ansi-C programming environment developed by NI, and this board is dedicated to this environment and its users. You will find a few users of LabVIEW here, but the best location were to post your questions is the LabVIEW forum .
Coming to the blocks used, the first one is Build Array in the Array palette: it permits you to accumulate several items in an array of data. Since your destination is a string, I suggest you to choose as numeric representation for the constant valuesU8 format. After this block there's Byte Array To String, located in String > Conversion palette. These blocks are fully described in the online help were you will find several additional informations on them. Looking at the supplied examples can also help you in understanding their usage.
02-03-2009 05:01 AM
Thank you very much fo your help
I will try and then I will give news
Thanks for your attention