HALCON: Set IP Address

You are viewing an old version of the documentation. You can switch to the documentation of the latest version by clicking the top-right corner of the page.

This topic introduces how to obtain and modify the camera’s current IP address, subnet mask, and gateway in Windows using the HALCON sample programs provided by Mech-Mind.

Obtain Sample Program and Select Camera

Before obtaining or modifying the IP address, you need to download the sample program and set the camera to be connected in the program.

  1. Download the configure_camera_ip_address sample program: select Code  Download ZIP.

  2. Open the sample program in HDevelop: Open HDevelop, and drag the sample program into HDevelop.

  3. Select the line containing the info_framegrabber operator in Program Windows, and click step over in the toolbar or press the F6 key to run this line.

  4. In the Control Variables area, double-click DeviceInfos to display a list of all the available cameras.

    camera information 1
  5. In the list, double-click the camera that you want to connect, and copy the camera name after unique_name: or user_name:.

    camera information 3
    user_name is the custom camera name. You can customize the camera name in Mech-Eye Viewer.
  6. Locate the following line, and replace MechEye with the copied unique_name or user_name.

    DeviceInfo := 'MechEye'

Obtain Camera IP Address, Subnet Mask and Gateway

Please follow these steps to obtain the current IP address, subnet mask and gateway of the camera:

Run the sample program by clicking run in the toolbar or pressing the F5 key. In the Control Variables area, check the following variables for the current IP address, subnet mask and gateway of the camera.

  • CurrentIPAddressString: IP address

  • CurrentSubnetMaskString: subnet mask

  • CurrentDefaultGatewayString: gateway

If the camera firmware version is 2.0.2 or below, the above information cannot be obtained, and the error message will be recorded in the Exception variable.

Set Static IP address

This sample program sets a static IP address by default. Please follow these steps to modify the IP address, subnet mask and gateway of the camera:

  1. Click reset in the toolbar to reset program execution.

  2. Locate the following line, and change the IP address, subnet mask and gateway to the values to be set:

    IPAddressString := '192.168.1.100'
    SubnetMaskString := '255.255.255.0'
    DefaultGatewayString := '192.168.1.1'
  3. Run the sample program by clicking run in the toolbar or pressing the F5 key.

  4. Restart the camera to make the new settings take effect.

Set Dynamic IP Address

Please follow these steps to dynamically assign an IP address to the camera:

  1. Click reset in the toolbar to reset program execution.

  2. Locate the following line, and replace true with false.

    set_framegrabber_param (AcqHandle, 'GevCurrentIPConfigurationPersistentIP', true)
  3. Run the sample program by clicking run in the toolbar or pressing the F5 key.

  4. Restart the camera to make the new settings take effect.

When the camera is connected to the computer directly, the IP address of the camera cannot be dynamically assigned.

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.