summaryrefslogtreecommitdiff
path: root/electronics/asm/5.asm
blob: 5455ded427b1651c8b58f957e3cb6609aa5aa510 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
start: 
init: 
	clrf     PORTA          ; make sure port A output latches are low 
	clrf     PORTB          ; make sure port B output latches are low 
	bsf      STATUS,RP0     ; select memory bank 1 
	movlw 	 b'11111111'    ; set port A data direction to inputs 
	movwf 	 TRISA         
	movlw 	 b'00000000'    ; set port B data direction to outputs 
	movwf 	 TRISB          
	bcf      STATUS,RP0     ; select memory bank 0 
	goto     main 

main: 
	btfsc 	 PORTA, 0
	goto 	 led0

	btfsc 	 PORTA, 1
	goto 	 led1

	btfsc 	 PORTA, 2
	goto 	 led2

	call 	 wait1000ms
	call 	 wait1000ms

	movlw 	 b'00000000'
	movwf	 PORTB
	goto 	 main

led0:
	movlw 	 b'00000001'
	movwf	 PORTB
	goto 	 main

led1:
	movlw 	 b'00000010'
	movwf	 PORTB
	goto 	 main

led2:
	movlw 	 b'00000100'
	movwf	 PORTB
	goto 	 main

	end		        ; ends the program