LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lectura del puerto serial e impresion de datos

Solved!
Go to solution
If you get a timeout with a request of 100 bytes, then you still have not fixed your arduino code. Properly terminated, it will be irrelevant whether you request 16, 100, or 1000 bytes. Each will take exactly the same time. Focus on fixing your c code. You don't have an issue with LabVIEW.
0 Kudos
Message 41 of 49
(1,623 Views)

Get rid of the Filtro command where you write to the serial port and read.  Then see how it works.

 

Did you try what I said earlier about only trying one command at a time in the loop to see how that works?  That would make it obvious if a command works, or if it is broken like your Filtro command seems like it would be.

 

There is nothing about those timer functions that would slow your code other than, like Dennis says, it is convoluted.  Also, what happened to your command letters?  They look different in these images than you had earlier.  You had upper case T, now you have lower case "t".  Same with H vs. h.  You never had "b" before.  Did you had that condition to your arduino code?  Because your earlier Ard. code didn't have a case for "b".

 

It seems like you are changing too many things in ways that just don't make sense.

0 Kudos
Message 42 of 49
(1,621 Views)

Do you have any idea what could be the problem in Ard. code? because I run it and it works fine looking in Ard. serial.

This is my Ard. code for printing 😕 

void loop() {
readLocation();
while(Serial.available())
{

in =(byte)Serial.read() ;
if(in == 't'){
temp = dht.readTemperature();
Serial.println(temp);
}
else if(in == 'h'){
hum = dht.readHumidity();
Serial.println(hum);
}
else if(in == 'b'){
Serial.println(50);
}
else if(in == 'a'){
Serial.println(alture,6);
}
else if(in=='l')
{
Serial.println(latitude,6);
}
else if(in == 'o'){
Serial.println(longitude,6);
}

else if(in == 'p'){
digitalWrite(solenoide1, LOW);
digitalWrite(solenoide2, LOW);
}

else if(in == 's'){
digitalWrite(solenoide1, HIGH);
digitalWrite(solenoide2, LOW);

}
else if(in == 't'){
digitalWrite(solenoide1, LOW);
digitalWrite(solenoide2, HIGH);

}

}

0 Kudos
Message 43 of 49
(1,621 Views)

Try each of your commands by itself in a loop.

 

The ones that are correct should run fast.  The ones that are wrong will run slow and/or give you errors.

 

That will give you a clue where to look in your C code.

 

Lookiing at your latest code, I see you have lower case 't' twice.

 

If your character you send does not match anything in your If ElseIF C code, then nothing gets returned.  The VISA Read will timeout no matter how many bytes you read.

0 Kudos
Message 44 of 49
(1,607 Views)

I correct the code my friend in Ard. now it works fine, i was trying to send this data trought XBEE but i doesn't works, do you know if I have to change anything in my LabView code? I have configured the Xbee to receive and send, but i doesn't works, i believe that it's because xbee works with 8 data bits.

0 Kudos
Message 45 of 49
(1,584 Views)
The serial port sends 8 bits (1 byte) at a time so your comment does not make much sense.
0 Kudos
Message 46 of 49
(1,565 Views)

When I work connecting Ard. directly to USB it works fine, but if I use xbee I get random values, do you know if i have to change something in my VI? Or why it's happen?

0 Kudos
Message 47 of 49
(1,561 Views)

Hola Buenas noches.. Tengo tu mismo problema, no se si ya tienes la solucion.. mucho agradecere.. Saludos

0 Kudos
Message 48 of 49
(1,441 Views)

buenas noches

podrias ayudarme con el diagrama completo

Saludos

 

0 Kudos
Message 49 of 49
(1,438 Views)