LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Serial data with Handshake


@johnsold wrote:

Reading and writing 20 bytes each at 9600 baud takes about 42 ms. With the 200 ms Wait your code may get bogged down trying to keep up with the initialization messages. It certainly slows your data transfer by a factor of ~5.

 

 

Lynn


Of course it slows down. Reason why I wanted to know if there is a method to time the loop based on End of Write and End of Read. I can then switch over to a State Machine architecture to step thorugh the Reads and Writes without wasting time in looping...

 

@But as of now I have sort off kept the while loop running at about 200 ms to have enough cushion to handle the string data which is 72 bytes long. So @9600 this should take about 75ms. Its working OK till now...

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 11 of 13
(818 Views)

MogaRaghu wrote:

I know all of you wanted me to steer clear of "Bytes at Port" property and use a constant value instead. But what is puzzling is when i tried that, the Read was waiting for ever and timed out. I dont think i missed anything but still it does not work.


If nothing is coming in, then you will get the timeout.  I like to use the Bytes At Port to see if a message has come in and then use a "large" constant for the actual read.  This way I am not sitting there waiting for the timeout but I am also guarding from not getting my entire message.

 

Here is a snippet of what I do.  Note that I have a 10ms wait in the "0" case so that the loop does not become greedy.

 

This snippet came from this thread: VISA read and write controls become unresponsive after there are no more lines to read


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
Message 12 of 13
(812 Views)

Perfect. That was the idea i was looking for but quite didn't get it .

 

Thanks Crossrulz !!

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 13 of 13
(799 Views)