06-28-2018 01:01 PM
Hello everyone.
i want to write data that i take from serial port ( Arduino ) in to Excel file.
so i need to know how to do that.
i put picture of data that is in serial port and how must be saved in excel file.
so please let me know how i program it in labview.
really thanks for your help.
06-28-2018 01:53 PM
Search the example finder and the forum for examples on how to read a serial port.
Search the example finder and the forum for examples on how to write to an Excel file. Do you want to write to an actual Excel file? Or is writing to a text file that Excel can import okay?
06-28-2018 04:42 PM
If your sketch is using the println() command you already have a carriage return and newline termination characters built right in. As RavensFan said skip using bytes at port and just set up your read in a while loop led with configure serial port vi set to 9600 baud and com3. Basically mimic what the Arduino serial monitor settings are. When you run your vi make sure the arduino serial monitor is closed.
06-28-2018 09:17 PM
Thank you for your answer. i just write it in excel file.
i searched to many example but couldn't take good result.
@RavensFan
06-28-2018 09:21 PM
Thank you for your answer.
yes i use Serial.print()can you put here one example like what you say.
thanks
06-28-2018 09:27 PM - edited 06-28-2018 09:32 PM
Just a quick pointer - note that you wrote "Serial.print(...)" and the earlier post specified "Serial.println(...)"
The difference is in the presence of an automatic termination character from the Arduino, which is probably what you're missing to make your code work as RavensFan and GovBob suggested.
Edit: I read more carefully and noticed you don't seem to currently have any code. An example that probably fits the ideas being suggested can be found via the Example Finder (Help > Find Examples...) and searching for "VISA Serial" then selecting Simple Serial.vi.
If you were looking for something more modern/simple, I'd suggest using the "Configure VISA Serial Port" VI for the beginning part of the VI.
I'll post an example if I don't run out of edit time.
06-28-2018 09:31 PM
this is program i made. but it is not working like i want. i means i cant see records in excel file and every time i run program just it make to many excel file opened ( empty ).
06-28-2018 09:42 PM
Thanks for uploading code. I guess you can ignore most of my previous message.
Some ideas/comments on your VI:
Good luck!
06-28-2018 10:05 PM
>the number 1 or 2 or .... is OK. because i want to see just witch RFID reader worked and return it to LED blinking.
two problem i have:
1- when i run program i just want to read data that come from Serial.print(). but when i record it in labview, it start to record empty and my data together. so i will have to much unusable data.
i just need when i put ID card near RFID reader, have data like ( Reader:1, ID: sff33rfgfd)
2 - i want to record number 1,2,3,... in on excel column and ID in another column. that i can know witch ID card used from Witch Reader.)
06-28-2018 10:26 PM
Your first problem is addressed by using a termination character (like with println), and then removing any timeouts from the read. You can also remove the Wait. Be careful regarding the LED flashing - it will show the previously scanned reader's light whilst waiting.
The second issue can be addressed by your string parsing - if they always follow a ":" character, consider using that if the lengths might change. If you're sure you'll never have 10 readers, or change the formatting of the strings, then a constant is fine. Hopefully some rearrangement of the string parsing with regards to the bullet points above might help you get a clearer output.