school

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

temp.asm (790B)


      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 
     12 	;bsf	INTCON, INT0IE
     13 	;bsf	INTCON, GIE
     14 
     15 	rawtemp EQU B6
     16 
     17 	goto    main 
     18 showme:
     19 	movlw 	255
     20 	movwf 	PORTB
     21 	goto 	main
     22 main: 
     23 	call 	readadc1 	; read the thermistor (at room tem its 73)
     24 	movf	B1, W
     25 	movwf	rawtemp
     26 
     27 	call	readadc0
     28 	movf	B0, W
     29 
     30 	subwf	rawtemp, w
     31 	btfsc	STATUS, 0
     32 	goto 	showme 
     33 
     34 	movlw	0 
     35 	movwf 	PORTB
     36 
     37 	goto 	main
     38 
     39 	END		       	; ends the program