Forum

Please or Register to create posts and topics.

Stone TFT LCD module+STM32+Ultrasonic distance measurement

This project shows how to use the STONE display, STM32 microcontroller, ultrasonic sensors, and a servo. The purpose of the project is to be able to display the distance measured by ultrasound in real-time through the STONE display.

Supplies used in the project:

The display uses an 8-inch STONE screen, 8-inch intelligent TFT-LCD (thin-film transistor - liquid crystal display) industrial display module.

working principles:

Through the existing command set provided by the product, this TFT-LCD module can generate command transmission and recognition with the main controller. The main controller receives the commands from the TFT-LCD module to operate the industrial equipment.

Note: The engineer can use any microcontroller to design the main controller.

GUI design:

part of code:

void HOME(void *argument)

{

/* USER CODE BEGIN HOME */

/* Infinite loop */

 

uint8_t data_ico[24]=  {0xA5, 0x5A, 0x14, 0x85, 0x00, 0x00, 0x00 ,0x00 ,0x00 ,0xff ,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};

uint8_t k = 0;

uint16_t j = 0,bit = 0;

 

for(;;)

{

 

if(bit_state)

{

if(bit == 0)

{

j++;

}

else

{

j--;

}

 

if(bit == 0 && j >= 180)

{

bit = 1;

}

else if(bit == 1 && j <= 0)

{

bit = 0;

}

}

jiaodu = j;

 

 

//x is Horizontal

//y is Vertical

for(k=0;k<7;k++)//Refresh the ico icon

{

if(Y>=600)

Y = 600;

if(Y<170)

Y = 170;

 

data_ico[5] = X>>8;//x

data_ico[6] = X;

data_ico[7] = Y>>8;//y

data_ico[8] = (Y+k)&0x00ff;

UART1_Send_Array(data_ico,23);

}

 

 

//Refresh display distance

data_send[4]=0x06;

data_send[5]=0xc8;

data_send[6]=juli>>8;

data_send[7]=juli;

UART1_Send_Array(data_send,8);

 

 

//Refresh pointer angle

data_send[4]=0x00;

data_send[5]=0x01;

data_send[6]=0x00;

data_send[7]=jiaodu;

UART1_Send_Array(data_send,8);

 

 

// data_page[5] = 1;

// UART1_Send_Array(data_page,6);//Switching pages, for refreshing

 

 

vTaskDelay(pdMS_TO_TICKS(10));

osDelay(1);

}

/* USER CODE END HOME */

}

Results Demo