消息邮箱是进程通讯中的重要工具,在本例中,使用一个POST任务来发送消息(一个字符,从A-Z),用一个PEND来接收消息。注意,在本例中发送任务是每个时钟周期都发送,而接收任务每3个时钟周期才接收一次。所以,一定会有某些字符不能接收到。
由于消息邮箱(长度为1的消息队列)是消息队列的特殊情况,所以在以后的消息队列程序中还将实验这种情况,看是否会有字符丢失。
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* (c) Copyright 2004, Yuan Fei, Hefei University of Technology
* All Rights Reserved
*
*
*
* Filename : test.c
* Programmer(s): yuan fei
* DESCRIPTION : This file illustrate the usage of Message Mailbox.
*
*********************************************************************************************************
*/
#include "includes.h"
/*
*********************************************************************************************************
* TYPE
*********************************************************************************************************
*/
typedef char MESSAGE; /* 消息为单个