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

dsPIC30f2020 Adc problem
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Dec 25, 2016 6:51 am     Reply with quote

In the set_tris_b() statement below, you have set bit 7 = 1.
This is for the AN7 pin, which is on pin B7. But you're using
AN6 on B6. You set the wrong tris bit.
Quote:
SETUP_ADC_PORTS(sAN6);
SETUP_ADC(ADC_CLOCK_DIV_32|ADC_TAD_MUL_16);

set_tris_a(0b0);
set_tris_b(0b10000000);
set_tris_d(0b0);
set_tris_e(0b00000000);
set_tris_f(0b000);


In the code below, you were told to use the channel number (6) earlier
in this thread, and not to use sANx. But you made the same mistake:
Quote:
set_adc_channel(san6);
delay_us(50);
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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