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
Posted: Wed Apr 25, 2007 2:31 am
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
Posted: Wed Apr 25, 2007 2:44 am
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
Posted: Wed Apr 25, 2007 3:40 am
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.
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