Advertisement
Guest User

Untitled

a guest
Oct 7th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MPASM 1.80 KB | None | 0 0
  1. ;*********************************************************************************************************
  2. ;**                                                 **
  3. ;**             Header Information                          **
  4. ;**                                                 **
  5. ;*********************************************************************************************************
  6.  
  7.         list        p-16F887, r=dec, w=-302
  8.         include     <P16F887.INC>
  9.         __config    _CONFIG1,_FCMEN_OFF & _IESO_OFF & _LVP_OFF & _BOR_OFF & _PWRTE_ON & _WDT_OFF & _INTOSCIO
  10.         __config    _CONFIG2,_WRT_HALF & _BOR21V
  11.  
  12. ;*********************************************************************************************************
  13. ;**                                                 **
  14. ;**             Variable Definitions                            **
  15. ;**                                                 **
  16. ;*********************************************************************************************************
  17.  
  18.         cblock      0x20
  19.                 COUNT1      ;delay counter 1
  20.                 COUNT2      ;delay counter 2
  21.                 COUNT3      ;delay counter 3
  22.         endc
  23.  
  24. ;*********************************************************************************************************
  25. ;**                                                 **
  26. ;**             Initialization Routine                          **
  27. ;**                                                 **
  28. ;*********************************************************************************************************
  29.  
  30.         org     0x00        ;reset vector
  31.         goto        START
  32.  
  33. START       clrf        PORTA       ;clear port a
  34.         clrf        PORTB       ;clear port b
  35.         clrf        PORTC       ;clear port c
  36.         clrf        PORTD       ;clear port d
  37.         clrf        PORTE       ;clear port e
  38.         banksel     ANSEL       ;switch to RAM bank 3
  39.         movlw       b'00000000' ;clear all bits in ANSEL and ANSELH
  40.         movwf       ANSEL       ;all ports digital I/O
  41.         movwf       ANSELH
  42.         banksel     TRISA       ;switch to RAM bank 1
  43.         movlw       b'00000000' ;clear all bits in TRISA-TRISE
  44.         movwf       TRISA       ;all ports in output mode
  45.         movwf       TRISB      
  46.         movwf       TRISC
  47.         movwf       TRISD
  48.         movwf       TRISE
  49.         banksel     PORTA       ;switch to RAM bank 0
  50.  
  51.         ;<Main code will go here>
  52.  
  53.         end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement