MDK-ARM Keil, MDK-ARM Datasheet - Page 41

KIT REALVIEW MCU DEVELOPMENT

MDK-ARM

Manufacturer Part Number
MDK-ARM
Description
KIT REALVIEW MCU DEVELOPMENT
Manufacturer
Keil
Type
Compiler and IDEr
Datasheets

Specifications of MDK-ARM

For Use With/related Products
ARM MCUs
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Getting Started: Building Applications with RL-ARM
Then we send the message.
os_mbx_send (MsgBox, mptr, 0xffff);
In practice, this locks the mail slot protecting the data, and the message pointer is
transferred to the waiting task. Further messages can be sent using the same
calls, which will cause the next mail slot to be used. The messages will form a
FIFO queue. In the receiving task, we must declare a receiving pointer with the
message structure type. Then we wait for a message with the os_mxb_wait() call.
This call allows us to nominate the mailbox that we want to use, provide the
pointer to the mail slot buffer, and specify a timeout value.
MESSAGE *rptr;
When the message is received, we can simply access the data in the mail slot and
transfer them to variables within the receiving task.
pwm_value = *rptr->ADresult [0];
Finally, when we have made use of the data within the mail slot it can be released
so that it can be reused to transfer further messages.
_free_box (mpool, rptr);
The following code shows how to put all this together. First the initializing code
that may be called before RTX is started.
typedef struct
} MESSAGE;
unsigned int mpool [16 * sizeof (MESSAGE) / 4 + 3];
_declare_box (mpool, sizeof (MESSAGE), 16);
main()
}
unsigned char ADresult [4];
unsigned int
_init_box (mpool, sizeof (mpool), sizeof (MESSAGE));
os_sys_init (Send_Task);
{
{
PORT0;
41

Related parts for MDK-ARM