From the previous contents, OV7670 camera module will input the pixel data to FPGA board, then, these data can be stored and displayed through VGA port to the monitor. However, there is a problem in the data transmission part between the OV7670 module and FPGA board. From the manual of OV7670 [1], the RGB565 data for single pixel is divided into 2 parts, first byte and second byte. Hence, the first mission is completing the data conversion from 8 bits to 16 bits.
![]() |
| Figure 1. Two bytes combination of single pixel data |
In this part, the simplest way is directly combining 16 bits together. Hence, there should be a temporary register to store the previous 8 bits and combine it with the next 8 bits. Moreover, due to the requirement of enable signal for sending the pixel data to certain address, the enable signal should also be adjusted.
16_enable is the enable signal for the 16 bits data and 8_enable is the enable signal for 8 bits signal. According to the previous information, 8_enable has twice frequency of 16_enable, then, this property should be designed to ensure the address and pixel data can output synchronously.
To complete the frequency division, the first enable signal should be determined and this information can be found from the OV7670 manual. According to Figure 1, the first byte data present just after the HREF signal become high, therefore, the first 8_enable signal can be assigned as HREF signal. Then the next 8_enable signal is the inverse of previous 8_enable, this method can divide the frequency of 8_enable signal to 1/2 of original frequency and the 16_enable is obtained. Finally, the 16_enable should be the AND result of 8_enable signal and HREF because the data is available only within the high HREF.
The conversion of pixel data is not difficult, however, only 12 bits of RGB signal can be enough for displaying, hence the highest 4 bits for each single for RGB are combined as a single 12 bits signal.
![]() |
| Figure 2. Implementation of conversion from 8 bits to 16 bits |
Reference:
[1] Omnivision, "OV7670 CMOS VGA(640*480) Camera Chip", July 8 2002, [Online]. Available: https://www.voti.nl/docs/OV7670.pdf


No comments:
Post a Comment