View previous topic :: View next topic |
Author |
Message |
prayami
Joined: 22 Dec 2004 Posts: 78
|
Port PIN_E2 as digital output |
Posted: Sun Jan 16, 2005 10:13 pm |
|
|
Hi..
I am using PIC18F4525 using PCH compiler.
I am using PIN_E0, PIN_E1 and PIN_E2 as digital output.
The PIN_E0 and PIN_E1 are working fine. But PIN_E2 does not
change the output even though I change it programatically.
That means LEDs on PIN_E0 and PIN_E1 are working but on PIN_E2
is not working.
I set TRISE as under:
set_tris_e(0); //All output
What can be problem?
Last edited by prayami on Mon Jan 17, 2005 1:36 pm; edited 1 time in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jan 17, 2005 12:49 am |
|
|
Quote: | The PIN_E1 and PIN_E2 are working fine. But PIN_E3 does not
change the output even though I change it programatically. |
Download the 18F4525 data sheet from here:
http://ww1.microchip.com/downloads/en/DeviceDoc/39626b.pdf
Go to page 119 in the Acrobat reader, which should be section 10.5,
which is about Port E. Read the paragraph at the top of the right
column. It contains the answer. |
|
|
prayami
Joined: 22 Dec 2004 Posts: 78
|
|
Posted: Mon Jan 17, 2005 1:40 pm |
|
|
Sorry...
Instead of PIN_E0,PIN_E1 and PIN_E2, I have by mistake written
PIN_E1,PIN_E2 and PIN_E3. I have modified the same in my original
question.
That means I/O on PIN_E2 is not working.
I am not using PIN_E3. The MCLR/PIN_E3 is connected to +5 V using
Pullup register. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jan 17, 2005 2:25 pm |
|
|
There are several possible reasons:
Hardware:
1. The LED on Pin E2 could be installed with reversed polarity.
2. The LED could be defective.
3. The series resistor used with the LED may have a value that
is too large, so the LED is not very bright. (Try using 330 ohms).
4. One of the connections in the LED circuit may be broken.
Software:
1. Port E may not be properly configured for digital i/o.
The compiler is supposed to configure all analog pins as
digital i/o in its start-up code. But, sometimes CCS does not
do this correctly. So, you may need to do it manually, by
adding this line near the beginning of your program:
Code: | setup_adc_ports(NO_ANALOGS); |
2. It's possible that with your version of the compiler, the CCS
functions which control the ADC do not work correctly.
In that case you need to look closely at the ASM code in
your .LST file, and see if it's correct. |
|
|
|