LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: How to read Serial Data from Arduino using labview VISA?

You said earlier that the C Code works fine. The if statement calls dht.readTemperature() to read the temperature. Can you provide the source code for that function to see what it does and to see if it does anything unusual?

 

C_Code.PNG

0 Kudos
Message 11 of 24
(1,980 Views)

Hi marmaduke,

 

which strings do you receive?

are there any errors after VISARead? In case of "yes": which ones?

 

Did you do any debugging?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 24
(1,979 Views)

@jamiva wrote:

You said earlier that the C Code works fine. The if statement calls dht.readTemperature() to read the temperature. Can you provide the source code for that function to see what it does and to see if it does anything unusual?

 


The reason I asked is that you have no termination character on the VISA Write. Is your device expecting  one?

0 Kudos
Message 13 of 24
(1,972 Views)

I dont know if the problem is with the C code. Because when i get part of this code (for example, if i run only the DHT 22 sensor (humidity and temperature) code and it's VI, it's work fine).

 

It looks like the 'problem' starts to happen when i insert all the sensor's programing (DHT22, MQ2 and MQ135) in a single VI and a single C program.

 

I tried to run the program in parts... I created a new VI only for the DHT22 sensor and i created a new C code only for it. And it worked marvelus.

 

I did the same with MQ2 and MQ135 and it also worked.

 

that is why i think the problem might be in the code and not in the VI.

 

I rewrited the code but i could not see any issue.

0 Kudos
Message 14 of 24
(1,963 Views)

i shoul receive the strings for the humidity, temperature, and the gases level.

 

but it happens sometimes.

 

The problem is, i dont receive any error..

 

I did not think on debugging.

0 Kudos
Message 15 of 24
(1,961 Views)

yes, the source code is attached.

 

i dont think my device is expecting someting, because it only shows informations about the sensors in a VI.

0 Kudos
Message 16 of 24
(1,964 Views)

hey, do you know what is funny?

 

When i start the application, it works, but for a few seconds.

 

did you even seen something like this?

 

Ps: I uploaded a video showing the issue

0 Kudos
Message 17 of 24
(1,954 Views)

Hi marmaduke,

 

no, that's not funny.

That's exprected as soon as there is a communication problem!

 

From what I see in the video:

The first iteration with all 4 requests is successful.

Then the next iteration starts, the first request (temperature) is also successful. Then there are some delay due to timeouts of the VISARead (?) with the last 3 values not read.

Then the 3rd iteration starts, failing to read all values - still VISA problems.

 

Again:

Did you debug your VI?

Are there any VISA errors? In case "yes": which ones?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 24
(1,948 Views)

Did you debug your VI?

Sorry i'm still looking to find out how to debug my VI. I still dont know how to do it.

 

Are there any VISA errors? In case "yes": which ones?

I did not receive any erros. If i had receive any error, this arrow would be broken, right?

Capturar.PNGCapturar2.PNG

0 Kudos
Message 19 of 24
(1,940 Views)

Hi marmaduke,

 

Sorry i'm still looking to find out how to debug my VI. I still dont know how to do it.

 Then you should read the LabVIEW help on the topic "debugging"!

 

I did not receive any erros. If i had receive any error, this arrow would be broken, right?

Wrong!

The arrow would be broken when your VI is not runnable, but you can still get errors at runtime. You need to check them!

What about an indicator for the error wire?

What about debugging using probes or (conditional) breakpoints?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 20 of 24
(1,937 Views)