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

Adc Chanal

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



Joined: 11 Jun 2005
Posts: 38

View user's profile Send private message

Adc Chanal
PostPosted: Fri Jul 22, 2005 6:43 am     Reply with quote

i am trying set Adc chanal in a 877
I want set without setup_port but with bit in the register ADCON(0x1F) ecc
how i can do ?
with #bit ?


thanks !
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Jul 22, 2005 7:05 am     Reply with quote

Read the datasheet for the pic. The channel select starts at bit 3 and is composed of 3 bits. Here is probably the best way for portability between pics.

Code:

struct
{
  int8 ADON:1;
  int8 Unused:1;
  int8 GO:1;
  int8 Channel:3;
  int8 Clock:2;
}ADCON0bits;
#locate ADCON0bits = 0x1F

void foo(void)
{
  ADCON0bits.Channel = 1;
}
ferrarilib



Joined: 11 Jun 2005
Posts: 38

View user's profile Send private message

PostPosted: Fri Jul 22, 2005 9:18 am     Reply with quote

thanks ! Mark !
now i try Smile
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