NOLIST
#include "C:\DOCUME~1\ADMINI~1\Desktop\3_BUTT~2.PBP"
LIST
BO Equ 41
BOH Equ 42
BOHH Equ 43
BOHHH Equ 44
F1_SOF equ $ ; 3_BUTT~2.BAS
F1_000004 equ $ ; in [3_BUTT~2.BAS] ALL_DIGITAL = TRUE
Movlw 7
Movwf CMCON
F1_000005 equ $ ; in [3_BUTT~2.BAS] bo = 0 ' give variable initial value
Clrf BOHHH
Clrf BOHH
Clrf BOH
Clrf BO
F1_000006 equ $ ; in [3_BUTT~2.BAS] TRISB = 0 ' Set PORTB (LEDs) to all output
Bsf STATUS,5
ram_bank = 1
Clrf TRISB
F1_000007 equ $ ; in [3_BUTT~2.BAS] PORTB = 0 ' All LEDs off
Bcf STATUS,5
ram_bank = 0
Clrf PORTB
LOOP
F1_000009 equ $ ; in [3_BUTT~2.BAS] PORTA = 0 ' PORTA lines low to read buttons
Clrf PORTA
F1_000010 equ $ ; in [3_BUTT~2.BAS] TRISA = $F0 ' Enable all buttons
Movlw 240
Bsf STATUS,5
ram_bank = 1
Movwf TRISA
F1_000011 equ $ ; in [3_BUTT~2.BAS] If PORTA.0 = 1 Then ' If 4th button pressed...
Bcf STATUS,5
ram_bank = 0
Btfss PORTA,0
Goto bc@ll2
F1_000012 equ $ ; in [3_BUTT~2.BAS] bo = bo +1 ' add 1 to count variable
Movlw 1
Addwf BO,F
Clrw
Btfsc STATUS,0
Movlw 1
Addwf BOH,F
Clrw
Btfsc STATUS,0
Movlw 1
Addwf BOHH,F
Clrw
Btfsc STATUS,0
Movlw 1
Addwf BOHHH,F
F1_000013 equ $ ; in [3_BUTT~2.BAS] delayms 100
Movlw 100
Call dl@ms
F1_000014 equ $ ; in [3_BUTT~2.BAS] endif
bc@ll2
F1_000015 equ $ ; in [3_BUTT~2.BAS] if bo > 6 then
Clrf PP2HHH
Clrf PP2HH
Clrf PP2H
Movlw 6
Movwf PP2
Movfw PP2HHH
Xorlw 128
Movwf PP4
Movfw BOHHH
Xorlw 128
Subwf PP4,W
Btfss STATUS,2
Goto cp@lb2
Movfw BOHH
Subwf PP2HH,W
Btfss STATUS,2
Goto cp@lb2
Movfw BOH
Subwf PP2H,W
Btfss STATUS,2
Goto cp@lb2
Movfw BO
Subwf PP2,W
cp@lb2
Btfsc STATUS,0
Goto bc@ll4
F1_000016 equ $ ; in [3_BUTT~2.BAS] bo = 6
Clrf BOHHH
Clrf BOHH
Clrf BOH
Movlw 6
Movwf BO
F1_000017 equ $ ; in [3_BUTT~2.BAS] Endif
bc@ll4
F1_000018 equ $ ; in [3_BUTT~2.BAS] If PORTA.1 = 1 Then ' If 3rd button pressed...
Btfss PORTA,1
Goto bc@ll6
F1_000019 equ $ ; in [3_BUTT~2.BAS] bo = bo -1
Movlw 1
Subwf BO,F
Clrw
Btfss STATUS,0
Movlw 1
Subwf BOH,F
Clrw
Btfss STATUS,0
Movlw 1
Subwf BOHH,F
Clrw
Btfss STATUS,0
Movlw 1
Subwf BOHHH,F
F1_000020 equ $ ; in [3_BUTT~2.BAS] if bo < 0 then
Clrf PP2HHH
Clrf PP2HH
Clrf PP2H
Clrf PP2
Movfw BOHHH
Xorlw 128
Movwf PP4
Movfw PP2HHH
Xorlw 128
Subwf PP4,W
Btfss STATUS,2
Goto cp@lb3
Movfw PP2HH
Subwf BOHH,W
Btfss STATUS,2
Goto cp@lb3
Movfw PP2H
Subwf BOH,W
Btfss STATUS,2
Goto cp@lb3
Movfw PP2
Subwf BO,W
cp@lb3
Btfsc STATUS,0
Goto bc@ll8
F1_000021 equ $ ; in [3_BUTT~2.BAS] bo = 0
Clrf BOHHH
Clrf BOHH
Clrf BOH
Clrf BO
F1_000022 equ $ ; in [3_BUTT~2.BAS] endif
bc@ll8
F1_000024 equ $ ; in [3_BUTT~2.BAS] endif
bc@ll6
F1_000025 equ $ ; in [3_BUTT~2.BAS] if bo = 0 then
Movfw BOHHH
Iorwf BOHH,W
Iorwf BOH,W
Iorwf BO,W
Btfss STATUS,2
Goto bc@ll10
F1_000026 equ $ ; in [3_BUTT~2.BAS] portb = 0
Clrf PORTB
F1_000027 equ $ ; in [3_BUTT~2.BAS] endif
bc@ll10
F1_000028 equ $ ; in [3_BUTT~2.BAS] if bo = 1 then
Movfw BO
Xorlw 1
Iorwf BOH,W
Iorwf BOHH,W
Iorwf BOHHH,W
Btfss STATUS,2
Goto bc@ll12
F1_000029 equ $ ; in [3_BUTT~2.BAS] portb.0 = 1
Bsf PORTB,0
F1_000030 equ $ ; in [3_BUTT~2.BAS] portb.1 = 0
Bcf PORTB,1
F1_000031 equ $ ; in [3_BUTT~2.BAS] portb.2 = 0
Bcf PORTB,2
F1_000032 equ $ ; in [3_BUTT~2.BAS] portb.3 = 0
Bcf PORTB,3
F1_000033 equ $ ; in [3_BUTT~2.BAS] portb.4 = 0
Bcf PORTB,4
F1_000034 equ $ ; in [3_BUTT~2.BAS] portb.5 = 0
Bcf PORTB,5
F1_000035 equ $ ; in [3_BUTT~2.BAS] end if
bc@ll12
F1_000036 equ $ ; in [3_BUTT~2.BAS] if bo = 2 then
Movfw BO
Xorlw 2
Iorwf BOH,W
Iorwf BOHH,W
Iorwf BOHHH,W
Btfss STATUS,2
Goto bc@ll14
F1_000037 equ $ ; in [3_BUTT~2.BAS] portb.0 = 1
Bsf PORTB,0
F1_000038 equ $ ; in [3_BUTT~2.BAS] portb.1 = 1
Bsf PORTB,1
F1_000039 equ $ ; in [3_BUTT~2.BAS] portb.2 = 0
Bcf PORTB,2
F1_000040 equ $ ; in [3_BUTT~2.BAS] portb.3 = 0
Bcf PORTB,3
F1_000041 equ $ ; in [3_BUTT~2.BAS] portb.4 = 0
Bcf PORTB,4
F1_000042 equ $ ; in [3_BUTT~2.BAS] portb.5 = 0
Bcf PORTB,5
F1_000043 equ $ ; in [3_BUTT~2.BAS] end if
bc@ll14
F1_000044 equ $ ; in [3_BUTT~2.BAS] if bo = 3 then
Movfw BO
Xorlw 3
Iorwf BOH,W
Iorwf BOHH,W
Iorwf BOHHH,W
Btfss STATUS,2
Goto bc@ll16
F1_000045 equ $ ; in [3_BUTT~2.BAS] portb.0 = 1
Bsf PORTB,0
F1_000046 equ $ ; in [3_BUTT~2.BAS] portb.1 = 1
Bsf PORTB,1
F1_000047 equ $ ; in [3_BUTT~2.BAS] portb.2 = 1
Bsf PORTB,2
F1_000048 equ $ ; in [3_BUTT~2.BAS] portb.3 = 0
Bcf PORTB,3
F1_000049 equ $ ; in [3_BUTT~2.BAS] portb.4 = 0
Bcf PORTB,4
F1_000050 equ $ ; in [3_BUTT~2.BAS] portb.5 = 0
Bcf PORTB,5
F1_000051 equ $ ; in [3_BUTT~2.BAS] end if
bc@ll16
F1_000052 equ $ ; in [3_BUTT~2.BAS] if bo = 4 then
Movfw BO
Xorlw 4
Iorwf BOH,W
Iorwf BOHH,W
Iorwf BOHHH,W
Btfss STATUS,2
Goto bc@ll18
F1_000053 equ $ ; in [3_BUTT~2.BAS] portb.0 = 1
Bsf PORTB,0
F1_000054 equ $ ; in [3_BUTT~2.BAS] portb.1 = 1
Bsf PORTB,1
F1_000055 equ $ ; in [3_BUTT~2.BAS] portb.2 = 1
Bsf PORTB,2
F1_000056 equ $ ; in [3_BUTT~2.BAS] portb.3 = 1
Bsf PORTB,3
F1_000057 equ $ ; in [3_BUTT~2.BAS] portb.4 = 0
Bcf PORTB,4
F1_000058 equ $ ; in [3_BUTT~2.BAS] portb.5 = 0
Bcf PORTB,5
F1_000059 equ $ ; in [3_BUTT~2.BAS] endif
bc@ll18
F1_000060 equ $ ; in [3_BUTT~2.BAS] if bo = 5 then
Movfw BO
Xorlw 5
Iorwf BOH,W
Iorwf BOHH,W
Iorwf BOHHH,W
Btfss STATUS,2
Goto bc@ll20
F1_000061 equ $ ; in [3_BUTT~2.BAS] portb.0 = 1
Bsf PORTB,0
F1_000062 equ $ ; in [3_BUTT~2.BAS] portb.1 = 1
Bsf PORTB,1
F1_000063 equ $ ; in [3_BUTT~2.BAS] portb.2 = 1
Bsf PORTB,2
F1_000064 equ $ ; in [3_BUTT~2.BAS] portb.3 = 1
Bsf PORTB,3
F1_000065 equ $ ; in [3_BUTT~2.BAS] portb.4 = 1
Bsf PORTB,4
F1_000066 equ $ ; in [3_BUTT~2.BAS] portb.5 = 0
Bcf PORTB,5
F1_000067 equ $ ; in [3_BUTT~2.BAS] endif
bc@ll20
F1_000068 equ $ ; in [3_BUTT~2.BAS] if bo = 6 then
Movfw BO
Xorlw 6
Iorwf BOH,W
Iorwf BOHH,W
Iorwf BOHHH,W
Btfss STATUS,2
Goto bc@ll22
F1_000069 equ $ ; in [3_BUTT~2.BAS] portb.0 = 1
Bsf PORTB,0
F1_000070 equ $ ; in [3_BUTT~2.BAS] portb.1 = 1
Bsf PORTB,1
F1_000071 equ $ ; in [3_BUTT~2.BAS] portb.2 = 1
Bsf PORTB,2
F1_000072 equ $ ; in [3_BUTT~2.BAS] portb.3 = 1
Bsf PORTB,3
F1_000073 equ $ ; in [3_BUTT~2.BAS] portb.4 = 1
Bsf PORTB,4
F1_000074 equ $ ; in [3_BUTT~2.BAS] portb.5 = 1
Bsf PORTB,5
F1_000075 equ $ ; in [3_BUTT~2.BAS] end if
bc@ll22
F1_000076 equ $ ; in [3_BUTT~2.BAS] delayms 300
Movlw 1
Movwf PP1H
Movlw 44
Call dly@w
F1_000077 equ $ ; in [3_BUTT~2.BAS] Goto Loop ' Do it forever
Goto LOOP
END