Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial port not shown in MAX

Solved!
Go to solution

Hi all,

 

I have connected an NI USB to RS485 cable connected and working.

 

Since it's a working project I did use abort button to stop the VI. Which is the reference of the RS485 is not closed. Will that cause the device to unregister it's port reference completely?

 

I have went through some of the discussion forums already and the solution does'nt match mine scenario.

 

My NI Device Motoring is up and running from startup. Also all I need to bring it back to list in MAX is to unplug and plug it back again.

 

Any suggestion o comments?

0 Kudos
Message 1 of 15
(4,494 Views)

Hello grimmy123,

 

I do not think I fully understanding the problem. What port reference are you referring to in your first question?

 

From what I understand, your device dissappears from MAX, but unplugging it and plugging it back in seems to fix the issue. Are you asking what is causing this behavior to happen and why?

 

I hope you are having a great day,

 

Weston S.

Applications Engineering

National Instruments

0 Kudos
Message 2 of 15
(4,444 Views)

Hi Weston,

 

Appreciate your response!!

 

The port reference I'm refering to is VISA read/write reference out to VISA close.

 

Exactly I'm not sure exactly what's causing my device to dissappear from MAX?

 

-Grimmy123

0 Kudos
Message 3 of 15
(4,431 Views)

Hello @grimmy123,

 

If you could post a screenshot of your code and/or what your configuration is in MAX this will help me better understand what you are seeing as we try to find what might be causing your device to disappear in MAX.

 

Thanks!

 

Weston S.

Applications Engineering

National Instruments

0 Kudos
Message 4 of 15
(4,413 Views)

Hi Weston,

 

Please find the images as follows,

 

1. This is what I get in NI MAX, Initially I was getting seperate Device and Interfaces as NI-RS485 and showing the ports.

 

RS485_MAX.png

 

2. This is my sample code. Very basic, sometimes I abort it as a part of development.

 

RS485_Test Code.png

 

3. This is from my main application where I use Objects, Parent Class is Communication, Child 1 is CAN & Child 2 is RS485.

 

RS485_Main Code.png

FYI, I just found that the reference out of "VISA read" not bundled back to the object references (I corrected the code as shown above). But I close the reference in of "VISA Flush" when the task is completed.

 

Will this be causing me the problem?

0 Kudos
Message 5 of 15
(4,401 Views)

Hi @grimmy123,

 

Thank you for adding those screenshots. I do not see any red flags in your code at first glance that could be causing what you are seeing. But just so that we are both on the same page, are you saying that from what you understand, aborting your program in LabVIEW is causing your NI-RS485 device to dissappear in MAX? I am going to try to replicate what you are seeing on my end and want to make sure I am trying trying to replicate the same behavior you are seeing.

 

Regards,

 

Weston S.

Applications Engineering

National Instruments

 

0 Kudos
Message 6 of 15
(4,386 Views)

Hi Weston,

 

Yeah, that's what i'm guessing. I'm not sure what exactly is happening. FYI, I tried some solutions which are already in the forums but didn't work out.

 

 

0 Kudos
Message 7 of 15
(4,375 Views)
Solution
Accepted by topic author grimmy123

Good Afternoon @grimmy123,

 

http://www.ni.com/documentation/en/labview-comms/2.0/debug/abort-execution/

 

With reference to the document above: "Aborting a program that uses external resources, such as external hardware or file I/O operations, might leave the resources in an unknown state and cause the program to return errors the next time you access the resources. An alternative to using the Abort button is to enclose code that uses external resources in a While Loop with a Stop button. Using the Stop button instead of the Abort button cleans up external resources before stopping execution."

 

I recommend that you do not press the abort button to exit your program. It can cause unexpected behavior such as the behavior you are seeing. It seems like you have found a good work around. I cannot say one way or the other whether it will cause the device to unregister its port completely. I tried replicating this issue and the device did not unregister its port completely. However, that does not guarantee that this is what will occur for you as leaving resources in an unknown state by pressing the abort button results in unpredictable behavior. I would recommend not using the abort button and implementing a stop button in your code that will close out the reference as it appears you already have in screenshot number 2.

 

I hope this helps!

 

All the best,

Weston S.

Applications Engineering

National Instruments

 

Message 8 of 15
(4,354 Views)

Hi Weston,

 

Appreciate your extended support.

 

I also have another question which I am not clear. Is it mandatory to create a COM port in MAX for the USB to RS485 cable or the PXI system will detect them automatically?

 

0 Kudos
Message 9 of 15
(4,346 Views)

Hello @grimmy123,

 

The PXI system will automatically detect the COM port.

 

I hope this helps!

 

All the best,

Weston S.

Applications Engineering

National Instruments

0 Kudos
Message 10 of 15
(4,329 Views)