PDA

View Full Version : Strange LED Result!!



BobP
- 18th April 2007, 13:07
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
*********************************************

skimask
- 18th April 2007, 13:52
ADCON1 = $F 'page 248 of the datasheet.
Yes, on other PICs the value is 7, on this one it's $F.

BobP
- 18th April 2007, 15:59
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