Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/07/02 17:00
Read: times


 
#30341 - RE: RTXTINY for 8051
There are several probles with this program.

1. You would never create a delay loop in a real-time program. That prevents other tasks from running.

2. There is no good reason to create a program this simple using in-line assembly. The C code is shorter and easier to understand.

3. There is no call to os_wait. Do you have round-robin multitasking enabled?

The following program blinks the LEDs at 1HZ and 2Hz. I tested it and it does exactly what I would expect.

#include <rtx51tny.h>

sfr P1 = 0x90;

sbit LED0 = P1^1;
sbit LED1 = P1^0;

#define DELAY_HALF_SEC  {
                        os_wait2 (K_TMO, 250);
                        os_wait2 (K_TMO, 250);
                        }


void job0 (void) _task_ 0
{
os_create_task (1);

while (1)
  {
  LED0 ^= 1;
  DELAY_HALF_SEC
  }
}


void job1 (void) _task_ 1
{
while (1)
  {
  LED1 ^= 1;
  DELAY_HALF_SEC
  DELAY_HALF_SEC
  }
}


Jon

List of 5 messages in thread
TopicAuthorDate
RTXTINY for 8051            01/01/70 00:00      
RE: RTXTINY for 8051            01/01/70 00:00      
RE: RTXTINY for 8051            01/01/70 00:00      
RE: RTXTINY for 8051            01/01/70 00:00      
RE: RTXTINY for 8051            01/01/70 00:00      

Back to Subject List