MPASM 03.70 Released BIN4D.ASM 3-4-2006 18:06:12 PAGE 1 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00001 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 00002 ; 00003 ; Source File: BIN4D.ASM 00004 ; Author: MPB 00005 ; Date: 13-11-05 00006 ; 00007 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 00008 ; 00009 ; Slow output binary count is stopped, started 00010 ; and reset with push buttons. 00011 ; Modified with extra directives 00012 ; 00013 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 00014 00015 ; Declare processor, supress messages and warnings, 00016 ; do not print symbol table, and configure (RC clock) 00017 00018 LIST p=16f877a, w=2, st=off, mm=off 2007 3733 00019 __CONFIG 0x3733 00020 00021 ; Declare GPR label and literal constant 00022 ; Define input labels 00023 ; Include standard SFR label file 00024 ; Include PortB initialisation file 00025 00000020 00026 Timer EQU 20 00000000 00027 DDCodeB SET b'00000000' 0003 00028 CONSTANT Count=003 00029 #DEFINE RunBut PORTD,1 00030 #DEFINE ResBut PORTD,0 00031 #INCLUDE "P16F877A.INC" 00001 LIST 00002 ; P16F877A.INC Standard Header File, Version 1.00 Microchip Technology, Inc. 00398 LIST 00032 #INCLUDE 0000 1683 1303 00001 BANKSEL TRISB ; Select bank 1 0002 3000 00002 MOVLW DDCodeB ; Port B Direction Code 0003 0086 00003 MOVWF TRISB ; Load the DDR code into F86 0004 1283 1303 00004 BANKSEL PORTB ; Select bank 0 00033 00034 ; Program code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 00035 00036 ; 'delay' macro ............................................. 00037 00038 delay MACRO ; macro definition starts 00039 MOVWF Timer ; Copy W to timer register 00040 down DECF Timer ; Decrement timer register 00041 BNZ down ; and repeat until zero 00042 ENDM ; macro definition ends 00043 00044 ; Main loop ................................................. 00045 0006 0186 00046 reset CLRF PORTB ; Clear Port B Data MPASM 03.70 Released BIN4D.ASM 3-4-2006 18:06:12 PAGE 2 LOC OBJECT CODE LINE SOURCE TEXT VALUE 00047 0007 1C08 00048 start BTFSS ResBut ; Test reset button 0008 2806 00049 GOTO reset ; and reset Port B if pressed 0009 1888 00050 BTFSC RunBut ; Test run button 000A 2807 00051 GOTO start ; and repeat if n pressed 00052 000B 0A86 00053 INCF PORTB ; Increment output at Port B 000C 3003 00054 MOVLW Count ; Delay count literal 00055 delay ; Jump to subroutine 'delay' 000D 00A0 M MOVWF Timer ; Copy W to timer register 000E 03A0 M down DECF Timer ; Decrement timer register 000F 1D03 280E M BNZ down ; and repeat until zero 0011 2807 00056 GOTO start ; Repeat main loop always 00057 00058 END ; Terminate source code...... Errors : 0 Warnings : 0 reported, 1 suppressed Messages : 0 reported, 3 suppressed