大神们。我写了两个任务,一个任务创建消息队列,并发送数字999,然后用另一个任务接收,为什么接收到的是536870956。 哪里出错了 ,我弄一天了, 急死了,在线等!!!
#include "app.h"
extern OS_TCB LED2_TCB;
extern OS_Q Q_led1;
OS_MSG_SIZE size;
int Msg1;
CPU_TS timestamp;
void Task_LED1(void * p_arg)
{
OS_ERR err;
(void)p_arg;
Msg1=999;
OSQCreate ((OS_Q *)&Q_led1,
(CPU_CHAR *)"led1",
(OS_MSG_QTY )10,
(OS_ERR *)&err);
OSQPost ((OS_Q *)&Q_led1,
(void *)&Msg1,
(OS_MSG_SIZE )sizeof(Msg1),
(OS_OPT )OS_OPT_POST_FIFO,
(OS_ERR *)&err);
}
void Task_LED2(void * p_arg)
{
OS_ERR err;
void *Msg2;
(void)p_arg;
Msg2 = OSQPend ((OS_Q *)&Q_led1,
(OS_TICK )0,
(OS_OPT )OS_OPT_PEND_BLOCKING,
(OS_MSG_SIZE *)&size,
(CPU_TS *)timestamp,
(OS_ERR *)&err);
printf("\r\n TASK2: Msg2=%d", (int)Msg2);
} |