From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Basic visa write and read example

Solved!
Go to solution

I am using basic visa read and write example to control my temperature controller actually it works perfect but I want something else. First, I am reading temperature value continuously and it can be read on read string section but I want to but numeric indicator to see the temperature value is that possible? And what function I have to use for it? Actually I used scan from string to do it but I have not checked yet it is working or not?

 

Second, I have to set temperature sometimes on the controller actually I can do it writing tset=025.0 to set temperature 25 F, it is working when I write this command to panel(string to write), but I want to make like numeric controller or something like that instead of writing command for every setting is that possible. I want to increase or decrease temperature by pushing increase or decrease button instead of writing tset=0.250/r. Could you help me about that?

 

Third, I want to run some parts of program continuously some part when I want to run, is that possible, now I did while loop and my example working continuously. I want that because when I set temperature that does not have to run continuously because this is one time command to read temperature value this section run continuously because temperature on the experimental set up is changing an I have to see this changing, for example I set temperature 100 F and than controller heat up device 100 F but this command is one time command, but reading temperature command should work continuously because temperature is changing and I need to read temperature for each 60 sec and I can do that part.

0 Kudos
Message 1 of 13
(20,021 Views)

Hi

1. You could use string to number function and wire it to the numeric indicator .

2. You can put a numeric control and wire it to a numeric to string function and wire that to the visa write function (both conversion functions are in the string/number  conversion palette which is in the programming ->string palette)

3. What you need to  run continuously you put a while loop around it whatever has to run once you put outside the while loop....

 

I HOPE I HELPED:smileyhappy:

 

A.A

0 Kudos
Message 2 of 13
(20,003 Views)

I am not sure numeric control is gonna work for that part without definition, i mean, i have to write comman every time to set temperature and when i put numeric control are you sure that i don't have to define my command to this numeric controller to change temperature. I am not sure how this part is running but i think, I define command to numeric controller how to change temperature and then when i change temperature by using numeric controller it is gonna make it automatically instead writing command for every time but as i said i am not sure labview is working like that or not.

 

String to number function did not work actually i see temperature on basic visa read & write example but the section was big and i smalled read string section. Maybe the value is not only number that is why string to number is showing 0 every time. because on read string the is existed like 23.5 C

0 Kudos
Message 3 of 13
(19,957 Views)

string.png

 

also look at examples: Cont Acq RTD Samples-SW Timed.vi for your continuous temperature read...Smiley Wink

0 Kudos
Message 4 of 13
(19,953 Views)

Hi,

 

If you want to run some functions on a continuous loop and others when you command them, you might want to look into Event Structures, which will allow your program to run certain functions only when the user requests them.  If you put the Event Structure in a While Loop, you can specify what the program does on each loop iteration, and what it does in response to specfic user input.

 

In order to convert serial data in string form to numeric data, take a look at the "Decimal String To Number Function."  You can use the "String Subset Function" to strip out any non-numeric characters from your string.


Good Luck!  And let us know if you have any other questions. 

 

- FB

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 5 of 13
(19,940 Views)

i am sorry but is that possible to add that again for compatible with visa 8.5, and again i am sorry it may be easy question but how i will connect this part vith visa write could you tell me? Thank you for reply

0 Kudos
Message 6 of 13
(19,936 Views)

@mkmo wrote:

i am sorry but is that possible to add that again for compatible with visa 8.5, and again i am sorry it may be easy question but how i will connect this part vith visa write could you tell me? Thank you for reply


show us your command string? better yet...post your VI

0 Kudos
Message 7 of 13
(19,930 Views)

This is example on labview for basic visa read and write

0 Kudos
Message 8 of 13
(19,926 Views)
Solution
Accepted by topic author mkmo

serial mod_BD.png

 

make sure you concatenate "code display" text constants

Message 9 of 13
(19,917 Views)

Thank you so much for solution and now it works like what i want.

0 Kudos
Message 10 of 13
(19,901 Views)