10-30-2018 07:57 PM
Hi guys = )
I Hope you can help me...
I'm creating a monitor in Labview to view some information about some gas sensors and temperature sensor (MQ2, MQ125 and DHT22)..
The first thing i have done was creating the C code... It's working fine, i can see the results in the Serial monitor...
The problem starts when i run on Labview. The whole thing becomes a mess. The infos showed me are totally wrong ...
Can someone PLEASE help me?
I tried to run the code in parts (for example, if run only the MQ2 gas sensor .VI , or only the temperature .VI and it works fine).
The problem starts when i run all the codes informations in one single labview file.
I'm uploading the code in C and the .VI hoping someone can give me a hand to solve this issue.
Thanks !!!
10-31-2018 02:28 AM - edited 10-31-2018 02:31 AM
Hi marmaduke,
why don't you clean up your VI?
Then you would notice those 3 wait functions, which all wait for 1000ms in parallel.
Or you would notice you duplicated code 4 times just to read 4 values: use a loop to call the same code several times!
(One source of the problem might be the use of BytesAtPort: you are only reading messages partly. At 9600baud it takes ~10ms to transfer 10 chars, but you are checking the received bytecount each millisecond. Your VI works just how you have it programmed to work!)
The infos showed me are totally wrong ...
What is wrong? What is shown?
Can you attach any examples of what you expect to receive and what you receive instead from your device?
On your VI:
- DON'T USE BytesAtPort IN YOUR VI! Simple set VISARead to read 99 bytes, it will stop the reading at the TermChar you are using in both Arduino and LabVIEW code!
- Why are there so many control/indicators without a label? NEVER delete the label: you may hide it in the frontpanel…
What about this one?
10-31-2018 06:38 AM
When i said the information were totally messed up, i meant the informations showed me (temperature, humidity, gases level...) were not working properly..
Labview was just showing 'anything'...
LOL, did you really remade my whole code just in this?
Can i have this .VI, please?
There is a few components in you remade code i dont know yet. So i want use you code to study.
If you like to share with me, of course 😉
10-31-2018 06:45 AM
GerdW gave you a snippet. Copy that image to your harddrive and drag it onto an empty diagram and you will have the code. That snippet was made with LabVIEW 2017, so you will need a newer version to open it.
10-31-2018 06:45 AM
10-31-2018 06:52 AM
Like this?
Sorry i have never heard before in this snippet
10-31-2018 06:55 AM
10-31-2018 06:56 AM
I did it!
Now i'm going to test the code 😉
Thanks!
10-31-2018 07:12 AM
I opened you code in a new VI.
When i run the code i'm not receiving any info..
I tested in the serial monitor and i can call the informations:
Maybe there is something wrong in the C code?
I'm looking for some C code errors, but so far i got nothing.
10-31-2018 07:23 AM
I realized when I go to run the VI, the information appears very fast and it fades. I think it stays for 3 seconds and disappear.
I think there may be something wrong with the code, the only problem is that on the serial monitor I can see the information.