LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232- Can't continously read and write

Hi, I want to make a simple VI that continously reads data, and sends whatever is typed in the buffer. I understand I need to use VISA to do this, but it only writes ONCE and then just keeps reading. I'm not sure how to fix this. Please the the vi I have attached.


Thanks,

Dan

0 Kudos
Message 1 of 4
(2,248 Views)

The incrementing of the local variable used to set the number of bytes to read makes no sense. You should be wiring the output of the VISA Bytes at Serial Port to the input of the VISA Read just like the original example.

 

You could be (and probably are) getting an error but you would never know it since you have to abort the VI in order to stop it. NEVER wire a constant to the while loop's termination terminal and use the abort button to stop.

0 Kudos
Message 2 of 4
(2,242 Views)

What exactly do I have to do to the original vi to make it continously read/write? Simply putting the whole thing in a while loop didn't work. Any help would be amazing. I have attached the original .vi for your reference. Basically, I want to be reading all the time, and then write whatever is in the write buffer.

 

Thanks,

Dan

0 Kudos
Message 3 of 4
(2,238 Views)

Dan,

 

Put the parts in the middle inside a while loop.  Specifically the Write and Read case strcutures.  You want the initialization and the Close outside the loop so you are not repeatedly opening and closing the session (and losing data in the process).

 

Before you start modifying the example, save it under a different name.  That way you can go back to the original if you need to do so.

 

Lynn

0 Kudos
Message 4 of 4
(2,235 Views)