12.07.2015 Views

CooCox CoOS 用户手册

CooCox CoOS 用户手册

CooCox CoOS 用户手册

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<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);/* Process mail here */}...}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");}}12 1 3) :97

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

Saved successfully!

Ooh no, something went wrong!