Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5565

VISA read of serial data issue

$
0
0

Hello everyone, I am new to LabView VISA.

My application is to read data from LDR and turn on and off bulb accordingly, the switching of bulbs is to be displayed in LabView. The program runs perfectly in Arduino and I want to indicate the bulb on/off in labview. I am using VISA for displaying the switching of bulbs.

Arduino program:

volatile int glight,Lstate;
void setup()
{
pinMode(5,OUTPUT);
Serial.begin(9600);
}

void loop()
{
glight=analogRead(A0); //ldr sensor
if(glight<140)
{
digitalWrite(5,HIGH);
Lstate=0;
}
else if(150< glight < 300)
{
digitalWrite(5,LOW);
Lstate=1;
}
Serial.print("L");
Serial.print(Lstate);
}

In LabView I sometimes get correct output indicating that the bulb is ON but that occurs only once and after that it does not run(after it executives once it shows error 85 or sometimes 1 but I assure you the connections are tight and correct). Also a point I should mention is that when I run the LabView program(Highlight Execution: ON) on the "Read buffer" from VISA Read the value that gets passed is "L0L0L0" or "L1L1L1" why does it do this? it should only show  L0 or L1. Please Help! 


Viewing all articles
Browse latest Browse all 5565

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>