Simulnk receives, STM32 sends
1. Search for the Serial Configuration module and set the parameters as shown in the figure
2. Search for the Serial Receive module and set the parameters as shown in the figure. Among them, Data size is the number of data bytes. Take 3 bytes as an example, select uint8 for Data Type
3. STM32 set to send three bytes, respectively 250, 1, 100
uint8_t txtemp[3] = {
250,1,100};
HAL_UART_Transmit(&huart4,txtemp,3,100);
4. Experimental results
Simulnk sends, STM32 receives
1. Select 3 constant values, the type is uint8, select MUX, the input is 3port, connect
2. Select the Serial Send module, select the serial port and connect it.
3. Set the receiving buffer array on the STM32 end and download the program
u8 rectemp[3];
HAL_UART_Receive(&huart4,rectemp,3,100);
4. Simulink running program