LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

non printable characters

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

0 Kudos
Message 1 of 6
(4,020 Views)

It's not clear to me which is your development environment, since you are posting in the CVI board and speaking of LabVIEW... Smiley Wink

 

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:

 

Message Edited by Roberto Bozzolo on 02-02-2009 11:53 PM


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 6
(4,009 Views)

 

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 

0 Kudos
Message 3 of 6
(3,995 Views)

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

0 Kudos
Message 4 of 6
(3,993 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 6
(3,990 Views)

Thank you very much fo your help

 

I will try and then I will give news

 

Thanks for your attention

0 Kudos
Message 6 of 6
(3,988 Views)