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

What does a PIC do when it's not programmed?

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



Joined: 30 Oct 2003
Posts: 209
Location: Norfolk, England

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

What does a PIC do when it's not programmed?
PostPosted: Sat Feb 07, 2004 3:00 am     Reply with quote

Hi guys,
I have a battery project which I want programmed late in the manufacturing process.

What does a PIC do when there is no program in it? I presume that all the registers are at power on defaults? But are they safe in this state reliably? By safe I mean stable with all I/O at inputs etc. etc. The PIC will be getting power as soon as the batteries are connected!

I can't afford for parts of the circuit to be accidentally powered up by the 'blank' PIC and hence drain the battery. I have pulled these control lines 'off' with 10k resistors but obviously the PIC can power them up if it wants to!

I am intrigued to know what a un program PIC does when you power it up!

Will
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Sat Feb 07, 2004 10:28 am     Reply with quote

The data sheet for each PIC gives the default states of all register bits and I/O pins. Check the sheet for your PIC. For example, the PIC16F628A starts with TRISB as 0xFF so all of PortB is input and their internal pull-ups disabled (OPTION.RBPU=0). The fun continues for all ports and registers...

From memory, I thought the unprogrammed state of the FLASH was 0x00 (SLEEP) or 0x3FF (ADDWL). Again, this is from memory so don't trust me until you confirm it by reading a factory fresh part.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu Feb 12, 2004 3:36 pm     Reply with quote

I thought the PIC would just stand there and DROOL.

(sorry, couldn't resist)
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Thu Feb 12, 2004 4:07 pm     Reply with quote

As rwyoung said, an empty PIC's flash is filled 0x3FFF which is ADDLW 0xFF, so it you power up an empty PIC it will sit there in an endless loop adding 255 to W really fast Very Happy
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