View previous topic :: View next topic |
Author |
Message |
bharatwalia
Joined: 04 May 2009 Posts: 35 Location: India
|
ADCON1 register |
Posted: Wed Jun 17, 2009 12:59 pm |
|
|
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
|
|
Posted: Wed Jun 17, 2009 1:14 pm |
|
|
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
|
|
Posted: Thu Jun 18, 2009 2:20 am |
|
|
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
|
|
Posted: Thu Jun 18, 2009 2:31 am |
|
|
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
|
|
Posted: Thu Jun 18, 2009 5:03 am |
|
|
Hi,Thanks a lot.......it worked |
|
|
|