LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino signal to labview (HELP!)

Thanks again!

Is it something close to this?

0 Kudos
Message 21 of 26
(1,750 Views)

Hi lamela,

 

Is it something close to this?

I dunno…

It looks different then my image I posted before. And you still do things I questioned before.

Did you try my approach?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 22 of 26
(1,731 Views)

I'm able to get a smooth signal from this VI, but the signal isn't realtime? When I change the DC voltage, the reading and signal won't change until I stop the program, remove one of the software component then put it back and run the program, then the reading and signal will change. This is so strange.. the signal will sometimes go back to 0 and I have to keep removing and putting back the software component and sometimes, I have to wait for 1 minute before the signal will update again. 

What do you think is the problem here?

Download All
0 Kudos
Message 23 of 26
(1,689 Views)

Hi lamela,

 

you still use BytesAtport and you even switched TermChar recognition off…

I wonder how you get a "smooth" signal with this VI!

 

Get the serial communication clear as has been told several times before!

 

the reading and signal won't change until I stop the program,

Might be a problem of your use of the error shift register…

Or the way you convert your string: you put new chars at the end of the string, but you keep converting the very first part of the string forever. You will never read any other value than the first one from the string…

 

More comments:

- You still convert your string reading to an integer, which is converted to DBL, which is converted to DDT. Why all these steps? Why DDT at all? Why not convert the string to a DBL?

- After all the comments you got here: Are you even listening to our comments? Are you even trying to debug your own VI using probes?

Best regards,
GerdW


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

I suppose, it is quite hard to understand all the concepts of serial communication and programming in LabVIEW, when all this is very new to someone. But nevertheless, the hints of GerdW are very useful and you should consider following them.

So, best is to make a NEW VI according to Message 20, as suggested by GerdW. Pull the string indicator to a larger size, so you can see all the received caracters. What this VI does, is to initialize the serial port with your baudrate, and TermChar is switched on by default, set to LineFeed. In the loop, the Serial Read- node will wait, until either 1024 bytes will occur in the serial port buffer or a LineFeed- character is recognized or the default wait time of 2000 ms is expired. So, if you don't have your communication in the Arduino set properly (which I suppose from the serial data shown in Message 10), you will get a string of 1024 bytes with a lot of values in the string indicator. In this case you should consider the advice with the println- command at the Arduino- side.
In your case it would be better to use "Fract/Exp String To Number", since you receive floating point numbers in your string. To display the converted values place a waveform chart on your front panel and wire it to the [number]- output of "Fract/Exp String To Number".

When you've done this, post your VI here with a screenshot of the front panel, when it shows data.

Good luck and

Greets, Dave
0 Kudos
Message 25 of 26
(1,626 Views)

Let me offer a different solution, which is rather than rolling your own Arduino communication routine, even a simple one, why not use an existing library? Download and instal the LINX package, and use its Analog Voltage Read VI. It will handle all of the serial communication between the Arduino and the computer. 

0 Kudos
Message 26 of 26
(1,608 Views)