LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plug and play Serial COM with NI VISA

Hi all,

Is it possible to plug and play microcontroller to labview? While the VI is running with some task, I want to plug my microcontroller through serial com and read it on front panel automatically without configuring "visa resource name" first and interrupting the running VI. Is it possible?

Thankyou.

0 Kudos
Message 1 of 4
(1,330 Views)

Yes, it is possible.  Kind of a pain to do.  First you have to detect which COM ports are available (Find VISA Resources) and then go through each one with the known serial port settings and check the communications until you find one that works.  Since you are dealing with a microcontroller, you can make life a little easier by making sure there is some command that the computer can send to have the microcontroller identify itself (a simple loop back command would do it).  Once you determine you have communications set up, you can continue with normal operation.


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 2 of 4
(1,306 Views)

Hi crossrulz,

I've tried VISA Find Resource and it run successfully if my usb-to-ttl already plugged in. If there is no COM port available it always return error.

Do you have some reading reference that maybe can help me?

Thankyou.

0 Kudos
Message 3 of 4
(1,295 Views)

You are expecting it to return an error if itcannot find the correct COM port so this should all be part of the plan. All you will need to do now is discard that error.

 

If you know the specific error that you will always get back if you are missing the port then you can use "Error Clear" with a specific value and work off the boolean output from it. If you get a range of errors (you probably shouldn't) then you can just clear all the errors and trigger your "TTL found" case with something else.

 

 

0 Kudos
Message 4 of 4
(1,250 Views)