Anyone now how can you perform a software reset on a Dallas 390 when it is in continous mode? The following suggested code does not work.
((void (code *) (void)) 0x000000) ();
Turn off interrupts, turn off contiguous mode, and then JMP #0. Do not forget to initialize all SFRs to the reset state first. Erik
Hans-Bernhard and Erik, I have attempted to do what both of you suggested but it does not seam to work. It successfully disables interrupts and I have tried to switch the processor in normal 8051 mode, Although I am not 100% sure that the processor does change to the normal 8051 mode. The code is located in code memoory range 0-64K, so this should not be a problem. Here is the code I have written. Any ideas?
void code software_reset(void) { EA=0; // Disable interrupts TA=0xAA; //Enable access to ACON TA=0x55; ACON=0xF8; // Set ACON into reset mode (puts processor into normal 8051 mode) ((void (code *) (void)) 0x000000) (); // Cause a reboot }
You neglected the most important aspect I tried to point out in my first reply: this code *must* be done in assembly. The C compiler almost certainly can't generate code that is mixed between continuous mode and classic 8051 mode. The operand sizes will be all wrong. You also ignored Erik's hint about setting all SFR's to their reset values completely. At least check the generated assembly (SRC mode), and/or step through this routine in the simulator to see whether it ends up where it's supposed to.
Sorry I forgot to mention a couple of things I had stepped through the assembly of the C code, which I have included.
1367: EA=0; // Disable interrupts 1368: C:0x00FF8A C2AF CLR EA(0xA8.7) 1369: TA=0xAA; //Enable access to ACON C:0x00FF8C 75C7AA MOV TA(0xC7),#SADDR1(0xAA) 1370: TA=0x55; C:0x00FF8F 75C755 MOV TA(0xC7),#0x55 1371: ACON=0xF8; // Set ACON into reset mode (puts processor into normal 8051 mode) 1372: C:0x00FF92 759DF8 MOV ACON(0x9D),#EIP(0xF8) 1373: ((void (code *) (void)) 0x000000) (); // Cause a reboot C:0x00FF95 02000000 LJMP C_STARTUP(C:000000)