Guest User

Untitled

a guest
Nov 24th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MPASM 1.39 KB | None | 0 0
  1.         list        p=16F887, r=dec, w=-302
  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.                 movlw           b'11010111'     ;tmr0 clock source = instruction clock
  33.                 movwf           OPTION_REG      ;1:256 prescale
  34.         banksel     0x00        ;bank 0
  35.  
  36.                 clrf            TMR0            ;init tmr0
  37.                 bcf             INTCON,T0IF     ;clear tmr0 interrupt flag
  38.         btfss           INTCON,T0IF     ;is tmr0 interrupt flag high?
  39.                 goto            $-1             ;no, check again
  40.                 movlw           b'00000001'     ;toggle LED0
  41.                 xorwf           PORTD,F
  42.                 goto            $-6             ;do forever
  43.  
  44.         end                             ;end of file
Add Comment
Please, Sign In to add comment