This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Software reset for Dallas 390 continous mode

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) ();

I believe this is because I am in continous mode, which uses longer jump instructions than the normal 8051 mode. Continous mode uses 3 address bytes rather than the normal 2.

Parents
  • 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
        }
    
    

Reply
  • 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
        }
    
    

Children
  • 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)
    
    This code is pretty much what I had expected and would have written in assembler so I left it in C.

    When you step through the assembly code it correctly jumps to address 0. Once it gets to address 0 the ljmp instruction is interpresetted wrong, and so I suspect this is caused by not being in normal 8051 mode.

    I suspect that the cause of the problem maybe that I had not reset all the SFR's, so I will try and reset them all.