02.01.2015 Views

CooCox CoOS User's Guide

CooCox CoOS User's Guide

CooCox CoOS User's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

void taskB (void* pdata)<br />

{<br />

for (;;)<br />

{<br />

CoWaitForSingleFlag (b_flag,0);<br />

CoEnterMutexSection (uart_mutex);<br />

printf (" taskB is running \n\r");<br />

CoLeaveMutexSection (uart_mutex);<br />

}<br />

}<br />

led: led task controls the changes of led, here we call CoTickDelay() to delay<br />

0.5s to keep led lighting for 0.5s; at the same time led task will set a_flag and<br />

b_flag at the right time to activate taskA,taskB. Code is as followings:<br />

void led (void* pdata)<br />

{<br />

unsigned int led_num;<br />

for (;;)<br />

{<br />

led_num = 1

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

Saved successfully!

Ooh no, something went wrong!