Advertisement
Guest User

Pancho

a guest
Feb 21st, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.           INCLUDE 'derivative.inc'         
  2. ;-------------------------------------------------------------------------------------------------------                                                                   
  3.                 ORG         Z_RAMStart              ;MEMORIAS Y VARIABLES RAM              
  4. ;-------------------------------------------------------------------------------------------------------                   
  5.                 ORG         ROMStart                  ;PROGRAMA
  6.  
  7. start:  
  8.         LDA     #2T               ;//apaga el watchdog                      
  9.                 STA     SOPT1
  10.                
  11.                 CLR     PTAD              ;//configuras los puertos
  12.                 CLR     PTBD
  13.                 CLR     PTCD
  14.                
  15.                 MOV     #$00,PTADD
  16.                 MOV     #$FF,PTBDD
  17.                 MOV     #$00,PTCDD
  18.                
  19.                                          ;configurar puertos
  20.                                          ;cofiguras  adc
  21.                 MOV     #$68,ADCSC1
  22.                 MOV     #$60,ADCCFG
  23.                 MOV     #$01,APCTL2
  24.                                           ;configuras adc
  25.                 BRA     *                 ;bucle infinito
  26.  
  27.        ;interrupcion
  28. ADCISR:
  29.         PSHH  
  30.         LDA    ADCRL
  31.         CMP    #102T  ;//Valores limite, 102 = 2v
  32.         BLS    CASOL
  33.         CMP    #153T  ;//valores limite, 153 = 3v
  34.         BLS    CASO-  
  35.         MOV    #$76,PTBD
  36.         BRA    SALIR
  37. CASO-:          
  38.         MOV    #$40,PTBD
  39.         BRA    SALIR
  40. CASOL:  
  41.         MOV    #$38,PTBD
  42.              
  43. SALIR:
  44.         PULH
  45.         RTI
  46.         ;interrupcion
  47.         ;origen del adc            
  48.                 ORG     Vadc
  49.                 DC.W    ADCISR             
  50.                
  51.           ORG           Vreset                      ;VECTOR DE INTERRUPCION
  52.                 DC.W        start                       ;ORIGEN DEL PROGRAMA
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement