You probably need to configure the A/D on PORTA.1 to a digital instead of analog.
You probably need to configure the A/D on PORTA.1 to a digital instead of analog.
From the datasheet:
Pin Name: Pin Type: BufferType: Description:
RA1 I/O TTL Digital I/O
AN1 I Analog Analog
Praytell kind sir, how'st thou'st do'st that?
datasheet, a/d converter section ADCON, ANSEL, CMCON etc etc
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I believe this will do it. If I'm incorrect someone please let me know.Code:ADCON0 = %00000000 ' Turn off A/D converter ADCON1 = %00001110 ' Make PORTA.0 & PORTA.1 analog, others digital
No or partially... you forget the internal comparator, but Ra1 will be digital in deed if the comparator is turn off... not AN0
CMCON and ADCON1 only to disable all analog stuff, use ADCON0 only if you want to play really safe.
Not much... you'll discover everything in the... datasheet. it's free to download and really usefull
http://ww1.microchip.com/downloads/e...Doc/39631a.pdf
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thanks for the replies. I didnt have to do this with the 628A, so I just expected it to work on the 18f2520 (which is 32k code not 16k..oops). I have been reading the datasheet for a week now and it has info on ADCON, ANSEL, CMCON, etc, but not how and where to use it. Nothing in the Picbasic help about it either.
So to change these registers, I need to identify them and add them to the top of my pic basic code like TRIS? Can I do this with any register I want to alter? Or is there only a few that Picbasic recognizes?
I believe PBP will allow you to change virtually any register that is applicable for the MCU you've chosen.
Thanks for all your help Cokehead and Mr E! I will give this a try this evening and let you know what happens.
Bookmarks