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.
#include <REG2051.H> #define SL P1_4 #define SR P1_5 #define A P1_6 #define EN P1_7 unsigned char F = 0x00; unsigned char PF = 0; void Go_To_Sleep (void) { PCON = 0x01; } void main (void) { IT0 = 0; EX0 = 1; EA = 1; Go_To_Sleep (); } void Ext_Int (void) interrupt 0 { F=~F; if(F==0x00) { A=0; } else { A=1; } while(PF==0) { EN=1; if(A==0) { if(SR==1) { PF=1; } } else { if(SL==1) { PF=1; } } } EN=0; PF=0; }