I. Overview Machine vision technology is an emerging technology that has developed rapidly in recent decades. Machine vision can replace human vision in tasks such as inspection, target tracking, and robot guidance, especially in situations requiring repetitive and rapid acquisition of precise information from images. Although machine vision functionality is still in its early stages under current hardware and software technology conditions, its potential application value has attracted significant attention worldwide. Developed countries such as the United States, Japan, Germany, and France have invested substantial resources in research, achieving breakthroughs in certain areas of machine vision in recent years. Machine vision is also increasingly demonstrating its important value in applications such as vehicle safety technology and automation technology. This paper designs a general-purpose vision system module based on the latest CMOS image acquisition chip. After programming different image processing and pattern recognition algorithms, this module can be applied to various applications such as soccer robots and unmanned vehicles. II. Design Principles The system principle block diagram is shown in Figure 1. The system contains five main chips: an image acquisition chip OV7620, a high-speed microprocessor SH4, a large-scale programmable array FPGA, and a serial communication control chip MAX232. The FPGA internally programs two dual-port RAMs to generate the point frequency, line and field synchronization signals required by the image sensor, and to control the storage timing of the dual-port RAMs. SH4 is responsible for configuring the OV7620 via I2C, reading image data from the dual-port RAMs, processing it, and uploading image data or controlling stepper motors and other devices via serial port. III. Image Acquisition Module The system module is based on the CMOS image sensor OV7620, and also includes a focusing lens and other auxiliary components such as a 27MHz crystal oscillator, resistors, and capacitors. CMOS image sensors are a rapidly developing type of image sensor in recent years. Because they use the same CMOS technology, the pixel array and peripheral support circuitry can be integrated on the same chip, forming a complete image system (Camera on Chip). This system uses an Omnvision CMOS color image sensor OV7620 with a resolution of 640x480. It can operate in progressive scan mode as well as interlaced scan mode. It can output color images and can also be used as a monochrome image sensor. This chip supports multiple image output formats: 1) YCrCb4:2:2 16-bit/8-bit format; 2) ZV port output format; 3) RGB raw data 16-bit/8-bit; 4) CCIR601/CCIR656 format. Its functions include contrast, brightness, saturation, white balance, automatic exposure, synchronization signal position and polarity output, frame rate, and output format, all of which can be programmed and configured via the I2C bus using on-chip registers. The focusing lens is the DSL103 lens manufactured by Sunray Science. This lens is small and suitable for embedded vision sensor applications. IV. FPGA Interface Module The FPGA used is the Xilinx xc2s100, which integrates 10,000 logic gates. The interface program is written in VHDL (Very High Speed Integrated Circuit Hardware Description Language). To improve the data transmission rate, two dual-port RAM buffers, each 127KB in size, are allocated within the xc2s100, with each dual-port RAM storing one line of image data. Two sets of dual-port RAMs switch between odd and even row counters. Once a row is stored, an interrupt request signal to read that row of data is immediately sent to SH4. The internal structure of the FPGA is shown in Figure 2. The main problem here is that the dual-port RAM read and write operations within the FPGA share the same data bus and address bus. When read and write operations are performed simultaneously, timing issues arise, leading to errors in the written or read data. To prevent data and address bus conflicts in these two processes, a central bus arbitrator is designed inside the FPGA. Based on the order of common data transmission, the central arbitrator first accepts the bus request from the image sensor. Only after the image is stored in the RAM does the central arbitrator respond to the microcontroller system's read signal request. The structure and read-write control program of dual-port RAM are given here: Entity dual_port_ram is Generic(d_width:integer:=2; Mem_depth:integer:=8); Port(clk:in STD_LOGIC; CS:in STD_LOGIC; We: in STD_LOGIC; Indata: in STD_LOGIC_VECTOR(7 downto 0); Outdata:out STD_LOGIC_VECTOR(7 downto 0); Raddr,waddr:in STD_LOGIC_VECTOR(1 downto 0)); End dual_port_ram ; Architecture data of dual_port_ram is Type mem_type is array(3 downto 0) of STD_LOGIC_VECTOR(7 downto 0); Signal mem:mem_type; If(we='1')then Mem(conv_integer(waddr))<=indata; End if; End process; Process(raddr,clk) Begin If (rising_edge(clk))then If (CS='0')then Outdata<=mem(conv_integer(raddr)); End if; End if; End process; End data; The waveform simulation diagram in MAX Plux II is shown in Figure 3: V. Microcontroller Module This system uses the SH4 chip as the processor: The SH4 microcontroller is a low-power, high-performance, RISC (Reduced Instruction Set Computer) full 32-bit microcontroller launched by Hitachi. Its processing speed can reach up to 60MIPS-100MIPS, it can operate at 2.25V, and the power consumption is only 400MW. It integrates a 32-bit multiplier, 4-channel 5KB cache, memory management unit (MMU), and other general-purpose interfaces and clock circuits. Hitachi provides an integrated compiler (HIM) for C and C++ languages for its SH4 series microcontrollers. This compiler can be used to compile and link Hitachi C and C++ source code into assemblers or object machine code. The OV7620 image sensor chip features flexible programmability and can be programmed via the I2C bus to configure its function registers. Since the microcontroller lacks an internal hardware I2C bus interface, software simulation is used to implement the I2C bus interface functionality. Two I/O pins of SH4 are used as the SCL and SDA bus interfaces of the I2C bus. An example program is as follows: `unsigned char rdiic (unsigned char addr);` Read data `void iic_init();` Initialize `void iic_start();` Start signal `void iic_stop();` End signal `void delay4u();` Delay example `iic_init();` /* Initialize bus registers */ `rstcamera();` /* Reset OV7620 internal registers */ `wriic (0x11, 0x15);` /* Set the value of OV7620 internal register 0x11 to 0x15 */ `delay4ux6();` `wriic (0x28, 0x60);` /* Set the value of OV7620 internal register 0x28 to 0x60 */ `delay4ux6();` This module uses the human-readable ASCII serial communication protocol, allowing for convenient interaction and communication with humans via a host computer. When connected to a computer, this module can upload the entire original image data via the serial port for system debugging or more advanced image processing. VI. Conclusion This paper presents a simple and low-cost image acquisition and processing system composed of large-scale integrated circuit chips. This system, after being programmed with different image processing algorithms, can be applied to various applications such as soccer robots and agricultural product inspection robots. However, it also has some shortcomings, such as the SH4 processor, which has insufficient processing speed, can only run relatively simple algorithms, and does not support Ethernet interfaces. Future work plans to adopt a dual-CPU structure, with the DSP dedicated to image data processing and the ARM responsible for network communication and robot behavior control. This would allow the robot's "eyes" to be connected via Ethernet into a complex collaborative vision system to adapt to more complex scenarios. References 1. OV7620 single-chip CMOS CIF color digital camera Data Sheet. OmmVision, 2001 2. Wang Hongjun. Machine Vision - The Eyes of Modern Industry. Mechatronics. 1999.3 3. Zhong Yuzhuo et al. Robot Vision Technology. Beijing: National Defense Industry Press, 2002. 4. Li Zhenyu. Image Communication and Monitoring System. Beijing: China Railway Publishing House, 2001.