Electgpl

PIC - Simple ADC to Portl

Dec 10th, 2015
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     list    p=16f877A
  2.     include <pic16f877a.inc>
  3. __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _LVP_OFF &
  4. _PWRTE_ON & _XT_OSC
  5. ;
  6.     org     0x000
  7. ;
  8.     bcf     STATUS,RP0
  9.     bcf     STATUS,RP1
  10.     movlw   b'01000001'
  11.     movwf   ADCON0
  12.     bsf     STATUS,RP0
  13.     bcf     STATUS,RP1
  14.     clrf    TRISA
  15.     clrf    TRISB
  16.     clrf    TRISC
  17.     clrf    TRISD
  18.     clrf    TRISE
  19.     movlw   b'00000111'
  20.     movwf   OPTION_REG
  21.     movlw   b'00001110'
  22.     movwf   ADCON1
  23.     bsf     TRISA,0
  24.     bcf     STATUS,RP0
  25.     bcf     STATUS,RP1
  26.     clrf    PORTC
  27. ;
  28. bucle   btfss   INTCON,T0IF
  29.     goto    bucle
  30.     bcf     INTCON,T0IF
  31.     bsf     ADCON0,GO
  32. ;
  33. espera  btfsc   ADCON0,GO
  34.     goto    espera
  35.     movf    ADRESH,W
  36.     movwf   PORTC
  37.     goto    bucle
  38. ;
  39.     end
Advertisement
Add Comment
Please, Sign In to add comment