You are on page 1of 3

Name: NGUYEN NHAT DUY

ID: EEEEIU18025
HOMEWORK #6
EMBEDDED REAL-TIME SYSTEM
I tested the code of RTOS example and here is the result of the RTOS example:

Exercise:
Code:
#include <18F452.h>
#use delay(clock = 4MHz)
#use fast_io(B)
int count;
#use rtos(timer = 0, minor_cycle = 1ms)
#task(rate = 200ms, max = 1ms)
void liv(){
output_toggle(PIN_D7);
}

#task(rate = 10ms, max = 1ms, queue=1)


void dis(){
if(rtos_msg_poll()>0)
{
output_b(rtos_msg_read());
}
}

#task(rate = 1ms, max = 1ms)


void gen(){
count++;
if (input(PIN_D0)==0)
{
rtos_msg_send(dis,count);
}
}

void main(){
set_tris_b(0);
set_tris_d(1);
rtos_run();
}
Result:

You might also like