Gendrick PeƱalver Guest
|
Read ADC |
Posted: Mon Aug 25, 2008 7:35 pm |
|
|
Hi, I use this code, in asembler, for read all ADC in the 30F4011, read the data sheet
for undestend that, exuse my English..
.equ __30F3011, 1
.include "p30f3011.inc"
_main:
CALL _VisualInitialization
;*******************
mov #0X0038, w0
mov w0, ADPCFG
mov #0X0000, w0 ;0000, canal 0
mov w0, ADCHS
mov #0X0000, w0
mov w0, ADCSSL
mov #0X0B02, w0
mov w0, ADCON3
mov #0X80E4, w0 ;AD=off, idle=0,enteros,E=1110
mov w0, ADCON1 ;111 =interno, ASAM y SAMP=0
MOV #0X0004, W0
MOV W0, ADCON2
BSET ADCON1, #15 ;AD =On
BCLR IEC0, #11
mov #0x1000, W0 ; Nivel de INTRR ADc =1
mov W0, IPC2
BSET IEC0, #ADIE ; ACTIVA INTRR. POR ADC
BSET ADCON1, #1 ; Comienzael muestreo
;****** Lee el canal 0 ; read ADC0
Bucle:
mov #0X0000, W0 ;0000, canal 0
mov W0, ADCHS
BSET ADCON1, #15 ;AD =On
BSET IEC0, #ADIE ;activa la Interr
BSET ADCON1, #1 ; Comienza el muestreo
And so on |
|