-
Strange LED Result!!
I hope I am not doing something silly. But when I use the program below only the Green LED (RA0) will flash. But if I comment out both lines 'LedG = ' then the Yellow LED will flash (RA1).
Using a PIC18F2525, PBP247 and MPASM 5.03
********************************************
DEFINE OSC 20
INCLUDE "MODEDEFS.BAS"
ADCON1 = 7
CMCON = 7
TRISA = $00
TRISB = $FF
TRISC = %11010000
LedG VAR PORTA.0
LedY VAR PORTA.1
start:
LedY = 1
LedG = 0
pause 500
LedY = 0
LedG = 1
pause 500
goto start
end
*********************************************
-
ADCON1 = $F 'page 248 of the datasheet.
Yes, on other PICs the value is 7, on this one it's $F.
-
Thanks Skimask,
I just took the information from the table shown as example 10-1 on setting up the ports on page 105. It uses $07 but my mistake as you said it shoud be $0F.
That will teach me to double check the correct register pages!
Many thanks for your help.
Bob