LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Receiving 16 bytes after 1 millisecond

Solved!
Go to solution

Hi, I want to receive 16 bytes coming after every 1 milliseconds interval. i am using VISA configure, comport read in while loop with time delay 1 milliseconds, convert strings to byte arrays. when i count while loop iteration via numeric indicator it shows 850 and some time 866 iterations, but bytes count are just 64 and some times 48. 

0 Kudos
Message 1 of 7
(2,550 Views)
Solution
Accepted by topic author Akbar7110

That is a lot of numbers thrown at us, but not much information.

 

Receiving 16 bytes from where?  What are you communicating with?

 

"Using VISA configure", but what baud rate did you configure?

 

How does "count loop iteration" relate your "byte counts"?

 

You should attach your VI so we can see how you are doing things.

0 Kudos
Message 2 of 7
(2,545 Views)
Solution
Accepted by topic author Akbar7110

Hi Akbar,

 


@Akbar7110 wrote:

I want to receive 16 bytes coming after every 1 milliseconds interval. i am using VISA configure, comport


To read 16000 bytes/s from serial port it has to use a baudrate of >= 160kBaud.

What did you configure?

 


@Akbar7110 wrote:

read in while loop with time delay 1 milliseconds,


Why is there a delay? Which kind of delay?

 


@Akbar7110 wrote:

when i count while loop iteration via numeric indicator it shows 850 and some time 866 iterations, but bytes count are just 64 and some times 48. 


There is a problem in your code!

As you didn't attach the code you need to debug it on your own!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(2,541 Views)
Solution
Accepted by topic author Akbar7110

Please see attachement files 

0 Kudos
Message 4 of 7
(2,517 Views)
Solution
Accepted by topic author Akbar7110

First thing is to get rid of the stacked frame structure. Learn how to use data flow. The stacked frame structure should be removed from the language. Secondly, don't use "Bytes at port" to guage how bytes you read. Without knowing your devie or what the 16 bytes of data look like, you should use whatever protocol the device uses to read the data. Many serial devices terminate their data with a carriage return, line feed or some other terminatal character. Use that to complete your read. Read more than the largest record size (seems like 16 bytes might be yours) and read until the termination character is received. You are also overwriting your data every iteration so I don't know what you plan to do with it. Since your requirements are to read every millisecond, I would place the reading of data in a dedicated loop that only reads from the device. Pass the data to a different processing loop via a queue.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 7
(2,510 Views)
Solution
Accepted by topic author Akbar7110

Are you sure the device (which you still haven't mentioned) is cable of sending 16,000 bytes per second?

 

Please get rid of the stacked sequence structure and do block diagram cleanup.  Also condense your front panel.  No need to have two windows set to fill the screen and take up far more real estate than they need to.

 

Note.  A wait timer with a 1 millisecond wait in Windows is really no guarantee that it is precisely a millisecond.  And you are not really measuring how fast your bytes come in or how long that loop iteration takes.  You should use the High Resolution timer that came out in one of the more recent LabVIEW versions to measure your loop iteration time.

 

 

0 Kudos
Message 6 of 7
(2,508 Views)

Shameless plug: VIWeek 2020/Proper way to communicate over serial


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 7
(2,486 Views)