ervinne

Micro Sys. Lab 6 Ex. 01 - Simple Input

Sep 30th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MPASM 0.58 KB | None | 0 0
  1.     #INCLUDE "P16F84A.INC"
  2.  
  3.     __CONFIG _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF
  4.  
  5.     ERRORLEVEL -302
  6.  
  7.     ORG 0x00
  8.     GOTO START
  9.  
  10.     ORG 0x04
  11.     GOTO START
  12.  
  13. START
  14.     ;----------------------------------------------------------
  15.     ;   register configurations
  16.     BSF STATUS, RP0
  17.     MOVLW 0xFF
  18.     MOVWF TRISA
  19.     MOVLW 0x00
  20.     MOVWF TRISB
  21.  
  22.     MOVLW 0x07
  23.     MOVWF OPTION_REG
  24.  
  25.     BCF STATUS, RP0
  26.     CLRF PORTA
  27.     CLRF PORTB
  28.  
  29.     MOVLW B'10101010'
  30.     MOVWF PORTB
  31.  
  32. SON
  33.     BTFSC PORTA, 0
  34.     GOTO SON
  35.    
  36.     MOVLW B'01010101'
  37.     MOVWF PORTB
  38. SOFF
  39.     BTFSS PORTA, 0
  40.     GOTO SOFF
  41.    
  42.     MOVLW B'10101010'
  43.     MOVWF PORTB
  44.     GOTO SON
  45.  
  46.     END
Advertisement
Add Comment
Please, Sign In to add comment