NI Home > Community > NI Discussion Forums

FieldPoint Family

Showing results for 
Search instead for 
Do you mean 
Reply
Member
LesElec
Posts: 12
0 Kudos
Accepted Solution

How to program for dynamic field point?

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.

Active Participant
TimothyA
Posts: 205
0 Kudos

Re: How to program for dynamic field point?

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.
National Instruments
Member
LesElec
Posts: 12
0 Kudos

Re: How to program for dynamic field point?

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

Trusted Enthusiast
Wayne.C
Posts: 2,016
0 Kudos

Re: How to program for dynamic field point?

[ Edited ]

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.