LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

maximum data read through serial port

You don't have to create a 48,000 character buffer to read 48,000 characters. Depending upon your data rate, transferring that much data through an RS232 connection could take several seconds. All you really have to do when reading the data is to keep up with the rate that it's coming in at the serial port.

Start by initializing the serial port. Next, inside a while loop continuously read the serial port, appending what you get with each read to what you have read before. When you are done reading the data, exit the loop and close the serial connection.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 11 of 19
(1,470 Views)
Hi,
Attch with test.vi and test.c.
I try to use LV to replace the code written in VC++, however still fail to get the wanted result.
The objective of the code is to get the data from the com port and process the data and save it as .bin format file.
Any help to correct my test.vi
Thanks in advance
 
Regards,
Simon76
Download All
0 Kudos
Message 12 of 19
(1,435 Views)
I wouldn't worry about duplicating C++ code. What you want is to duplicate the functionality. Start with the serial IO examples that ship with LV. Once you get the data read working then you can worry about the analysis part.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 13 of 19
(1,409 Views)

Hi Mikeporter,

Thanks for the response.

Yup, you're right, I ty to simulate as the code did, although I do able to collect the data but fail to get back the final result as the code did, means that i get back distorted signal instead of pure sine wave. I also try work to create the dll for the analysis part (invert frame), seem it crash with the LV. I had successful to create dll for the last part, from .bin format to .wav format and display on graph.

Simon76  

0 Kudos
Message 14 of 19
(1,385 Views)

Hi,

I able to solve the problems and get back the sine wave signal.

Once, thanks for the helps and advice.

regards,

Simon76

0 Kudos
Message 15 of 19
(1,358 Views)
Excellent! The thing to remember is that every computer language (like every human language) requires a different kind of though process to use them effectively. Neither way of expression is inherently any better - they are just different.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 16 of 19
(1,352 Views)
Hi Mike..
I have question here again :
Let's say i able to received 32KB of data from serial port and going to save it as .bin format file. I do notice that the file size is 69KB instead of 32KB.
When i use the binary viewer to look at the file, the first 32KB data is correct but the rest of data is a junk.
I attach with the conversion .vi. Any idea what's going on here??
 
 
0 Kudos
Message 17 of 19
(1,334 Views)
The write function basically looks ok. The only thing I would say is that the first write isn't needed. If you set the prepend array size to true it will put the number of bytes at the beginning of the file for you.

Beyond that I think there may be a more basic logical error here. When you call this VI are you wanting to replace the existing file or append to the end of the existing file? If you are wanting to replace the file, change the function input to the file open function to create or replace. The way it is, your code is overwriting the data in the existing file starting from the beginning. Hence if the original file was 69k and you wrote 32k of new data, the first 32k would be the data you wrote and the rest would be what is left from the original file contents. This makes the file larger than it needs to be, but it should still work if your reader VI is really using the byte count to determine how many bytes to process.

If you are wanting to append the new stuff to the end of the file you have to use the set file position function to set the marker to EOF (the end of file) before you start writing.

Finally, why are you using the binary file IO functions to write a string?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 18 of 19
(1,324 Views)

Yup. You're man. What I want is to create or replace the file and now I get back the 32K data files. Thanks alot.

As I have create a dll to convert bin file to wave file, so all my data need to save as bin format file. Previously, i have try purely LV to create wave file by add header format to my compile data but seem not success, and i gonna to look at this issues again..

Once again, thank for your help.

regards,

Simon76

0 Kudos
Message 19 of 19
(1,311 Views)