Share this

[Machine Vision and Motion Control All-in-One Machine Mini-Lesson] How to Perform Camera-Related Data Acquisition Operations in Three Minutes

2026-04-06 03:34:20 · · #1

background

In machine vision projects, image acquisition involves using imaging devices, specifically industrial cameras, to obtain real-time images. This process constitutes the information about signal distribution.

In simple terms, it involves placing the product within the camera's field of view, acquiring the product's features such as shape, size, color, and position through the camera, and then transmitting the acquired image information to a machine vision motion control integrated machine.

In the previous lesson, we discussed how to perform geometric transformations of images using a machine vision motion control all-in-one machine. This lesson, from Motion Assistant, will share how to use a camera to perform related data acquisition operations with a machine vision motion control all-in-one machine.

Instructional Videos

01VPLC Controller

(I) VPLC516E Architecture Diagram

(II) Pre-class Preparations: 1. One computer with ZDevelop software version 3.10 or higher installed. 2. One VPLC516E machine vision motion control all-in-one machine. 3. One 24V DC power supply. 4. Two network cables. 5. One self-branded positive motion camera.

6. Several electrical wires

(III) Preparations before connecting the camera to the machine vision motion control integrated machine

(iv) Instructions for setting up the camera's network port IP address

1. First, go to the Advanced Network Settings on your PC and change the adapter option to modify the IP address of the network port that the camera and computer are connected to. Set it to 192.168.1.10, and then add the jumbo frame.

IP settings

Open the giant frame

2. Next, go to the corresponding camera brand driver software and change the camera's IP address to the 192.168.1.X network segment.

The camera's network port IP configuration is now complete. After configuring the IP, connect the camera to the LAN2 port on the machine vision motion control all-in-one machine to acquire images normally. (This process does not need to be repeated without changing the camera's IP address.)

(V) Precautions for Controller Scanning Camera 1. Check if the camera type is supported by the VPLC516E machine vision motion control all-in-one machine. 2. Check if the camera network segment is on the same network segment as the controller (the controller and camera can only communicate if they are on the same network segment), and check if the camera IP is occupied. If it is occupied, please change the camera IP or the machine vision motion control all-in-one machine IP and ensure they are on the same network segment. 3. Check if the camera has been connected to another host. If it has, please power off and restart the camera. Check if the camera's wiring is loose and if the camera's network port indicator light is normal.

02 The main instructions used in the course

03 Software Implementation

1. Open ZDevelop software: Create a new project named "Example of using camera for related data acquisition operations.zpj" → Create a new HMI file → Create a new "Basic.bas" file (used to write the interface response function and enable the HMI to run tasks automatically) → Add the file to the project.

2. Design the HMI main interface and the associated control variables.

3. Write a response function for an example of the camera performing relevant data acquisition operations.

·

ZVOBJECT Image 'Define image variable GLOBAL CAMERA_TYPE 'Define camera type GLOBAL cam_num 'Define number of cameras variable GLOBAL gv_readimgmod 'Define image reading mode GLOBAL gv_index 'Define image index variable GLOBAL File_Name(30) 'Define the path name of the image GLOBAL grab_switch 'Define the capture switch GLOBAL CONST gc_grabtask_id=9 'Define the capture thread task number cam_num=0 gv_readimgmod=0 gv_index=0 grab_switch=0 end

'Interface Initialization Functions''''''''''''GLOBAL SUB hmi_init() ZV_ENVINIT() 'ZVision runtime environment initialization ZV_SETSYSSTR("DataDir","")'Set the default data directory ZV_LATCHSETSIZE(0, HMI_CONTROLSIZEX(10, 1), HMI_CONTROLSIZEY(10, 1)) 'Set the latch size ZV_LATCHCLEAR(0) 'Clear latch channel 0 END SUB

' ... cam_num-1 CAM_SEL(lv_i) 'Select the scanned camera for operation CAM_SETEXPOSURE(5000) 'Set the camera exposure time to 5000us CAM_SETMODE(0) 'Set the software trigger mode CAM_START(1) 'Start the camera nextEND SUB

Image Acquisition Function Executed when the "Acquire Image" button is pressed on the HMI interface: GLOBAL SUB btn_read_img() local lv_i if gv_readimgmod=1 THEN 'Loop through image index if(gv_index=11) then gv_index=0 endif File_Name="Camera Acquisition/" + TOSTR(gv_index,1,0) + ".bmp" 'Determine the image path ZV_READIMAGE(Image,File_Name,0) 'Read the local image ZV_LATCH(Image, 0) 'Display the image in latch area with latch channel number 0 gv_index=gv_index+1 RETURN endif if cam_num = 0 then ?"Please scan the camera first!" return endif for lv_i=0 to cam_num-1 CAM_SEL(lv_i) CAM_SETPARAM("TriggerSoftware", 0) 'Send trigger command CAM_GET(Image, 0) 'Get a frame of image and store it in the grabImg variable ZV_LATCH(Image, lv_i) 'Display the image in latch channel 0 nextEND SUB

'Continuous Acquisition' Function responding to pressing the continuous acquisition button on the HMI interface GLOBAL SUB btn_cgrab() if grab_switch = 1 then 'If already in continuous execution state, print a prompt message and exit the function "Running continuously, do not repeat!" return endif if( gv_readimgmod = 0) then if cam_num = 0 then 'If the number of cameras = 0, print a prompt message and exit the function "Please scan the cameras first!" return endif endif grab_switch = 1 'Set the acquisition task switch to 1 if (1 = grab_switch) then if (0 = PROC_STATUS(gc_grabtask_id)) then RUNTASK gc_grabtask_id, grab_task() 'Start the continuous acquisition task endif endif END SUB

'Continuous data collection task'

'The function to implement the data acquisition task is GLOBAL sub grab_task() while(1) if (0 = grab_switch) then 'If the data acquisition task switch = 0, i.e., the stop data acquisition button is pressed, exit while 'Exit the loop endif 'Repeat the following operations btn_read_img() delay(20) wendENDSUB

'Stop Task' Function responding to pressing the Stop Acquisition button on the HMI interface: GLOBAL SUB btn_stopCgrab() if grab_switch = 0 then 'If acquisition is already stopped, print the message "Continuous acquisition not enabled!" and exit the function. return endif grab_switch = 0 'Reset the acquisition task switch to 0. END SUB

4. Effect demonstration.

Full code download address

That concludes our lesson on "Machine Vision Motion Control All-in-One Machine Mini-Lesson" from Zheng Motion Technology, which covers implementing camera-related data acquisition operations in just three minutes.

For more exciting content, please follow the "Zheng Motion Assistant" WeChat official account. For related development environment and example code, please contact Zheng Motion's technical sales engineer: 400-089-8936.

This article is original content from Zheng Motion Technology. We welcome everyone to reprint it for mutual learning and to jointly improve China's intelligent manufacturing level. Copyright belongs to Zheng Motion Technology. Please indicate the source if you reprint this article.


Read next

CATDOLL 146CM B-CUP Tami (TPE Body with Hard Silicone Head) Customer Photos

Height: 146cm A-cup Weight: 26kg Shoulder Width: 32cm Bust/Waist/Hip: 64/54/74cm Oral Depth: 3-5cm Vaginal Depth: 3-15c...

Articles 2026-02-22