HALCON: Set IP Address
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.
-
Download the configure_camera_ip_address sample program: select .
-
Open the sample program in HDevelop: Open HDevelop, and drag the sample program into HDevelop.
-
Select the line containing the info_framegrabber operator in Program Windows, and click in the toolbar or press the F6 key to run this line.
-
In the Control Variables area, double-click DeviceInfos to display a list of all the available cameras.
-
In the list, double-click the camera that you want to connect, and copy the camera name after unique_name: or user_name:.
user_name is the custom camera name. You can customize the camera name in Mech-Eye Viewer. -
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 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:
-
Click in the toolbar to reset program execution.
-
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'
-
Run the sample program by clicking in the toolbar or pressing the F5 key.
-
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:
-
Click in the toolbar to reset program execution.
-
Locate the following line, and replace true with false.
set_framegrabber_param (AcqHandle, 'GevCurrentIPConfigurationPersistentIP', true)
-
Run the sample program by clicking in the toolbar or pressing the F5 key.
-
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. |