school

thing1's amazing school repo
Log | Files | Refs | Submodules | README

mem.asm (968B)


      1 start: 
      2 init: 
      3 	clrf    PORTA           ; make sure port A output latches are low 
      4 	clrf    PORTB           ; make sure port B output latches are low 
      5 	bsf     STATUS,RP0      ; select memory bank 1 
      6 	movlw 	b'11111111'     ; set port A data direction to inputs 
      7 	movwf 	TRISA         
      8 	movlw 	b'00000000'     ; set port B data direction to outputs 
      9 	movwf 	TRISB          
     10 	bcf     STATUS,RP0      ; select memory bank 0 
     11 	goto    main 
     12 ;; for this program use the 2k 8 bit mem chip, with WE on B2, OE on B3, and the memorys 3 least
     13 ;; sig bits to B4-B6 (inclusive), all other pins on the mem chip need to be held low, and an led 
     14 ;; needs to be on B1
     15 ;; when B1 goes high move the 3 pins from the microcontroler to leds and see the value
     16 main: 
     17 	movlw	b'01111000' 
     18 	movwf	PORTB		; make we high, oe low, and 3 pins high
     19 	call	wait1000ms
     20 
     21 	movlw	b'00000110' 
     22 	movwf	PORTB		; make we low, oe high, and 3 pins low 
     23 
     24 noend:
     25 	goto 	noend
     26 
     27 	END		        ; ends the program