kd5uzz
Joined: 28 May 2006 Posts: 56
|
RTOS troubles |
Posted: Fri Feb 23, 2007 9:30 pm |
|
|
The following code does not seem to wait long enough between execution of BlinkLED...thoughts?
Compiler version 3.22.
Code: | #include <16F877a.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000) //clock speed
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,ERRORS)
#use rtos(timer=0)
// ***** Global VAR
int BlinkState = 1;
#define DIAG_LED PIN_A1
// Rest of program....
#task(rate=900ms)
void BlinkLED(){
printf("Entered Task1");
switch (BlinkState){
case 1:
output_high(DIAG_LED);
BlinkState = 2;
break;
case 2:
output_low(DIAG_LED);
BlinkState = 1;
break;
}
}
void main(){
rtos_run();
}
|
|
|