Hi,
Am Working on Watchdog timer in P89V51RD2. But Am not getting the result. My code is
WDTC|=0x18; // Enable OUT and Reset WDTD=count; // Load Count to Reg WDTC|=0x01; // Start WDT On LED1 while(WDTC&0x04); // Wait for Flag On LED2
but its toggling always. Actually i have defined the registers in reg52.h file.
Can anyone suggest me how i can solve this problem.
Thanks in Advance.
Regards, Madev
hi, i am happy my code was help for you.
My Program worked with small modification
WDTC=0x18; // Enable OUT and Reset WDTD=count; // Load Count to Reg WDTC|=0x02; // Refresh WDT WDTC|=0x01; // Start WDT
WDTC|=0x02; // To Refresh before timeout WDTC&=0xFE; // To Stop WDT
May be helpfull
P89V51RD2BN is from NXP.
The code from u is about UART... Can u explain me how its linked to Watchdog
the purpose of a watchdog is to reset the uC when it is not fed. Thus, when the WD times out it resets the uC.
Erik
You can use my code to init your program in Keil. Thank You <title> This Code For ATMEL P89V51RD2BN Used Internal Baudrate <emdtitle> /* Start of Config P89V51RD2BN:UART0,UART1 */ SCON = 50h; /* UART0 = Mode 1 (N,8,1) SCON1 = 0x50; // UART1 = Mode 1 (N,8,1) /* Select Generate Baudrate By Internal-Baud */ TCLK = 0; // Disable Timer2 Generate TX Baudrate RCLK = 0; // Disable Timer2 Generate RX Baudrate BDRCON0 |= 0x0C; // TBCK:RBCK=1:1 = Used Internal Buad Generate UART0 Baudrate BDRCON1 |= 0x0C; // TBCK:RBCK=1:1 = Used Internal Buad Generate UART1 Baudrate BDRCON0 &= ~0x01; // SRC0=0 = Select Fosc to Baudrate BDRCON2 &= ~0x01; // SRC1=0 = Select Fosc to Baudrate /* Setup Internal-Baud Generate Baudrate Fast Mode */ /* Support Baudrate : 4800,9600,19200,... ,115200 */ PCON |= 0x80; // UART0:SMOD0 = 1 (Enable Double Baudrate) BDRCON1 |= 0x80; // UART1:SMOD1 = 1 (Enable Double Baudrate) BDRCON0 |= 0x02; // SPD0=1 = Fast Baudrate Generator BDRCON1 |= 0x02; // SPD1=1 = Fast Baudrate Generator BRL0 = 0x88; // Setup UART0 Baudrate 9600BPS BRL1 = 0x88; // Setup UART1 Baudrate 9600BPS BDRCON0 |= 0x10; // BRR0=1 = Start Internal Baud1 BDRCON1 |= 0x10; // BRR1=1 = Start Internal Baud1 /* Start Keil-C51 Transmit Function */ TI = 1; // Set TI to send First char of UART TI1 = 1; /* End of Config AT89C51RE2:UART0,UART1 */ /* Setup UART Interrupt Control */ ES = 0; // Disable UART0 Interupt EN1 &= ~0x108; // Disable UART1 Interupt /* Print String to UART0 */ printf("I AM A PROGRAMER I AM YESEREE BOB From UART0\n");
View all questions in Keil forum