Guest User

Untitled

a guest
Nov 24th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MPASM 0.88 KB | None | 0 0
  1.         list        p=16F887, r=dec, w=1
  2.         include     <P16F887.INC>
  3.         __config    _CONFIG1,_LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _PWRTE_ON & _WDT_OFF & _INTOSCIO
  4.         __config    _CONFIG2,_WRT_HALF & _BOR21V
  5.  
  6. #define     LED0        PORTD,0
  7.  
  8.         cblock      0x20
  9.                 COUNT1
  10.                 COUNT2
  11.         endc
  12.  
  13.         org     0x000       ;reset vector
  14.         goto        START
  15.  
  16. START       clrf        PORTA       ;init ports
  17.         clrf        PORTB
  18.         clrf        PORTC
  19.         clrf        PORTD
  20.         clrf        PORTE
  21.         banksel     ANSEL       ;bank 3
  22.         movlw       b'00000000' ;all ports digital I/O
  23.         movwf       ANSEL
  24.         movwf       ANSELH
  25.         banksel     TRISA       ;bank 1
  26.         movlw       b'00000000' ;all ports output
  27.         movwf       TRISA
  28.         movwf       TRISB
  29.         movwf       TRISC
  30.         movwf       TRISD
  31.         movwf       TRISE
  32.         banksel     0x00        ;bank 0
  33.  
  34.         movlw       b'00000001'
  35.         xorwf       PORTD,F
  36.         call        DELAY
  37.         goto        $-2
  38.  
  39. DELAY       movlw       0xFF
  40.         movwf       COUNT1
  41.         movwf       COUNT2
  42.         decfsz      COUNT1,F
  43.         goto        $-1
  44.         decfsz      COUNT2,F
  45.         goto        $-3
  46.         return
  47.  
  48.         end
Add Comment
Please, Sign In to add comment