MPASM 02.15 Released EXPT4E.ASM 3-2-2002 13:23:55 PAGE 1 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00001 ;Expt4e.asm 00002 ;Project: Push "A" to display a word 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 1283 00011 BCF 03,5 ;Go to Bank 0 - the program memory area. 0003 019F 00012 CLRF 1F ;Clear the button-press file 0004 2824 00013 GOTO MAIN 00014 0005 0782 00015 TABLE1 ADDWF 02H,1 ;Add W to the Program Counter to create a jump.  0006 3479 00016 RETLW 79H ;E    This is jump=0 location.  format= gfedcba 0007 3437 00017 RETLW 37H ;N    This is jump=1 location. 0008 3478 00018 RETLW 78H ;t This is jump=2 location. 0009 3479 00019 RETLW 79H ;E 000A 3450 00020 RETLW 50H ;r 000B 3400 00021 RETLW 00H ;blank 00022 000C 0000 00023 DELAY NOP ;Create approx 250mS delay 000D 0B9A 00024 DECFSZ 1A,1 000E 280C 00025 GOTO DELAY 000F 0B9B 00026 DECFSZ 1B,1 0010 280C 00027 GOTO DELAY 0011 0008 00028 RETURN 00029 0012 1C05 00030 SW BTFSS 05,0 ;Test the push-button input 0013 0008 00031 RETURN ;Sw NOT pushed 0014 141F 00032 BSF 1F,0 ;Switch pushed. Set button flag. 0015 0008 00033 RETURN 00034 0016 081E 00035 WORD1 MOVF 1E,0 ;Copy the jump-value into W 0017 2005 00036 CALL TABLE1 ;W will return with display-value 0018 0086 00037 MOVWF 06 ;Output display value 0019 200C 00038 CALL DELAY ;Display for 0.25sec 001A 200C 00039 CALL DELAY ;Display for 0.25sec 001B 200C 00040 CALL DELAY ;Display for 0.25sec 001C 0186 00041 CLRF 06 ;Clear the display 001D 200C 00042 CALL DELAY ;Display for 0.25sec 001E 0A9E 00043 INCF 1E,1 ;Increment jump-value to look at next table value 001F 3006 00044 MOVLW 06H ;The number of table-values (in hex) 0020 061E 00045 XORWF 1E,0 ;Has the jump-value reached 06h? 0021 1D03 00046 BTFSS 03,2 ;Test the zero bit in the Status register 0022 2816 00047 GOTO WORD1 ;Loop to display next table-value 0023 0008 00048 RETURN ;Start again 00049 00050 0024 019E 00051 MAIN CLRF 1E ;File 1E holds the jump-value for the table 0025 2012 00052 CALL SW ;Poll (look at) push-button "A" 0026 181F 00053 BTFSC 1F,0 ;Has switch been pushed? MPASM 02.15 Released EXPT4E.ASM 3-2-2002 13:23:55 PAGE 2 LOC OBJECT CODE LINE SOURCE TEXT VALUE 0027 2016 00054 CALL WORD1 ;Yes. Display "ENtEr" 0028 101F 00055 BCF 1F,0 ;Clear button flag 0029 2824 00056 GOTO MAIN 00057 00058 END ;Tells assembler end of program MPASM 02.15 Released EXPT4E.ASM 3-2-2002 13:23:55 PAGE 3 SYMBOL TABLE LABEL VALUE DELAY 0000000C MAIN 00000024 SETUP 00000000 SW 00000012 TABLE1 00000005 WORD1 00000016 __16F84 00000001 MEMORY USAGE MAP ('X' = Used, '-' = Unused) 0000 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXX------ ---------------- All other memory blocks unused. Program Memory Words Used: 42 Program Memory Words Free: 982 Errors : 0 Warnings : 0 reported, 0 suppressed Messages : 0 reported, 0 suppressed