Dragnovith
Junior Member level 1
Hello, I would like to know how do I enable the a/d conversion on the other ports, for example, I am able to perform the conversion through this code through the AN0 port, but I made several modifications and I couldn't enable AN1,AN2,etc.. .
The principle of this is that I'm trying to put an LM35 on each of the RA0, RA1, RA2 and RA3 ports. Then I'll have to convert, so I need that part of the A/D. For the sensor that is connected to the RA0 port, it is working.
The code comments are in Portuguese (Brazil), anything I can transcribe into English.
D0 and D1 are the variables responsible for the unit and ten of the LM35, so I would have to create others for each of the other entries correct?
The complete code is in the .rar file
The principle of this is that I'm trying to put an LM35 on each of the RA0, RA1, RA2 and RA3 ports. Then I'll have to convert, so I need that part of the A/D. For the sensor that is connected to the RA0 port, it is working.
The code comments are in Portuguese (Brazil), anything I can transcribe into English.
Code:
Main
bank1 ; MUDA BANCO MEMORIA 1
MOVLW B'10000000'
; 1-UU---- Alinhado a direita
; -0UU---- FSC/
; --UU0000 Todas analogicas
MOVWF ADCON1 ; valor justificado a esquerda
MOVLW B'00000000'
MOVWF TRISB
MOVLW B'00000000'
MOVWF TRISD
MOVLW B'11111111'
MOVWF TRISA
MOVLW B'00000000'
; --------
MOVWF OPTION_REG
MOVLW B'00000111' ; Desabilita os comparadores
MOVWF CMCON
bank0 ; BANCO DE MEMORIA 0
MOVLW B'00000001' ; Configura ADC
; 00----U- FSC/8
; -------1 Liga o conversor
; --000--- Canal AN0 entrada
MOVWF ADCON0
MOVLW B'00000000'
MOVWF INTCON
CLRF PORTB
CLRF D0
CLRF D1
D0 and D1 are the variables responsible for the unit and ten of the LM35, so I would have to create others for each of the other entries correct?
The complete code is in the .rar file
Attachments
Last edited by a moderator: