ervinne

Micro Sys. Lab 4 Ex. 01 - Simple Delay

Sep 8th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MPASM 0.72 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 0x00
  18.     MOVWF TRISB
  19.  
  20.     MOVLW 0x07
  21.     MOVWF OPTION_REG
  22.  
  23.     BCF STATUS, RP0
  24.     CLRF PORTB
  25.  
  26. MAIN
  27.     ;---------------------------------------------------------
  28.     ;   start of the program
  29.     MOVLW 0xF0
  30.     MOVWF PORTB
  31.     CALL DELAY
  32.  
  33.     MOVLW 0x0F
  34.     MOVWF PORTB
  35.     CALL DELAY
  36.  
  37.     GOTO MAIN
  38.  
  39. DELAY
  40.     ;---------------------------------------------------------
  41.     ;   create a delay
  42.     CLRF TMR0
  43.  
  44. LOOP
  45.     MOVF TMR0, 0
  46.     XORLW D'255'
  47.     BTFSS STATUS, Z
  48.     GOTO LOOP  
  49.     RETLW 0x00
  50.  
  51.     END
Advertisement
Add Comment
Please, Sign In to add comment