08-17-2018 12:59 AM
Hello everyone
i want to read data from 3 Arduino with serial.print ( serial port ) in visa port of Labview.
i put my simple code here. i will be happy if anyone help me about it.
thanks
08-17-2018 01:02 AM
Can you put your vi for version 2017 or a picture of it?
08-17-2018 01:03 AM
Hello everyone
i want to connect 3 arduino to labview and then read serial port of them in labview same time.
i put my code here.
what do you think about it. should i need to change my code or do some change in labview or arduino.
thanks
08-17-2018 01:06 AM
I have labview 2018.
here is code and picture
08-17-2018 01:07 AM - edited 08-17-2018 01:12 AM
Hi amkamyab,
please don't create duplicate threads for the very same topic.
Especially when you don't even attach a down-converted version of your VI!
Edit after your last message:
To downconvert a VI you go open the File menu -> Save for previous…
what do you think about it. should i need to change my code or do some change in labview or arduino.
Yes, surely you NEED TO change your code!
1. Don't use BytesAtPort! Just wire a constant larger than the expected message size! (You set VISASerialPortInit to wait for TermChars!)
2. There is no error handling at all right now!
3. Separate each communication (COM port) in its own loop.
4. Use more descriptive labels for your controls.
5. You don't need to open the COM port, VISASerialPortInit is sufficient.
08-17-2018 01:21 AM
when i don't use byte at port labview show error when start run.
08-17-2018 01:30 AM
Hi amkamyab,
what kind of messages do you want to receive from your Arduino(s)? How are they formatted?
Please provide more information!
You also don't show how your VI looks like right now…
At VISASerialPortInit you enabled the TermChar and set LF as TermChar, so I guess your messages are send using a Serial.PrintLN command at the Arduino. (If this is not the case you need to use a better setup at initialising the COM ports and adapt your reading loop.)
08-17-2018 01:41 AM
Thanks for your care.
here is my real code for labview
and also my code for Arduino
08-17-2018 01:45 AM
2017 version of my VI
08-17-2018 01:52 AM - edited 08-17-2018 02:02 AM
Hi amkamyab,
OMG!
What is this monster of a VI made to do?
Why do you need SO MUCH duplicated code?
Why do you need to convert arrays to clusters so often - just to get 2 boolean values???
Why is there so much dead code in yur VI? (All those HighResolutionTimer calls!)
There still is no error handling.
There still is no explanation of the message and its formatting.
You seems to receive a value from 0 to 20 from your Arduino. Then you add a boolean TRUE to an array, depending on the value you received. WHY don't you use just ONE array to store all data, with the received value used to index an element/row in the buffer???
What kind of data (structure) do you need?
Edit after noticing that Arduino code:
The only relevant line of code is this:
Serial.write(buffer2[i] );
"buffer2" is initialized as array of bytes, so that Serial.write is sending just one byte (aka U8).
- You need to disable the TermChar at the VISASerialPortInit function!
- You need to read exactly one byte (aka char). No need for BytesAtPort! (Well, you could read more than one byte, but then you need to handle the received byte array in a loop.)
- You need to convert the received string to an U8 array instead of using FractStringToNumber!
-