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

Initializing a port on download?

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







Initializing a port on download?
PostPosted: Thu Mar 13, 2003 2:01 pm     Reply with quote

I've got a new 18F452 based board that has a CPLD who's chip select is port C pin 5, active low. Unfortunatly, right after download that pin is low, so my CPLD is selected. Even more unfortunate, the CPLD uses the ICD-S lines. The upshot is I can't run this thing with ICD attached.

Is there a way, like a #rom or something, to have port C pin 5 start out hi? I understand that I won't be able to use the ICD whilst talking to my CPLD, I can live with that. But I'd sure like to use it when I'm not using the CPLD.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12634
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Initializing a port on download?
PostPosted: Thu Mar 13, 2003 11:32 pm     Reply with quote

:=I've got a new 18F452 based board that has a CPLD who's chip select is port C pin 5, active low. Unfortunatly, right after download that pin is low, so my CPLD is selected. Even more unfortunate, the CPLD uses the ICD-S lines. The upshot is I can't run this thing with ICD attached.
:=
:=Is there a way, like a #rom or something, to have port C pin 5 start out hi? I understand that I won't be able to use the ICD whilst talking to my CPLD, I can live with that. But I'd sure like to use it when I'm not using the CPLD.
-----------------------------------------------------------

As I said in the thread below, Port C, Pin 5 starts out as
an input, after power-up. I guess you didn't want to try
adding a 10K pull-up to that line.

You said that right after download, that pin goes low.
I would guess that your code in the PIC is setting it low.

To answer your question, you don't use #rom to set the
state of the i/o pins, you use code. You could use this:

output_high(PIN_C5);

As a test, why don't you set that pin high, right at the
start of the program, and then put in a long delay. Example:

main()
{
output_high(PIN_C5);

delay_ms(5000);

// Put other code here.

while(1);
}

See what happens.

------------------------
I have another comment:

I don't have ICD, so I'm not that familiar with it.
I assume that during download, the ICD is using ICSP mode
to program the PIC.
It's my understanding that "downloading" and "debugging"
are two separate processes with the ICD, and that you
can disable debugging. I don't know if this is causing
your problem, but if you have debugging enabled, why not
try disabling it ? Then presumably, the ICD won't try
to communicate with the PIC after download. And it won't
give you an error.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12660
jharkins
Guest







Re: Initializing a port on download?
PostPosted: Fri Mar 14, 2003 10:03 am     Reply with quote

Sorry, I don't know why my reply to your reply (the original thread) started a new thread (this one), that wasn't my intention.

I tried putting while(1); right after main(), it didn't help. ICD downloads the program, then says it can't take control of the board. I don't have time to put a pullup on the port, I'm leaving town for a week at noon today.

Thanks for your help.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12670
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