LCD display CCD data in waveform1.Experimental Purpose2.Experimental wiring3.Main program analysis4.experimental result
Through the first experiment, it was found that the operation of the linear CCD module was severely affected by the working environment. Then, through the last experiment, we found that the algorithm introducing dynamic threshold can eliminate the impact of environmental light on the CCD camera. The purpose of this experiment is to draw waveforms on the LCD screen using 128 data from a CCD camera and verify whether the data processed by the algorithm is correct.
1.Wiring of STM32 and CCD module
STM32/GD32 | CCD |
---|---|
PA4 | SI |
PA3 | CLK |
PA5 | AO |
2.STM32/GD32 and screen wiring (choose one of the following two options) Using STM32/GD32 and LCD screen wiring (LCD screen needs to be purchased separately)
STM32C8T6/GD32C8T6 | LCD |
---|---|
PB10 | SCLK |
PB11 | MOSI |
PA7 | RES |
PB0 | DC |
PB1 | CS |
PA6 | BLK |
STM32RCT6 | LCD |
---|---|
PB8 | SCLK |
PB9 | MOSI |
PC11 | RES |
PC12 | DC |
PD2 | CS |
PC10 | BLK |
If you directly purchase our black STM32/GD32, you can directly connect the LCD screen to the LCD screen interface on the board without using DuPont cables
The resolution of the LCD screen is 128 * 64, and the linear CCD also has exactly 128 data, so it is just enough to display the CCD data.
uint8_t* CCD_Get_ADC_128X64(void)
{
//Convert 8-bit AD values to 6-bit AD values
for (int i = 0; i < 128; i++)
{
ADC_128X64[i] = ADV[i] >> 2;
}
return ADC_128X64;
}
CCD_Get_ADC_128X64: This function is to return the ADV acquisition voltage values of 128 pixels and compress the amplitude into 128 * 64.
After burning the normal code, it can be observed that the OLED screen/LCD screen has the following display, and the following figure shows the display effect of the OLED screen
Yuzhi:Dynamic threshold
Zhongzhi:mid-value
By offsetting the lens, it can be seen that the median is changing and the waveform is also changing, indicating that the dynamic threshold algorithm is the correct choice. It is best to experiment in an environment with only black and white lines for the best results.