pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

pastebin - collaborative debugging tool View Help


Posted by solarwind on Wed 21 Jan 06:30
report abuse | download | new post

  1. #include <p16F690.inc>
  2.      __config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
  3.  
  4.      cblock 0x20
  5. Delay1              ; Assign an address to label Delay1
  6. Delay2
  7. Display             ; define a variable to hold the diplay
  8.      endc
  9.          
  10.      org 0
  11. Start:
  12.      bsf       STATUS,RP0     ; select Register Page 1
  13.      movlw     0xFF
  14.      movwf     TRISA          ; Make PortA all input
  15.      clrf      TRISC          ; Make PortC all output
  16.      movlw     0x10           ; A2D Clock Fosc/8
  17.      movwf     ADCON1
  18.      bcf       STATUS,RP0     ; back to Register Page 0
  19.  
  20.      bcf       STATUS,RP0     ; address Register Page 2
  21.      bsf       STATUS,RP1    
  22.      movlw     0xFF           ; we want all Port A pins Analoga
  23.      movwf     ANSEL
  24.      bcf       STATUS,RP0     ; address Register Page 0
  25.      bcf       STATUS,RP1
  26.      
  27.      movlw     0x01
  28.      movwf     ADCON0         ; configure A2D for Channel 0 (RA0), Left justified, and turn on the A2D module
  29. MainLoop:
  30.      nop                      ; wait 5uS for A2D amp to settle and capacitor to charge.
  31.      nop                      ; wait 1uS
  32.      nop                      ; wait 1uS
  33.      nop                      ; wait 1uS
  34.      nop                      ; wait 1uS
  35.      bsf       ADCON0,GO      ; start conversion
  36.      btfss     ADCON0,GO      ; this bit will change to zero when the conversion is complete
  37.      goto      $-1
  38.  
  39.      swapf     ADRESH,w       ; Copy the display to the LEDs
  40.      movwf     PORTC
  41.      goto      MainLoop
  42.      end

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post