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

ADCON1 register

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



Joined: 04 May 2009
Posts: 35
Location: India

View user's profile Send private message

ADCON1 register
PostPosted: Wed Jun 17, 2009 12:59 pm     Reply with quote

Hi, could anyone tell me how to set Port A as digital output in PIC16f72,
as I think I have to deal with ADCON1 register but don't know how?
Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 17, 2009 1:14 pm     Reply with quote

Quote:
Could anyone tell me how to set Port A as digital output in PIC16f72

The setup_adc_ports() function is used to do this.


Look at the settings for the setup_adc_port() function in the 16F72.h file.
Here is the file location:
Quote:
c:\program files\picc\devices\16f72.h
bharatwalia



Joined: 04 May 2009
Posts: 35
Location: India

View user's profile Send private message

PostPosted: Thu Jun 18, 2009 2:20 am     Reply with quote

i have define the adc_port to 7 value, but still i unable to set PORT A to digital out.

#byte port_a=5 //address of port a
#define ALL_DIGITAL 7 //setting digital output.


setup_adc_ports(7);
port_a=0xFF;
Ttelmah
Guest







PostPosted: Thu Jun 18, 2009 2:31 am     Reply with quote

Code:

#include "16F72.h"
//Put your clock definitions, and fuses here

void main(void) {
   setup_adc_ports(NO_ANALOGS);
   output_a(0xFF);

   //Rest of code

   while(TRUE);
}

Note the use of the 'output_a' function, rather than writing directly to the port latch. You _can_ write directly to the latch, but if you do, _you_ also need to control the TRIS register. The CCS function does this for you.

Best Wishes
Guest








PostPosted: Thu Jun 18, 2009 5:03 am     Reply with quote

Hi,Thanks a lot.......it worked
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