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 CCS Technical Support

Port PIN_E2 as digital output

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



Joined: 22 Dec 2004
Posts: 78

View user's profile Send private message

Port PIN_E2 as digital output
PostPosted: Sun Jan 16, 2005 10:13 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jan 17, 2005 12:49 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jan 17, 2005 1:40 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jan 17, 2005 2:25 pm     Reply with quote

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.
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