| 
 5131| 5
 | RTOS中二进值信号量如何使用? | 
| 
10金钱 
 最佳答案不加私人QQ哦,我自己水平也很菜,就简单说一下我自己的理解吧,也不知道对不对,你就当个参考好了。
假设我们有一个数组,Array[10] = {0},
static SemaphoreHandle_t  xSemaphore = NULL;
Task1函数 
{
    while(1)
    {
        xSemaphoreTake(xSemaphore, portMAX_DELAY);
        对数组进行操作(写数据);
        xSemaphoreGive(xSemaphore);
        taskYIELD();
    }
        
}
Task2函数
{
 ... | ||
| 
 | ||
| 没有脑袋 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
	
	 
 
 /1
 /1  
 |手机版|OpenEdv-开源电子网
( 粤ICP备12000418号-1 )
|手机版|OpenEdv-开源电子网
( 粤ICP备12000418号-1 )
GMT+8, 2025-10-31 23:10
Powered by OpenEdv-开源电子网
© 2001-2030 OpenEdv-开源电子网