Advertisement
Guest User

Untitled

a guest
Jan 6th, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;****************************************************************
  2.         list        p=16F628, r=dec, w=-302
  3.         include     <P16F628.INC>
  4.         __config    _LVP_OFF & _BOREN_OFF & _PWRTE_ON & _WDT_OFF & _FOSC_INTOSCIO
  5.  
  6. ;****************************************************************
  7.  
  8.         cblock      0x70
  9.                 COUNT1
  10.                 COUNT2
  11.                 COUNT3
  12.         endc
  13.  
  14.  
  15. ;****************************************************************
  16.         org         0x00
  17.         goto        init
  18.  
  19.         org         0x0100
  20. ;****************************************************************
  21. init
  22.  
  23.         clrf        PORTA           ;clear PORTA output latch
  24.         clrf        PORTB           ;clear PORTB output latch
  25.         movlw       0x07            ;Turn comparators OFF and enable pins for I/O
  26.         movwf       CMCON          
  27.         banksel     TRISA           ;bank 1
  28.         clrf        TRISA          
  29.         clrf        TRISB
  30.         banksel     PORTA           ;bank 0
  31. ;****************************************************************
  32.  
  33.         bsf     STATUS,C        ;set carry bit
  34.         rlf     PORTB,F         ;shift left
  35.         movlw       4           ;786mS delay
  36.         call        DelayVar
  37.         goto        $-3         ;loop forever
  38.  
  39. ;****************************************************************
  40.  
  41. DelayMain   movlw       256
  42.         movwf       COUNT1
  43.         movwf       COUNT2
  44.         decfsz      COUNT1,F
  45.         goto        $-1
  46.         decfsz      COUNT2,F
  47.         goto        $-3
  48.         return
  49.  
  50. DelayVar    movwf       COUNT3
  51.         call        DELAY
  52.         decfsz      COUNT3,F
  53.         goto        $-2
  54.         return
  55.  
  56.         end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement