Strange issue with ADC.Read blocking on 18F4553 (12-bit A2D)

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Post Reply
geekything
Posts: 16
Joined: Mon Feb 11, 2008 10:06 pm

Strange issue with ADC.Read blocking on 18F4553 (12-bit A2D)

Post by geekything » Tue Aug 12, 2008 3:40 pm

Howdy,

I had a nice working program that ran happily on a '4550 that I've recently dusted off to get working on an '4553.

The '4553 was chosen as it has 12-bit rather than 10-bit AD and the extra two bits make a huge difference in my application.

However, it looks to me like ADC.Read(Channel) is blocking. I'm only using one channel (AN0) and if I pop in a '4550 things work as expected.

I've looked through the ADC module and can't seem to pinpoint where it might be blocking, although my spidey-sense is inclined to think that it's never finishing the 'convert'.

It also looks as if the ADC module reads as a word and I should be able to do 12-bit?

Any clues from anyone? If you have 12-bit AD working I'd love to hear from you!

Thx.

-marc

RKP
Registered User
Registered User
Posts: 82
Joined: Mon Oct 22, 2007 3:14 pm
Location: Maryland

Post by RKP » Wed Aug 13, 2008 2:25 pm

Marc,

You need to open the 18F4553.bas from the include folder and edit this line then save it.

From: #const _adc = $05 // 5 ADC channels available

To: #const _adc = $0D // 13 ADC channels available

I have seen this a few times with the A/D modules when the include files do not match the data sheet in the number of A/D channels available.

Hope this helps :)

geekything
Posts: 16
Joined: Mon Feb 11, 2008 10:06 pm

Post by geekything » Wed Aug 13, 2008 2:52 pm

That did the trick...many thanks! ;)

Now I just need to figure out why I'm still only getting 10-bit resolution from my code. :(

-marc

geekything
Posts: 16
Joined: Mon Feb 11, 2008 10:06 pm

Post by geekything » Wed Aug 13, 2008 8:26 pm

Okay, I solved my own problem...partly a dumb mistake on my part (of course) and I also needed to adjust my quantizing constant to 1/4096 rather than 1/1024.

Everything is working perfectly and I'd swear the '4553 has a more stable AtoD converter than the '4550?!

-marc

Post Reply