| ??? 10/31/02 18:54 Read: times |
#31784 - RE: T89C51RD2 \\ |
The concept is very simple: restore everything the way it was after reset, then jump to bootcode at 0xfc00. It will NOT work if the watchdog is started. It does not work the same as Erik's, which resets the boot sector and uses watchdog to force a reset. The same could be done for Atmel, but I have not done it as this works well enough.
// restore SFR's as needed to T89C51RD2, enough that iap works IE = 0; P0 = P1 = P2 = P3 = 0xff; // ports CCON = CMOD = CCAPM0 = CCAPM1 = CCAPM2 = CCAPM3 = CCAPM4 = 0x00; // CL = CCAP0L = CCAP1L = CCAP2L = CCAP3L = CCAP4L = 0x00; CH = CCAP0H = CCAP1H = CCAP2H = CCAP3H = CCAP4H = 0x00; CKCON = 0x00; AUXR = 0x08; TCON = 0x00; TMOD = 0x00; TH1 = TH0 = TL1 = TL0 = 0x00; EECON = 0x00; EETIM = 0x00; FCON = 0x00; T2MOD = 0x00; T2CON = 0x00; RCAP2L = RCAP2H = TL2 = TH2 = 0x00; SADEN = SADDR = 0x00; SCON = 0x00; PCON = 0x10; AUXR1 = 0x00; IP = IPH = 0x00; DPL = DPH = 0x00; B = ACC = 0x00; SP = 0x07; ((void (code *) (void)) 0xfc00) (); //http://www.keil.com/support/docs/307.htm |



