From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

How to program for dynamic field point?

Solved!
Go to solution

I am programming an application using Fieldpoint. On the computer that I am coding, the communication port used for cFP is COM3. However on the deployment machine the communication port to be used is COM1. What is the simplest way to NOT having the COM port hardcoded in the program? The solution might have nothing to do with Fieldpoint.

0 Kudos
Message 1 of 4
(6,224 Views)

Hey LesElec,

 

I just want to make sure I'm understanding you correctly. On your development machine your compact FieldPoint (cFP) shows with the COM3 alias in the Measurement & Automation Explorer (MAX). And this is how you reference the device in your program(LabVIEW?). When you move to your development machine the alias for the cFP in MAX is COM1. Is this all correct?

 

When you say that you don't want it "hardcoded" in the program, do you mean that you want the program to automatically pull the correct Alias for the device from MAX? I guess I'm kind of confused as to what you want your program to. If its simply something that's hard coded as a constant, you can always switch it to a control so that you can change the value for COM by cross reference what Alias MAX gives it. 

 

Some screen shots of your MAX configuration and the portion of your code that you're concerned with would be useful here. Code you go ahead and post those for us to look at?

Tim A.
0 Kudos
Message 2 of 4
(6,217 Views)

Thank you for your reply Tim-A

 

I just want to make sure I'm understanding you correctly. On your development machine your compact FieldPoint (cFP) shows with the COM3 alias in the Measurement & Automation Explorer (MAX). And this is how you reference the device in your program(LabVIEW?). When you move to your development machine the alias for the cFP in MAX is COM1. Is this all correct?

Correct.

 

When you say that you don't want it "hardcoded" in the program, do you mean that you want the program to automatically pull the correct Alias for the device from MAX?

Yes

 

Now that you mentioned it, I tried to change that constant to a control. However, instead of selecting only ports, I will need to select channel too. For e.g. If I just needed to select the COM on the front pannel and it automatically attach the channel - that can be part of the solution (If there is NO way to automatically program the app to pull the right Alias).

 

Below is a simple example -

 

cFP_Dynamic_COM.JPG

0 Kudos
Message 3 of 4
(6,210 Views)
Solution
Accepted by topic author LesElec

Simplest way is to store the COM setting in a config file (.INI) and then build I/O strings from that.  FP Read will accept a string.  If you don't like the coerce, then use a typcast.  I've shown both in attached snippet.  You could also go into the advanced FP tab and use tags.

 

 

 

0 Kudos
Message 4 of 4
(6,163 Views)