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

Programming PIC via RS232?

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



Joined: 04 Jun 2007
Posts: 27

View user's profile Send private message

Programming PIC via RS232?
PostPosted: Mon Jul 30, 2007 12:52 am     Reply with quote

Simple Question:
Is there a way to programm the PIC 18F2545 via the RS232 Port of the PC and without a Programming Unit?
Guest








PostPosted: Mon Jul 30, 2007 1:33 am     Reply with quote

OK Ive found that its possible with the soft programming ability of the PIC and a Bootloader.
But do I need special hardware for this - or is the normal RS232 (MAX232) enogh?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Jul 30, 2007 1:39 am     Reply with quote

If your PIC is capable of self-programming than you can use a program called a bootloader. This is a tiny program you install in the PIC only once and than on every startup checks if a new program is to be uploaded. Disadvantage is that it takes up some program memory and for some bootloaders you have to change the memory range your program is using.

Many different bootloaders exist because of the different features people want:
- Small as possible, or packed with features.
- Triggered by pushbutton, special character received on RS232 at boot time, other trigger mechanisms.
- Located high in memory (no need to modify program range) or low in memory (more stable and code protected).
- Requires a special program on the PC, or can use any terminal emulator (hyperterm, etc.)
- Write to flash only, or also support for eeprom and configuration bytes.
- Open source or commercial.

The CCS compiler comes with a bootloader example, check ex_load.c in the examples directory.
Another popular bootloader is Tiny PIC bootloader. On this website you will find a small overview of other bootloaders as well.

Search this forum for more info.
inservi



Joined: 13 May 2007
Posts: 128

View user's profile Send private message

PostPosted: Mon Jul 30, 2007 2:50 am     Reply with quote

Hello,

When the software part is ready as Ckielstra just explained, dont forget to adapt the electrical level to the 'serial programmer'.
If you use a PC for send the program to the PIC you need to use a level adapter. The PIC accept max 5v ( more precisely, vdd + ~0.6v ).
The rs/232 standard use +/-15V. The frequently used adapter is a MAX232 but some time a circuit with 2 or 3 resistors and 2 transistors is enough. Personally, i use the MAX203 without external capacitor.

best regards,
dro.
_________________
in médio virtus
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