MDK-ARM Keil, MDK-ARM Datasheet - Page 42

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
42
A task sending a message:
__task void Send_Task (void)
}
A task to receive the message:
__task void Receive_Task (void)
}
Exercise: Mailbox
This exercise presents the minimum code to initialize a mailbox and then pass a
formatted message between two tasks.
MESSAGE *mptr;
os_mbx_init (MsgBox, sizeof (MsgBox));
tsk1 = os_tsk_self ();
tsk2 = os_tsk_create (Receive_Task, 0x1);
while (1)
}
MESSAGE *rptr;
while (1) {
}
mptr = _alloc_box (mpool);
for (i=0; i < 4 ; i++)
}
os_mbx_send (MsgBox, mptr, 0xffff);
os_mbx_wait (MsgBox, &rptr, 0xffff);
pwm_value = *rptr->ADresult [0];
_free_box (mpool, rptr);
Mptr->ADresult [i] = ADresult (i);
Mptr->PORT0 = IOPIN0;
{
{
{
{
// Wait for a message arrives
// Read the message data
// Free the mail slot
// Use the data in this task
Chapter 2. Developing With an RTOS
// Acquire a mailbox
// Fill it with data
// Send the message

Related parts for MDK-ARM