We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
A.E Thank you so much for your generous help. I have a wired problem with the following code when I was using emulator to debug them: #include <reg52.h> #include <absacc.h> unsigned char Check; sbit INTE_ON = P3^2; void Turn_On ( ); void main() { EX0 = 1; EA = 1; for ( ; ; ) { if ( Check >= 5 ) { Turn_On ( ); Check = 0; } } } void Turn_On ( ){ TURN_ON = 1; } void Status ( ) interrupt 0{ Check++; } Why I can keep receiving interrupts when P3.2 was high? Any one can find any clues about this? Thank you in advance.
You have opted to use 'level sensitive' interrupts on the external interrupt pin. This means as long as the pin is a logic '0', it will keep on interrupting - thus your main code has little chance of executing. If you set bit 0 on TCON you will select edge sensitive interrupts that will only interrupt on a falling edge of P3.2. No weirdness here, just working as described.
Russell Bull Thank you so much...