1
00:00:05,000 --> 00:00:05,000
Hello friends.

2
00:00:05,000 --> 00:00:13,000
Today I will tell you how to use visa for serially right data.

3
00:00:14,000 --> 00:00:22,000
So for that purpose I just use over here as you see Arduino Uno board, it is connected to my PC and

4
00:00:22,000 --> 00:00:25,000
over here I have one led.

5
00:00:25,000 --> 00:00:36,000
So using LabVIEW, I just write some serial data and according to that my Led turn on and off.

6
00:00:36,000 --> 00:00:39,000
So I just first tell you the code.

7
00:00:39,000 --> 00:00:47,000
So in that case you just need to develop two codes, one for Arduino and one for LabVIEW.

8
00:00:47,000 --> 00:00:57,000
So as you see over here, first I use a variable Led and I assign this Led seven.

9
00:00:58,000 --> 00:01:00,000
So I just use digital PIN seven.

10
00:01:00,000 --> 00:01:04,000
As you see over here, this is my positive pin red one.

11
00:01:04,000 --> 00:01:15,000
It is connected to the positive pin of Led and then I just another variable var one, var one, then

12
00:01:15,000 --> 00:01:18,000
Voidsetup serial begin.

13
00:01:19,000 --> 00:01:23,000
And over here the baud rate is 9600 for Arduino Uno.

14
00:01:23,000 --> 00:01:25,000
Then I have to set the pin mode.

15
00:01:25,000 --> 00:01:31,000
In this case the Led is working as a output.

16
00:01:31,000 --> 00:01:35,000
I assigned this digital pin as a output pin.

17
00:01:35,000 --> 00:01:39,000
Then over here I have loop void loop.

18
00:01:39,000 --> 00:01:48,000
If serial available serial data is available, it will read, then it will just go for the variable

19
00:01:48,000 --> 00:01:48,000
one.

20
00:01:49,000 --> 00:01:57,000
Basically, the serial data is available with variable one and it will read serial read and in the serial

21
00:01:57,000 --> 00:01:58,000
read.

22
00:01:58,000 --> 00:02:04,000
If the variable one is equal to a, in that case it will generate high signal.

23
00:02:04,000 --> 00:02:07,000
Otherwise it will generate low signal.

24
00:02:07,000 --> 00:02:11,000
Okay, so this is the code for Arduino.

25
00:02:11,000 --> 00:02:20,000
I just go to the tools, set the port Arduino Uno, then I have to just run the code.

26
00:02:21,000 --> 00:02:31,000
So as you see on the Arduino run right now, the uploading is done.

27
00:02:34,000 --> 00:02:38,000
So I just want to do it again.

28
00:02:39,000 --> 00:02:42,000
Let's check it is done or not.

29
00:02:45,000 --> 00:02:47,000
As you see, done uploading.

30
00:02:47,000 --> 00:02:51,000
So right now I just close this code.

31
00:02:51,000 --> 00:02:53,000
My Arduino have a code.

32
00:02:53,000 --> 00:02:57,000
It will just go for the serial read function.

33
00:02:57,000 --> 00:03:02,000
And if it get a then it will turn on the Led.

34
00:03:02,000 --> 00:03:04,000
Otherwise it will turn off the Led.

35
00:03:05,000 --> 00:03:08,000
So I just go to the LabVIEW code over here.

36
00:03:08,000 --> 00:03:10,000
As you see, this is my block diagram.

37
00:03:10,000 --> 00:03:13,000
And over here this is my front panel.

38
00:03:14,000 --> 00:03:25,000
So in the LabVIEW, you just go to the instrument, input output over here, you just find Visa, you

39
00:03:25,000 --> 00:03:26,000
just lock it.

40
00:03:26,000 --> 00:03:32,000
So first function, you just go to the advanced over here.

41
00:03:32,000 --> 00:03:36,000
As you see, this is my serial read function.

42
00:03:36,000 --> 00:03:39,000
Then I have visa, right?

43
00:03:39,000 --> 00:03:40,000
Then I have close.

44
00:03:40,000 --> 00:03:44,000
So this is my close function visa.

45
00:03:44,000 --> 00:03:45,000
Close.

46
00:03:45,000 --> 00:03:50,000
I also name it label it Visa close is there.

47
00:03:56,000 --> 00:03:58,000
Second function that is visa, right?

48
00:03:58,000 --> 00:04:02,000
You can find this visa right over here.

49
00:04:02,000 --> 00:04:05,000
As you see, this is my visa, right function.

50
00:04:05,000 --> 00:04:15,000
I also label it as you see now you need to read serially read.

51
00:04:15,000 --> 00:04:24,000
So for the serial read function, you just type visa serial or you just go to.

52
00:04:31,000 --> 00:04:36,000
Over here in the cereals, you just find configure port visa cereal.

53
00:04:39,000 --> 00:04:43,000
You just also name it visible label.

54
00:04:44,000 --> 00:04:48,000
Okay, so this is how you can find out these components.

55
00:04:48,000 --> 00:04:50,000
So this is my visa configure.

56
00:04:57,000 --> 00:05:02,000
These are configure serial code, so you just connect it over here.

57
00:05:02,000 --> 00:05:04,000
I have while loop.

58
00:05:05,000 --> 00:05:14,000
So you just set visa baud rate clean up wire and over here we have visa resource in this.

59
00:05:14,000 --> 00:05:20,000
You need to just find set the port in this case as you see.

60
00:05:20,000 --> 00:05:28,000
Com eight is my USB port and over here you just go to the select function.

61
00:05:29,000 --> 00:05:33,000
The select function is available in the comparison.

62
00:05:33,000 --> 00:05:36,000
You just drag and drop it over here.

63
00:05:36,000 --> 00:05:37,000
I just also name it.

64
00:05:39,000 --> 00:05:48,000
Then you just put when the function is true, create constant for it and the constant for this should

65
00:05:48,000 --> 00:05:50,000
be string function.

66
00:05:50,000 --> 00:05:55,000
So when I just connect over here, you just need to go to the string over here.

67
00:05:55,000 --> 00:05:57,000
You just create a constant.

68
00:05:57,000 --> 00:05:59,000
Just connect this.

69
00:05:59,000 --> 00:06:03,000
As you see inside this, you just put a otherwise put be.

70
00:06:03,000 --> 00:06:08,000
It is up to you what you want to put inside the variable.

71
00:06:08,000 --> 00:06:13,000
But in the case of Arduino, I just use a variable.

72
00:06:13,000 --> 00:06:21,000
If it just get a it will turn on the Led, otherwise it will turn off led in the place of B, you just

73
00:06:21,000 --> 00:06:24,000
use anything like off function.

74
00:06:24,000 --> 00:06:26,000
Right now I'm just using off function.

75
00:06:26,000 --> 00:06:26,000
Okay.

76
00:06:26,000 --> 00:06:30,000
So over here, this is my Led button.

77
00:06:30,000 --> 00:06:32,000
It will turn on and off my led.

78
00:06:33,000 --> 00:06:33,000
Okay.

79
00:06:33,000 --> 00:06:38,000
So this is how you can create the LabVIEW code right now.

80
00:06:38,000 --> 00:06:39,000
You just run it.

81
00:06:40,000 --> 00:06:45,000
When you just run it as you see it is in off condition when you hit on run button.

82
00:06:45,000 --> 00:06:51,000
My led goes on, off on, off on.

83
00:06:51,000 --> 00:07:03,000
So this is how you can use visa to write signal to your hardware and in this case your Arduino just

84
00:07:03,000 --> 00:07:08,000
read the serial data and based on that serial data it will take the decision.

85
00:07:08,000 --> 00:07:14,000
So this is how you can go with Visa in LabVIEW for Arduino programming.

86
00:07:14,000 --> 00:07:15,000
Thank you.

