try this
Code:DEFINE OSC 20 INCLUDE "MODEDEFS.BAS" #config __CONFIG _CONFIG1H, _OSC_HS_1H __CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOREN_OFF_2L & _BORV_2_2L __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_16384_2H __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L __CONFIG _CONFIG5L, _CP0_ON_5L & _CP1_ON_5L & _CP2_ON_5L __CONFIG _CONFIG5H, _CPB_ON_5H #endconfig T2 var byte LedG VAR PORTA.1 ' Green LED LedR VAR PORTA.2 ' Red LED BUZ VAR PORTA.3 ' Buzzer OP KeyLine VAR PORTA.5 ' keyline BPear1 var PORTB.4 ' Push 1 IP BPear2 var PORTB.5 ' Push 2 IP Bcall var PORTB.6 ' Call Button Bcancel var PORTB.7 ' Cancel Button LedR = 0 ' led off LedG = 0 ' led off Start: BUZ = 1 ' Buzzer off KeyLine = 1 ' transmitter off ' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''' Slp: ' Now prepare for sleep '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''' INTCON2.7 = 0 ' Enable weak pull-ups PORTA=%00001000 ' PORTB=%11110000 ' PORTC=%00001000 ' TRISA = %00000000 ' TRISB = %11110000 ' TRISC = %00000000 T2=PORTB ' Read port to ensure no setting of flag INTCON=%00001000 ' Enable the global interrupt and enable the change on port b @ sleep @ nop PAUSE 100 ' Sound buzzer and Led as indicator of sleep exit ledr=1 BUZ=0 pause 100 ledr=0 BUZ=1 pause 500 goto slp end




Bookmarks