本帖最后由 minomi 于 2014-11-23 22:12 编辑
我再调试RTXtiny程序中,有个问题一直没有解决,就是下面程序中的SBUF=0x00不能加上,加上后WDT任务就不运行了,仿真看到定时器0和1都在运行,但feddog不翻转。哪位大侠帮忙不胜感激
#include "reg51.h"
#include "rtx51tny.h"
#define uchar unsigned char
#define INIT 0
#define WDT 1
uchar idata BUFR[4];
uchar pointer,live,lock=0xff;
unsigned int starting;
sbit on1=P3^2;
sbit feddog=P3^4;
/**********************************************/
init()_task_ INIT
{
SCON=0x50;/* mode1:8-bit UART,enable receiver*/
TMOD|=0x20;/* timer1:mode2 */
TL1=TH1=0xe8;/* 0xe8=1200baud,oxf4=2400baud,0xfa=4800baud,0xfd=9600baud*/
TR1=1;
ES=1;
TI=0;
SBUF=0x00;//send a READY infomation //这句话不能加上,加上后WDT不运行了
while(!TI);
TI=0;
os_create_task (WDT);
/* send two beeps*/
on1=0;
os_wait(K_IVL,40,0);
on1=1;
os_wait(K_IVL,80,0);
on1=0;
os_wait(K_IVL,80,0);
on1=1;
os_delete_task(INIT);
}
void watchdog (void) _task_ WDT
{
while(1){
feddog=!feddog;
os_wait(K_TMO,4,0);
}
}
|