Advertisement
Guest User

pancho2

a guest
Feb 21st, 2017
75
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    #51T  ;//Valores limite, 51 = 1v        
  32.         BLS    CASO8
  33.        
  34.         CMP    #128T  ;//valores limite, 128 = 2,5v
  35.         BLS    CASOA  
  36.        
  37.         CMP    #168T  ;168 = 3,3V
  38.         BLS    CASOT
  39.        
  40.         MOV    #$76,PTBD
  41.         BRA    SALIR
  42.        
  43. CASOT:  MOV    #$46,PTBD
  44.         BRA    SALIR        
  45.        
  46.        
  47. CASOA:  
  48.        
  49.         MOV    #$40,PTBD
  50.         BRA    SALIR
  51. CASO8:  
  52.         MOV    #$7F,PTBD
  53.         BRA    SALIR
  54.        
  55.              
  56. SALIR:
  57.         PULH
  58.         RTI
  59.         ;interrupcion
  60.         ;origen del adc            
  61.                 ORG     Vadc
  62.                 DC.W    ADCISR             
  63.                
  64.           ORG           Vreset                      ;VECTOR DE INTERRUPCION
  65.                 DC.W        start                       ;ORIGEN DEL PROGRAMA
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement