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 CCS Technical Support

Quick question about ADC in a PIC18F04Q41

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



Joined: 11 Sep 2003
Posts: 85
Location: Warmenhuizen - NL

View user's profile Send private message

Quick question about ADC in a PIC18F04Q41
PostPosted: Fri Dec 05, 2025 9:13 am     Reply with quote

I am either experiencing a senior moment or I never understood how channel switching for the AD converter works.

Before I elaborate on what the problem is, can I ask: do you need to issue a
Code:
set_adc_channel(sAN2);
before every read of an ADC value? Also if I am only interested in on input channel?
Woody



Joined: 11 Sep 2003
Posts: 85
Location: Warmenhuizen - NL

View user's profile Send private message

PostPosted: Fri Dec 05, 2025 9:44 am     Reply with quote

Yep, senior moment.

Reading my own question back I noticed the 'sAN2' and thought, that cannot be right....
And indeed, changing this to
Code:
set_adc_channel(2);
solved my problem.

My excuses for the stupid question.
temtronic



Joined: 01 Jul 2010
Posts: 9600
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Dec 05, 2025 1:43 pm     Reply with quote

don't feel bad.... at 72 ALL my moments are 'senior' !
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