LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get waveforms directly through VISA

Solved!
Go to solution

Hello,

 

I have a simple code for getting some pulses from Arduino (Micro-controller). I interfaced my arduino through VISA. Now i want to get that specific Waveform at my Labview. How can i accomplish this task.

I heard about that DAQ but if i donot have this possibility.

 

I m getting the waveform at my oscilloscope but i want now that these waveforms(Pulses) came at my Waveform graph which is outside the while loop in my VI. Please help me regarding it thanks.

 

My code is

 

void setup() {
Serial.begin(9600);
// put your setup code here, to run once:
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(7, OUTPUT);
}

int n=1;
int delay1=1; // delay of 1ms

void loop() {
// put your main code here, to run repeatedly:

int main_signal=2; int SC_signal=4; int cap_charge=3; int LC_signal=5; int relay_on=7;

digitalWrite(main_signal, LOW);
digitalWrite(SC_signal, LOW);
digitalWrite(cap_charge, LOW);
digitalWrite(LC_signal, LOW);
digitalWrite(relay_on, LOW);


if (n<=1) {

delay(delay1); //delay before the circuit operation (1000 = 1 sec)

digitalWrite(relay_on, HIGH);
delay(delay1*2*500);

//Nominal Phase

digitalWrite(main_signal, HIGH);

delay(delay1*5); // wait for 5ms


//Short-circuit Phase

digitalWrite(SC_signal, HIGH);
delay(delay1); // wait for 1ms

//Fault detected

digitalWrite(cap_charge, HIGH);
delay(delay1); // wait for 500mic-sec

//Counter-current phase

digitalWrite(cap_charge, LOW);
digitalWrite(main_signal, LOW);

delay(delay1); // 1ms delay between caapcitor charging and counter-current phase

digitalWrite(LC_signal, HIGH);
delay(delay1); // 1ms delay for counter_current pulse (LC Pulse)

digitalWrite(LC_signal, LOW);
delay(delay1*2); // delay between counter_current pulse and SC turn off pulse

digitalWrite(SC_signal, LOW);

delay(delay1*2*500);


digitalWrite(relay_on, LOW);

n=n+1;
}
digitalWrite(main_signal, LOW);
digitalWrite(SC_signal, LOW);
digitalWrite(cap_charge, LOW);
digitalWrite(LC_signal, LOW);
digitalWrite(relay_on, LOW);
}

 

 

 

 

0 Kudos
Message 1 of 51
(3,612 Views)

Hello,

 Thanks by your help actually i get some results. 

as i have a simple code for getting some pulses from Arduino (Micro-controller). I interfaced my arduino through VISA. Now i want to get that specific Waveform (Pulses) at my Labview. How can i accomplish this task.

I heard about that DAQ but if i donot have this possibility.

 

I m getting the waveform at oscillscope but i want to see that  waveforms at my Waveform graph which is outside the while loop in my VI. Please help me regarding it thanks.

 

My code is

 

void setup() {
Serial.begin(9600);
// put your setup code here, to run once:
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(7, OUTPUT);
}

int n=1;
int delay1=1; // delay of 1ms

void loop() {
// put your main code here, to run repeatedly:

int main_signal=2; int SC_signal=4; int cap_charge=3; int LC_signal=5; int relay_on=7;

digitalWrite(main_signal, LOW);
digitalWrite(SC_signal, LOW);
digitalWrite(cap_charge, LOW);
digitalWrite(LC_signal, LOW);
digitalWrite(relay_on, LOW);


if (n<=1) {

delay(delay1); //delay before the circuit operation (1000 = 1 sec)

digitalWrite(relay_on, HIGH);
delay(delay1*2*500);

//Nominal Phase

digitalWrite(main_signal, HIGH);

delay(delay1*5); // wait for 5ms


//Short-circuit Phase

digitalWrite(SC_signal, HIGH);
delay(delay1); // wait for 1ms

//Fault detected

digitalWrite(cap_charge, HIGH);
delay(delay1); // wait for 500mic-sec

//Counter-current phase

digitalWrite(cap_charge, LOW);
digitalWrite(main_signal, LOW);

delay(delay1); // 1ms delay between caapcitor charging and counter-current phase

digitalWrite(LC_signal, HIGH);
delay(delay1); // 1ms delay for counter_current pulse (LC Pulse)

digitalWrite(LC_signal, LOW);
delay(delay1*2); // delay between counter_current pulse and SC turn off pulse

digitalWrite(SC_signal, LOW);

delay(delay1*2*500);


digitalWrite(relay_on, LOW);

n=n+1;
}
digitalWrite(main_signal, LOW);
digitalWrite(SC_signal, LOW);
digitalWrite(cap_charge, LOW);
digitalWrite(LC_signal, LOW);
digitalWrite(relay_on, LOW);
}

 

 

 

 

0 Kudos
Message 2 of 51
(3,554 Views)

I don't know if it will work but try with this code.

if it doesn't  work or if it doesn't give you the correct result, can you please attach the error popup or the result screenshot.

Best Regards,
Applications Engineer
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
CLAD // CLD
0 Kudos
Message 3 of 51
(3,584 Views)

The "S" in VISA stands for Serial.

 

You are going to get data from a serial bus physical layer.   That data might include a t0 scalar, a dT scalar and an array of readings.   If it does, a waveform is a nice package to send that data around in.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 51
(3,580 Views)

@REFNH wrote:

I don't know if it will work but try with this code.

if it doesn't  work or if it doesn't give you the correct result, can you please attach the error popup or the result screenshot.



I cannot open it because i have Labview 2018 version can you please guide me how can i run it on Labview 2018

0 Kudos
Message 5 of 51
(3,574 Views)

Try with this i saved it for previous version (2018)

Best Regards,
Applications Engineer
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
CLAD // CLD
0 Kudos
Message 6 of 51
(3,568 Views)

@REFNH wrote:

Try with this i saved it for previous version (2018)


Thanks it works but i cannot get any Pulse, on the graph a white line showing constantly zero. Please check the attachment. 

 

Thanks for helping me out.

I need some thing like in the video. These pulses i need on my Labview directly

 

0 Kudos
Message 7 of 51
(3,550 Views)

Try to put the waveform into the loop. If you can't get any pulse also try to change the byte count of the visa read to another number (e.g 1,10,1000) and you can see the difference and you will choose the right byte count. 

I'm waiting Smiley Wink Smiley Happy

 

Check if there is an error, highlighting your execution. (If there is an error the result is equal a zero)

 

Best Regards,
Applications Engineer
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
CLAD // CLD
0 Kudos
Message 8 of 51
(3,522 Views)

- If i put the Waveform graph inside the loop i cannot join the block of octal string number with my waveform graph.

- If i change the read number to another number the program even cannot stop and donot find any desire results.

 

Need consideration.

 

Maaz

 

 

0 Kudos
Message 9 of 51
(3,478 Views)

Please attach your VI so we can see what you are doing and know why you can't do the things you say you can't do.

0 Kudos
Message 10 of 51
(3,461 Views)