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

Problems with Port A on a PIC16F877

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



Joined: 21 Oct 2003
Posts: 58

View user's profile Send private message

Problems with Port A on a PIC16F877
PostPosted: Wed Apr 25, 2007 1:59 am     Reply with quote

compiler Version 3.245

I have the port set to read adc on channels 0 - 3 using
Code:
setup_adc_ports(AN0_AN1_AN3);


as it states in the device header file. This works ok no problems, the problems are that I want to use Pins RA4 + RA5 as outputs to drive an LED. These pins are permantly in the low state even when I use a command
Code:
output_high (Pin_A4);


Is there any reason for this that anyone can suggest?

TIA

JFK
PIC_ECM



Joined: 23 Apr 2007
Posts: 2

View user's profile Send private message

PostPosted: Wed Apr 25, 2007 2:31 am     Reply with quote

Confirm that you hav'nt set all of port A as an input. That may be the cause of your problem

Carlos.
jfk1965



Joined: 21 Oct 2003
Posts: 58

View user's profile Send private message

PostPosted: Wed Apr 25, 2007 2:44 am     Reply with quote

Hi Carlos

No I haven't set it all as input it works fine if I use the MPlab SIM Debugger but doesn't work on an actual pic.

JFK
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Apr 25, 2007 3:40 am     Reply with quote

As on most PIC processors pin RA4 is an open-drain output. For example you can add a pull-up resistor to get a high level output voltage. In your case, driving a LED, I would reverse the LED connection and connect the cathode of the LED to the PIC (PIC sinks current i.s.o. sourcing, ouput_low() will light the LED).

Pin RA5 is a normal output and should work as expected.
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