MPASM 02.15 Released EXPT1B.ASM 3-13-2002 11:45:21 PAGE 1 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00001 ;Expt1b.asm 00002 ;Project: LED on for 0.5 sec with debounce 00003 ;List P = 16F84 00004 ;#include 00005 ;__CONFIG 1Bh    ;_CP_OFF & _PWRTE_ON & _WDT_OFF & _RC_OSC 00006 00007 0000 00008 ORG 0 ;This is the start of memory for the program. 0000 1683 00009 SETUP BSF 03,5 ;Go to Bank 1 0001 0186 00010 CLRF 06 ;Make all port B output 0002 3001 00011 MOVLW 01 ;Load W with 0000 0001 0003 0085 00012 MOVWF 05 ;Make RA0 input 0004 1283 00013 BCF 03,5 ;Go to Bank 0 - the program memory area. 0005 019F 00014 CLRF 1F ;Clear the button-press file 0006 0186 00015 CLRF 06 ;Blank the output 0007 280E 00016 GOTO MAIN 00017 0008 0000 00018 DELAY NOP ;Create approx 250mS delay 0009 0B9A 00019 DECFSZ 1A,1 000A 2808 00020 GOTO DELAY 000B 0B9B 00021 DECFSZ 1B,1 000C 2808 00022 GOTO DELAY 000D 0008 00023 RETURN 00024 000E 1C05 00025 MAIN BTFSS 05,0 ;Test the input line on port A 000F 2820 00026 GOTO MAIN2 ;Button not pressed 0010 181F 00027 BTFSC 1F,0 ;Button pressed first time? 0011 280E 00028 GOTO MAIN ;Button already pressed 0012 0000 00029 MAIN1 NOP 0013 0000 00030 NOP 0014 0000 00031 NOP 0015 0000 00032 NOP 0016 0B9A 00033 DECFSZ 1A,1 ;First time button pressed. 0017 2812 00034 GOTO MAIN1 ;Create short delay and look again 0018 1C05 00035 BTFSS 05,0 ;Is switch still pressed? 0019 2820 00036 GOTO MAIN2 ;It was only noise 001A 1406 00037 BSF 06,0 ;Turn on LED 001B 2008 00038 CALL DELAY ;Illuminate for 250mS 001C 2008 00039 CALL DELAY ;Illuminate for 250mS 001D 1006 00040 BCF 06,0 ;Turn off LED 001E 141F 00041 BSF 1F,0 ;Set button-press flag 001F 280E 00042 GOTO MAIN ;Loop Main 0020 101F 00043 MAIN2 BCF 1F,0 ;Clear button-press flag 0021 280E 00044 GOTO MAIN ;Loop Main 00045 00046 00047 END ;Tells assembler end of program MPASM 02.15 Released EXPT1B.ASM 3-13-2002 11:45:21 PAGE 2 SYMBOL TABLE LABEL VALUE DELAY 00000008 MAIN 0000000E MAIN1 00000012 MAIN2 00000020 SETUP 00000000 __16F84 00000001 MEMORY USAGE MAP ('X' = Used, '-' = Unused) 0000 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XX-------------- ---------------- All other memory blocks unused. Program Memory Words Used: 34 Program Memory Words Free: 990 Errors : 0 Warnings : 0 reported, 0 suppressed Messages : 0 reported, 0 suppressed