09-10-2019 05:49 AM
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);
}
Solved! Go to Solution.
09-10-2019 05:46 AM
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);
}
09-10-2019 06:25 AM
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.
09-10-2019 06:27 AM
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.
09-10-2019 06:31 AM - edited 09-10-2019 06:33 AM
@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
09-10-2019 06:36 AM
Try with this i saved it for previous version (2018)
09-10-2019 06:55 AM
@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
09-10-2019 08:05 AM - edited 09-10-2019 08:10 AM
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
Check if there is an error, highlighting your execution. (If there is an error the result is equal a zero)
09-11-2019 03:25 AM
- 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
09-11-2019 07:57 AM
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.