Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;
- ; MPASM template supplied by BILBOROUGH COLLEGE 28228
- ;NAME ...................................................ENTER YOUR NAME AND PROJECT TITLE HERE
- ;PROGRAM TITLE ...................................................
- ; Version 2 board settings: J14 links: Digital
- ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ;
- ; The following lines embed configuration data into the PICmicro
- LIST P=16F88
- __CONFIG H'2007', H'3F7A' ; RC mode
- __CONFIG H'2008', H'3FFC' ; Clock Fail-Safe disabled
- ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- #DEFINE PAGE0 BCF STATUS,5
- #DEFINE PAGE1 BSF STATUS,5
- OPSHUN EQU H'81' ;
- STATUS EQU H'03' ;defines status register
- TRISA EQU H'5' ;defines trisA register
- PORTA EQU H'05' ;defines portA register
- TRISB EQU H'6' ;defines TrisB register
- PORTB EQU H'06' ;defines portB register
- PCL EQU H'02' ;Names the register called program counter
- W EQU 0 ;Sets up the name used for the working register
- F EQU 1 ;Sets up the name used for file
- Z EQU 2 ;Sets up the name used for the zero flag
- C EQU 0 ;Sets up the name used for the carry flag
- ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ; NAME YOUR REGISTERS HERE
- delay EQU H'0C' ;names the register called ????????
- delayf EQU H'0D' ;names the register called ????????
- lights EQU H'0E' ;names the register called ???????? DELETE THIS SECTION IF NOT USING REGISTERS
- ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ; VECTORS
- ORG 00 ; Reset vector
- GOTO XYZ ; Goto start of program
- ORG 04 ; Interrupt vector address
- GOTO 05 ; Goto start of program
- ORG 05 ; Start of program memory
- ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ; THIS SECTION IS USED TO SET THE DIRECTION OF THE OUTPUT PORTS.
- ;ENTER the binary number for the Data Direction in the TRIS registers.
- ;Use 0 if you would like an output or 1 if you would like an input.
- XYZ BSF STATUS,5 ;Bank 1 operation
- CLRF H'1B' ;Makes the ANSEL (analogue) inputs digital
- MOVLW B'00011111';
- MOVWF TRISA ;This sets portA data direction to #######
- MOVLW B'00000000' ;
- MOVWF TRISB ;This sets portB data direction to #######
- BCF STATUS,5 ;Back to bank 0
- ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ; MAIN PROGRAM
- start CLRF delay
- CLRF lights
- CLRF delayf
- CLRF PORTA
- CLRF PORTB
- CALL input1
- CALL delsta
- CALL tend
- GOTO start
- ; write your program here.
- ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ; SUBROUTINES
- ; Any subroutines to go in this section.
- input1 BTFSC PORTA,0
- GOTO wait0
- BTFSC PORTA,1
- GOTO wait1
- BTFSC PORTA,2
- GOTO wait2
- BTFSC PORTA,3
- GOTO wait3
- BTFSC PORTA,4
- GOTO wait4
- GOTO input1
- wait0 BTFSC PORTA,0
- GOTO wait0
- GOTO delay10
- wait1 BTFSC PORTA,1
- GOTO wait1
- GOTO delay30
- wait2 BTFSC PORTA,2
- GOTO wait2
- GOTO delay1
- wait3 BTFSC PORTA,3
- GOTO wait3
- GOTO delay2
- wait4 BTFSC PORTA,4
- GOTO wait4
- GOTO delay5
- delay10 MOVLW B'00000001'
- MOVWF delay
- MOVLW B'00000001'
- MOVLW lights
- RETURN
- delay30 MOVLW B'00000011'
- MOVWF delay
- MOVLW B'00000011'
- MOVLW lights
- RETURN
- delay1 MOVLW B'00000110'
- MOVWF delay
- MOVLW B'00000110'
- MOVLW lights
- RETURN
- delay2 MOVLW B'00001100'
- MOVWF delay
- MOVLW B'00001100'
- MOVLW lights
- RETURN
- delay5 MOVLW B'00011110'
- MOVWF delay
- MOVLW B'00011110'
- MOVLW lights
- RETURN
- delsta MOVWF lights, PORTB
- DECF delay
- CALL count
- RETURN
- count MOVLW B'111111111'
- MOVWF delayf
- count2 DECFSZ delayf,F
- GOTO count2
- DECF lights
- DECFSZ delay
- RETURN
- tend CALL flash
- CALL flash
- CALL flash
- CALL flash
- CALL flash
- RETURN
- flash MOVLW B'00011111'
- MOVWF PORTB
- MOVLW B'11111111'
- MOVWF PORTB
- MOVLW B'00011111'
- MOVWF PORTB
- MOVLW B'11111111'
- MOVWF PORTB
- MOVLW B'00011111'
- MOVWF PORTB
- MOVLW B'11111111'
- MOVWF PORTB
- MOVLW B'00011111'
- MOVWF PORTB
- MOVLW B'11111111'
- MOVWF PORTB
- RETURN
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement