test.ba~ (1010B)
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 countdown EQU B7 17 18 movlw 5 19 movwf countdown 20 21 movlw 0 22 23 goto main 24 beep: 25 movlw 255 26 movwf PORTB 27 call wait1000ms 28 movlw 0 29 movwf PORTB 30 call wait1000ms 31 decfsz countdown, F 32 goto beep 33 34 goto start 35 main: 36 call readadc1 ; read the thermistor (at room tem its 73) 37 movf B1, W 38 movwf rawtemp 39 40 call readadc0 ; pot for calibration 41 movf B0, W 42 43 subwf rawtemp, w 44 btfss STATUS, 0 45 goto beep 46 47 movlw 0 48 movwf PORTB 49 50 goto main 51 52 END ; ends the program 53