Hi all. I can't read and put the 8bit result adresh in portb, but in the same time the adresl can be transfered in the portd. I don't know what seems to be the problem. This is the asm code :
#include <p16F877.inc>
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _HS_OSC &_WRT_ENABLE_ON & _LVP_OFF & _DEBUG_OFF & _CPD_OFF
org 0x00
t equ 0x20
q equ 0x21
s equ 0x22
x equ 0x23
y equ 0x24
z equ 0x25
;
movlw b'10001001' ;
movwf ADCON0
clrf PORTA
bsf STATUS,RP0
movlw b'10000000'
movwf ADCON1
clrf TRISB
clrf TRISC
clrf TRISD
clrf ADRESL
bcf STATUS,RP0
clrf PORTD
clrf PORTB
clrf PORTA
clrf PORTE
loop1
call loopaa
bsf ADCON0,2
loop
btfsc ADCON0,2
goto loop
movf ADRESH,0
movwf PORTB
bsf 03,RP0
movf ADRESL,0
bcf 03,RP0
movwf PORTD
goto loop1
loopaa
movlw 0x8f
movwf x
movlw 0x8f
movwf y
movlw 0x0A
movwf z
delay1
bcf STATUS,2
decf x,1
btfss STATUS,2
goto delay1
bcf STATUS,2
movlw 0x8f
movwf x
decf y,1
btfss STATUS,2
goto delay1
movlw 0x8f
movwf x
movlw 0x8f
movwf y
decf z,1
btfss STATUS,2
goto delay1
return
nop
end
thanks