3476 views|3 replies

419

Posts

9

Resources
The OP
 

【GE32E231_DIY】FreeRTOS+DAP_RTT+Multi-function button+USART_DMA and add FREEMODBUS [Copy link]

FreeRTOS+DAP_RTT+Multi-function button+USART_DMA and add FREEMODBUS

So far, the project has been realized step by step, and it is not easy to debug step by step. Thanks to my family for their support, Cheng has the time code.

FreeRTOSv10.2.1_MultiButton_FreeModbus_ok.rar (11.51 MB, downloads: 257)

The main idea of freemodbus is to use a state machine to implement sending-interrupt, receiving-interrupt, hard time confirmation, plus a poll

int main(void)
{
systick_config();
// button_enable();
// CreateSoftwareTime();
LED_Init();
eMBInit(MB_RTU, 0x01, 1, 115200, MB_PAR_NONE);//Initialize Freemodbus data, timer, serial port (including interrupt), working state
eMBEnable(); //Start receiving interrupt and wait for serial port data to arrive
/* Create tasks. */
prvCreateTasks();
NVIC_SetPriority_Init();
NVIC_EnableIRQ_Init();
// TIMER2_Config();
/* Start scheduler. */
vTaskStartScheduler();
/* Will not get here if the scheduler starts successfully. If you do end up
here then there wasn't enough heap memory available to start either the idle
task or the timer/daemon task. https://www.freertos.org/a00111.html */
for( ; ; )
{
}

}

Create a polling task. ModbusSlavePoll
static void prvCreateTasks( void )
{
xTaskCreate(vLED1Task, //* Task function
"vLED1Task", //* Task name
configMINIMAL_STACK_SIZE, //* Task stack size, unit word, that is, 4 bytes
NULL, //* Task parameter
configMAX_PRIORITIES - 3, //* Task priority
&xHandleLED1Task); //* Task handle
xTaskCreate(vLED2Task, //* Task function
"vLED2Task", //* Task name
configMINIMAL_STACK_SIZE, // Task stack size, unit word, that is, 4 bytes
NULL, //* Task parameter
configMAX_PRIORITIES - 3, // Task priority
&xHandleLED2Task); //* Task handle
xTaskCreate(vLED3Task, //* Task function
"vLED3Task", //* Task name
configMINIMAL_STACK_SIZE, // Task stack size, unit word, that is, 4 bytes
NULL, //* Task parameter
configMAX_PRIORITIES - 3, // Task priority
&xHandleLED3Task); //* Task handle
xTaskCreate(vLED4Task, //* Task function
"vLED4Task", //* Task name
configMINIMAL_STACK_SIZE, // Task stack size, unit word, that is, 4 bytes
NULL, //* Task parameter
configMAX_PRIORITIES - 3, // Task priority
&xHandleLED4Task); //* Task handle
/* xTaskCreate(RTT_PrintfTask,//std_PrintfTask // Task function
"vprintfTask", // Task name
configMINIMAL_STACK_SIZE+50, // Task stack size, unit word, that is, 4 bytes
NULL, // Task parameter
configMAX_PRIORITIES - 3, // Task priority
&xHandleprintfTask); // Task handle
*/
xTaskCreate(ModbusSlavePoll, //* Task function
"ModbusSlavePoll", //* Task name
configMINIMAL_STACK_SIZE+300, //* Task stack size, unit word, that is, 4 bytes
NULL, //* Task parameter
configMAX_PRIORITIES - 3, //* Task priority
&xHandleModbusSlavePoll); //* Task handle
}

Welcome to post comments

This post is from GD32 MCU

Latest reply

Thank you very much for the information provided by the host. E231 should be no different from E230, right? It should run directly on 230~~ I guess   Details Published on 2024-8-18 16:08
 

164

Posts

0

Resources
2
 

Thanks for sharing!

This post is from GD32 MCU
 
 
 

41

Posts

0

Resources
3
 

Download and learn, thanks for sharing!

This post is from GD32 MCU
 
 
 

54

Posts

0

Resources
4
 

Thank you very much for the information provided by the host. E231 should be no different from E230, right? It should run directly on 230~~ I guess

This post is from GD32 MCU
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list