Hi all,
I have a C51 application that requires the following operation which is close to a reset but it is not a reset:
1. when a bit is set in a register, call a function and return 2. when a bit is cleared in a register, exit the ISR and jump back to the main routine (the stack should be reset).
I use Keil C51 and uses the following method trying to achieve the aims but to no avail:
void isr(void) interrupt { if (register & bit) function1(); else #pragma asm ljmp 800H; // 800h=main routine address #pragma endasm }
I tried this routine but it seems that the code is stuck. Has anybody tried a similar implementation, or is there anything that I can do to implement such a scheme?
Thanks very much for your response and Best Regards.
William
That's one way to get a real hardware reset.
However, driving your own RESET pin directly from an I/O port pin on the same device brings up a somewhat tricky question of stability. The port pin only pulls the reset line down because it was programmed to do so. Resetting the processor resets the I/O ports, so they can no longer drive RESET low. (If the pins can drive RESET low while they are reset, then you can't come out of reset!)
What does the RESET line do while the I/O pin gets reset? Does it stay stable long enough actually to RESET properly? If so, is that behavior guaranteed by the design, or are you just getting lucky?
You might need some slightly more complicated hardware outside the processor to guarantee the stablity of this transition. There are chips made to perform exactly this function. The I/O pin would tell the supervisor to reset the CPU; the supervisor would pull the RESET line.
Here's an app note for one such supervisor chip. www.intersil.com/.../AN1230.pdf This one has some built-in EEPROM, so it has a serial interface and is slightly more complicated that what you need. But notice the way the I/O pins are connected to the supervisor, which in turn is connected to the RESET line.
AT89S52 can be reset with logic high for 2 machine cycles to RESET PIN. I used Proteus VSM 7.1 and it shows RESET... Reset itself by ISR and Port Pin
delay(); RESET_Port_Pin=1; //Soft Reset to uC by Port Pin delay(); RESET_Port_Pin=0; delay();
But in Actual Circuit this Doesn't works. Without any chip it could be done or not? I think momentry latching of some type will help?