Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MPASM 1.49 KB | None | 0 0
  1. init:
  2.     clrf PORTB
  3.     bsf STATUS, RP0
  4.     movlw b'11111111'
  5.     movwf TRISA
  6.     movlw b'00000000'
  7.     movwf TRISB
  8.     bcf STATUS, RP0
  9.    
  10. 'B,0 is the heater'
  11. 'B,1 is the fan'
  12. 'B,2 is the motor'
  13. 'B,4 is the LED'
  14.  
  15. 'A,2 is the thermistor'
  16. 'A,3 is the button'
  17.  
  18.  
  19. Start:
  20.     btfsc PORTA,2  'Is the temperature hot enough?'
  21.     goto Hot       'If the temp is hot enough go to hot subroutine'
  22.     nop        'Do nothing'
  23.     btfss PORTA,2  'Is the temperature hot enough'
  24.     goto Cold      'If the temp is too cold (pin is off) go to cold
  25.     nop
  26.    
  27. Main:  
  28.     call wait1000ms 'Wait 15 seconds'
  29.     call wait1000ms
  30.     call wait1000ms
  31.     call wait1000ms
  32.     call wait1000ms
  33.     call wait1000ms
  34.     call wait1000ms
  35.     call wait1000ms
  36.     call wait1000ms
  37.     call wait1000ms
  38.     call wait1000ms
  39.     call wait1000ms
  40.     call wait1000ms
  41.     call wait1000ms
  42.     call wait1000ms
  43.     call wait1000ms
  44.     movf Counter,W
  45.     addlw 1
  46.     addlw d'240'
  47.     goto kill2
  48.     goto kill       'Go to kill subroutine
  49.    
  50.  
  51. Hot:
  52.     bcf PORTB,0     'Turn the heater off'
  53.     bsf PORTB,1     'Turn  the fan on'
  54.     bsf PORTB,2     'Turn the motor on'
  55.     goto Main
  56.    
  57. Cold:
  58.     bsf PORTB,0     'Turn the heater on'
  59.     bsf PORTB,1     'Turn the fan on'
  60.     bsf PORTB,2     'Turn the motor on'
  61.     goto Main
  62.    
  63. Kill:
  64.     btfss PORTA,3   'If the kill switch is off go to decision
  65.     goto Main
  66.     btfsc PORTA,3   'If the kill switch is on then end the program
  67.     nop
  68.     bcf PORTB, 0    'Shut down the active pins'
  69.     bcf PORTB, 1
  70.     bcf PORTB, 2
  71.    
  72. Kill2:
  73.     nop
  74.     bcf PORTB, 0    'Shut down the active pins'
  75.     bcf PORTB, 1
  76.     bcf PORTB, 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement