diff options
author | thing 1 <thing1@seacrossedlovers.xyz> | 2024-11-14 08:11:18 +0000 |
---|---|---|
committer | thing 1 <thing1@seacrossedlovers.xyz> | 2024-11-14 08:11:18 +0000 |
commit | 2e1ccff01cf89539b621ac786898229307847f4b (patch) | |
tree | 88f91a94a58e6452288ed3145de51cb73c9f249b /electronics/cw1/final.asm | |
parent | bca6aeb86a3ca5d33cf1f33a81fcce2220d97a5a (diff) |
made too many changes to note
Diffstat (limited to 'electronics/cw1/final.asm')
-rw-r--r-- | electronics/cw1/final.asm | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/electronics/cw1/final.asm b/electronics/cw1/final.asm new file mode 100644 index 0000000..99b8508 --- /dev/null +++ b/electronics/cw1/final.asm @@ -0,0 +1,60 @@ +start: +init: + clrf PORTA ; make sure port A output latches are low + clrf PORTB + 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 + + ;bsf INTCON, INT0IE + ;bsf INTCON, GIE + + rawtemp EQU B6 + countdown EQU B7 + + goto main + +beep: ; a for loop that beeps a buzzer and turns on a led then sets a led on + ; if nothing is done + movlw 5 + movwf countdown + +loop1: + bcf PORTB, 3 ; turn off the status + bsf PORTB, 0 ; put a RED LED on PORTB:0 + bsf PORTB, 1 ; put a BUZZER on PORTB:1 + call wait1000ms + bcf PORTB, 0 + bcf PORTB, 1 + call wait1000ms + + decfsz countdown, F + goto loop1 + + bsf PORTB, 2 ; put an AMBER LED on PORTB:2 + + goto main + +main: ; reads the temprature + bsf PORTB,3 ; put a GREEN LED for status on PORTB:3 + + call readadc1 ; put a THERMISTOR on PORTA:1 + movf B1, W + movwf rawtemp + + call readadc0 ; put a POT on PORTA:0 + movf B0, W + + subwf rawtemp, w ; subtract the from the threshold value + btfss STATUS, 0 ; if higher than desired temp + goto beep ; ^ + + clrf STATUS + + goto main + + END ; ends the program |