LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with passing numeric data to VISA write function

Solved!
Go to solution

I have a GE PowerPC which runs on VxWorks OS.I have a Tornado application where i run my C code to generate .o & .out file, then I dump the .o & .out image files to the PowerPC via FTP, now I need to talk to PowerPC from LabVIEW(via serial communication using VISA vi) by using VxWorks commands. When i enter VxWorks commands in LabVIEW

i.e for Eg:1>  ls -->list of contents of a directory i.e .o & .out files. The problem i am facing here is, when i run the vi, i am able to read the file in read string box but the files jus keep on accelerating, 

              2> ld <filename.o -->load an object module into memory. i face the same problem here to.

              3> then i need to type the c program main funtion name, after which i can give inputs to the program.

              4> i need to enter numeric data as inputs to my program. but the VISA write function accepts only string input and VISA read function gives only string output.. i want to give numeric input and read numeric output.  Any help would be appreciated.  

          

 

 

Regards,
KM
0 Kudos
Message 1 of 12
(3,806 Views)

Hi kamasani,

 

The VISA functions work only with strings. But you can converte your numeric values on string with the "Number to decimal string" function.

You can also converte Decimal chars of strings into numerique value with the  "Decimal String To Number" function.

 

For the others points, can you explain more your problems ?

 

Thank you

 

Alexandre
0 Kudos
Message 2 of 12
(3,790 Views)

Hi Alexandre,

 

Thanks for the info,

Please find the attachment. The attachment shows the VxWorks commands and the steps i used in Hyper terminal App to communicate with Power PC. I want the same thing to happen in LabVIEW.Now i have created the replica of Hyperterminal in LabVIEW using the shipped example Advanced serial write and read vi. 

 

The problem i am facing in LabVIEW with reference to the attachment is,

1st step: after i enter command  -->ls  the two files Project20.out and array.o are getting displayed in string read box of Front Panel, but it keeps on accelerating as i explained you. 

2nd step: after i enter command -->ld <array.o  same problem as above

3rd step: i enter my c program main function name -->manju  then it will ask for reading the 1st array. here i need to give numeric array  input to get output fror my program.

 

Regards,
KM
0 Kudos
Message 3 of 12
(3,769 Views)
Solution
Accepted by topic author KevinKM

Hi Kamasani,

You can try with this reliable hyperterminal VI .

http://lavag.org/files/file/172-hyper-terminal/

Boldness has genius, power and magic in it!'
0 Kudos
Message 4 of 12
(3,742 Views)

In order to summarise,

 

1. you have to send a command (--> Is) with the serial port to your hardware. The hardware sends you back the content of the two files. Did I understand you correctly? Your problem is the data are displayed in the string indicator in the front panel and the data disappear few milliseconds later, is it right?

 

If it is your problem I will explain you the reason. When you get string characters on your serial port, they are displayed in the string indicator. At the next iteration of the while loop, the serial port reads the next frame. If you do not have any more characters, you will get an error. The indicator will be updated, if you have other characters to display. If you want to display a history of your data, you will need to store the data each time you receive them. For that you can use a shift register it allows you to store data by using the loop. Then you have to add the new data with the old ones. For this you have two solutions you can find it in the attachement.

 

The first one concatenates previous strings with the new string. With this solution, your output (read string indicator) will be a string type.

The second one builds an array of strings and the new strings received are put at the end of the array. This output will be this time an array type.

You can can use the first or the second solution depending on the processing you would like to do with the output.

 

2. When you enter the function name -->manju, your hardware is waiting for an array.

Do you have to read an existing array and send it or just type your array values? 

 

Alexandre
0 Kudos
Message 5 of 12
(3,735 Views)

Hi Alexandre,

 

After i send the command -->ls to the hardware via serial port, the hardware sends back the two file names. In the string indicator of front panel the files disappears and appears over and over again.

 

I will try with the two possibilities you have suggested. one is by using concatenate strings and the other by build array to read the string data,

 

Once this is done, i enter the function name -->manju, then i need to type array of numeric values in the string write to read the numeric output at the string read. How should i go about with the last step.

 

 

Regards,

Kamasani 

 

 

Regards,
KM
0 Kudos
Message 6 of 12
(3,711 Views)

Hi MaveenD,

 

I could communicate fairly with my hardware using the hyperterminal application you suggested. The application doesnt serve my purpose. I want to communicate with the hardware from Labview vi. Because i need to acquire  real time sensor data as input to my labVIEW program which i dont think is possible in the hyperterminal application. I have explained my problems for the same. Any help would be appreciated.

 

 

 

Regards,

Kamasani 

Regards,
KM
0 Kudos
Message 7 of 12
(3,707 Views)

Hi Alex,

 

I made the corrections with the VI as you suggested by using concatenate string and build array functions, its working little better than before, but when i type -->ls command in write string and run for 2 or 3 seconds, this output  as shown below is being dispalyed for n number of times in the concatenate string box. Same is the case  for ld <array.o command too.

-> ls
ls
Project20.out

array.o

 

Output for -->ld <array.o (typed in write string)

 

Concatenate string box

 

-> ld <array.o
ld <array.o
ld <array.o
ld <array.o
ld <array.o
ld <array.o
ld <array.o
ld <avalue = 33537416 = 0x1ffbd88 = manju + 0x408

 

-->manju (typed in write string box)

 

Output in concatenate string 

-> manju

Reading the 1st array
28268 1962934274 152 33548778 4value = 2 = 0x2
-> manju

Reading the 1st array
28268 1962934274 152 33548778 4value = 2 = 0x2
-> manju

Reading the 1st array
28268 1962934274 152 33548778 4value = 2 = 0x2
-> manju

 

 

after all this i should enter my numeric inputs in the string, which is a problem.

 

 

 

Regards,
KM
0 Kudos
Message 8 of 12
(3,696 Views)

Hi Kamasani,

When you write some commande they are displayed more than one time, I'm right ?
This problem come from your "write" button. The while loop is running fast and the VISA write fonction is executed during all the time your write button is in ON position.

To correct this problem, you can change the mechanical action of the button.
Right click on write button in the front pannel ==> select the mechanical action menu ==> and click switch until realise.

By doing this manipulation the write button will be turn to ON the time the case structure execute and then it will back on OFF position.

Concerning the array you have to send, can you type your values directly in the string box ? Is your hardware able to catch numeric value in ASCII ?  Do you have some separation chars to include between your values ?

 

Alexandre
0 Kudos
Message 9 of 12
(3,678 Views)

Hi Alex,

 

You understood me right, concerning to the array i can type the values directly in the string box, i use space bar between the values, when i run the VI i will get the output same as the input with syntax error. i dont know if my hardware is able to catch numeric value in ASCII.

 

 

 

 

Regards,

Kamasani

Regards,
KM
0 Kudos
Message 10 of 12
(3,664 Views)