Hello friends.
Today I will tell you how to use visa for serially right data.
So for that purpose I just use over here as you see Arduino Uno board, it is connected to my PC and
over here I have one led.
So using LabVIEW, I just write some serial data and according to that my Led turn on and off.
So I just first tell you the code.
So in that case you just need to develop two codes, one for Arduino and one for LabVIEW.
So as you see over here, first I use a variable Led and I assign this Led seven.
So I just use digital PIN seven.
As you see over here, this is my positive pin red one.
It is connected to the positive pin of Led and then I just another variable var one, var one, then
Voidsetup serial begin.
And over here the baud rate is 9600 for Arduino Uno.
Then I have to set the pin mode.
In this case the Led is working as a output.
I assigned this digital pin as a output pin.
Then over here I have loop void loop.
If serial available serial data is available, it will read, then it will just go for the variable
one.
Basically, the serial data is available with variable one and it will read serial read and in the serial
read.
If the variable one is equal to a, in that case it will generate high signal.
Otherwise it will generate low signal.
Okay, so this is the code for Arduino.
I just go to the tools, set the port Arduino Uno, then I have to just run the code.
So as you see on the Arduino run right now, the uploading is done.
So I just want to do it again.
Let's check it is done or not.
As you see, done uploading.
So right now I just close this code.
My Arduino have a code.
It will just go for the serial read function.
And if it get a then it will turn on the Led.
Otherwise it will turn off the Led.
So I just go to the LabVIEW code over here.
As you see, this is my block diagram.
And over here this is my front panel.
So in the LabVIEW, you just go to the instrument, input output over here, you just find Visa, you
just lock it.
So first function, you just go to the advanced over here.
As you see, this is my serial read function.
Then I have visa, right?
Then I have close.
So this is my close function visa.
Close.
I also name it label it Visa close is there.
Second function that is visa, right?
You can find this visa right over here.
As you see, this is my visa, right function.
I also label it as you see now you need to read serially read.
So for the serial read function, you just type visa serial or you just go to.
Over here in the cereals, you just find configure port visa cereal.
You just also name it visible label.
Okay, so this is how you can find out these components.
So this is my visa configure.
These are configure serial code, so you just connect it over here.
I have while loop.
So you just set visa baud rate clean up wire and over here we have visa resource in this.
You need to just find set the port in this case as you see.
Com eight is my USB port and over here you just go to the select function.
The select function is available in the comparison.
You just drag and drop it over here.
I just also name it.
Then you just put when the function is true, create constant for it and the constant for this should
be string function.
So when I just connect over here, you just need to go to the string over here.
You just create a constant.
Just connect this.
As you see inside this, you just put a otherwise put be.
It is up to you what you want to put inside the variable.
But in the case of Arduino, I just use a variable.
If it just get a it will turn on the Led, otherwise it will turn off led in the place of B, you just
use anything like off function.
Right now I'm just using off function.
Okay.
So over here, this is my Led button.
It will turn on and off my led.
Okay.
So this is how you can create the LabVIEW code right now.
You just run it.
When you just run it as you see it is in off condition when you hit on run button.
My led goes on, off on, off on.
So this is how you can use visa to write signal to your hardware and in this case your Arduino just
read the serial data and based on that serial data it will take the decision.
So this is how you can go with Visa in LabVIEW for Arduino programming.
Thank you.