CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

18f4620 vs 18f452 AD module

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sebdey



Joined: 11 Sep 2003
Posts: 17
Location: Switzerland

View user's profile Send private message

18f4620 vs 18f452 AD module
PostPosted: Tue Jan 11, 2005 2:10 am     Reply with quote

Hello,
I'am trying to port an application from 18f452 to 18f4620.

After updating some fuses values everything is working fine EXCEPT the AD converter module which is completely mad. It gives me erroneous values (like if it was reading 0.6 V instead of 10-13V), and sometimes (80% of the time) it crashes my application. I have specified Vdd and Vss as the voltage references, and I have read the 4620's datasheet, but I can't explain my problems.
I know that it is an AD module problem because I commented out all references to the ad module in my code and the application is working fine.

So, has anybody allready had any problems with the 18f4620 AD module, or are there some specificities that I should know before trying to use the 4620's ad module?

Thanks

SD
Ttelmah
Guest







PostPosted: Tue Jan 11, 2005 3:18 am     Reply with quote

Obvious comment. You don't say which AD pins you are using, but you must turn off the comparator module to use the ADC. The 18F452, does not have this extra module, so does not require this extra bit of initialisation. This is a bt of a 'classic' problem on the smaller 16F87x chips, where the 'A' variant has the comparator, and the normal version doesn't, and can give 'weird' results...

Best Wishes
Guest








PostPosted: Wed Jan 12, 2005 2:43 am     Reply with quote

I disabled all comparators and voltage reference modules, but I can't get my AD module working right, and I really don't understand why...

I'm using a 20MHz crystal, my AD setup is 16 TOsc clock, and 4 TAd automatic acquisition time, my Tris registers are set to input for the selected analog pins, so everything should be ok...but it's not working! Sad

No one ever had problems with 18f4620 AD ?? Did I forgot something which is so obvious that you did not mention it ? I'm really lost...

SD
sebdey



Joined: 11 Sep 2003
Posts: 17
Location: Switzerland

View user's profile Send private message

PostPosted: Wed Jan 12, 2005 4:25 am     Reply with quote

Very Happy
Okaaaaaayyyee,
I finally found where the problem was hiding...

As I was making manual conversions, by setting bit ADCON0,GO, and looking at it for conversion to end.
The problem is that I hadn't seen in the datasheet taht there was a difference between ADCON0 for 18f452 and for 18f4620, i.e. GO is ADCON,1 for 18f4620 and ADCON,2 for 18f452...now all is fixed.

Maybe my problem will help someone...

SD
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group