12.07.2015 Views

CooCox CoOS 用户手册

CooCox CoOS 用户手册

CooCox CoOS 用户手册

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>CooCox</strong> <strong>CoOS</strong> #include "CCRTOS.h"OS_EventID queue;void *MailQueue[8];unsigned int msgdat;void TaskN (void *pdata){StatusType result;void *msg;.../* Wait for a mail, time-out:20 */msg = CoPendQueueMail (queue, 20, &result);if (result != E_OK){if (result == E_INVALID_ID)printf("Invalid Queue ID !\n");}else{if (msg)printf("Have recived data : %d \n", *(unsigned int *)msg);}...}void TaskM (void *pdata){StatusType result;.../* Wait for a mail */msgdat = 0x61;result = CoPostQueueMail (queue, (void *)&msgdat);if (result != E_OK){if (result == E_INVALID_ID)printf("Invalid Queue ID ! \n");else if (result == E_MBOX_FULL)printf("The Queue is full !\n");}}1:99

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!