LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using C++ in CINs

I have some C++ code to read in a string of no more than 40 characters (including spaces, for example "TURN ON MOTOR") which, depending on the string, will output a decimal value.

I would like to know how to configure the CIN to use 'string control' as the input and 'decimal value' as the output.

Thanks for any help. Ric
0 Kudos
Message 1 of 3
(2,638 Views)
There is LabVIEW shipping example called "Using External Code in LabVIEW" that I think you would be interested in. In LabVIEW 6.1, you can find it at help >> search the LabVIEW bookshelf >> it should be at the bottom of the PDF that opens.

You may want to search using NI's advanced search page at:
http://search.ni.com/?col=alldocs&layout=TechResources&ql=a

Enter cin string in the all the words field and press go. You will find several lengthy discussions on the issue.

Jeremy
0 Kudos
Message 2 of 3
(2,638 Views)
Hi ricg20;

Attached to this reply is a zip file.

The code in the file strcinexample.c shows you an example on how to write your c code to accomplish what you want. Modify it to suite your needs.

The vi str cin example.vi include a CIN with the code in strcinexample.c.

However, if the only thing you want to accomplish is to obtain the codes associated to the corresponding input string, and ther are not that many codes, probably you may want to do it completely in LabVIEW. In the zip file you will also find two VIs, str lview example.vi and str lview example 2.vi that accomplish exactly the same as the VI with the CIN, without the hassle of going through the creation of a CIN.

I created the CIN in VC++ 6 an
d the VIs in LabVIEW 6.

Best regards;
Enrique
www.vartortech.com
Message 3 of 3
(2,637 Views)