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

ASM+C51

Hi everybody

How can I restart the controller by internal rautine?(To simulate the external restart button)

Parents
  • .... I forgot some thing.

    I think that the writing to the LCD is the source of the problem.(but I need it)

    I am adding the code

    void lid_int (void) interrupt 0 using 3	// LID Interrupt
    {
      unsigned char *chr_ptr;
    
      EX0 &= 0x00;//Disable external 0 interrupt
      IE0 &= 0;     // Clear INT0 flag
    
      P1_2 = 0;    // Disable relay
      PWM_Duty_Cyl(0,255);
      PWM_Duty_Cyl(1,255);
      uPSD_PWM_Disable();
      P3_1 = 0;        // Disable BL motor
      P3_0 = 0;        // Disable turbine motor
      P1_1 = 0;        // disable sensors
    
    
      lcd_clear();
      chr_ptr = "THE LID IS OPEN!\n";
    
      while (*chr_ptr != NULL)
      {
         if (*chr_ptr == '\n')
         {
     	    chr_ptr++;
      	    Cursor_LCD ^= 0x40;     			//goto next line
      	    Cursor_LCD &= 0xC0;     			//return to position 0
    	    LCD_reg.LCD_CMD_WR = Cursor_LCD;
         }
         else
         {
            BusyCheck();
            LCD_reg.LCD_RAM_WR = *chr_ptr++;
         }
      }
      while(P3_2 == 0) // Until the LID is open
      {
    
      }
    
      (*((const void(code*)(void)) 0x0000 ))();
    }
    

    Thanks
    Kobi

Reply
  • .... I forgot some thing.

    I think that the writing to the LCD is the source of the problem.(but I need it)

    I am adding the code

    void lid_int (void) interrupt 0 using 3	// LID Interrupt
    {
      unsigned char *chr_ptr;
    
      EX0 &= 0x00;//Disable external 0 interrupt
      IE0 &= 0;     // Clear INT0 flag
    
      P1_2 = 0;    // Disable relay
      PWM_Duty_Cyl(0,255);
      PWM_Duty_Cyl(1,255);
      uPSD_PWM_Disable();
      P3_1 = 0;        // Disable BL motor
      P3_0 = 0;        // Disable turbine motor
      P1_1 = 0;        // disable sensors
    
    
      lcd_clear();
      chr_ptr = "THE LID IS OPEN!\n";
    
      while (*chr_ptr != NULL)
      {
         if (*chr_ptr == '\n')
         {
     	    chr_ptr++;
      	    Cursor_LCD ^= 0x40;     			//goto next line
      	    Cursor_LCD &= 0xC0;     			//return to position 0
    	    LCD_reg.LCD_CMD_WR = Cursor_LCD;
         }
         else
         {
            BusyCheck();
            LCD_reg.LCD_RAM_WR = *chr_ptr++;
         }
      }
      while(P3_2 == 0) // Until the LID is open
      {
    
      }
    
      (*((const void(code*)(void)) 0x0000 ))();
    }
    

    Thanks
    Kobi

Children