View previous topic :: View next topic |
Author |
Message |
cyberant
Joined: 04 Jun 2007 Posts: 27
|
Programming PIC via RS232? |
Posted: Mon Jul 30, 2007 12:52 am |
|
|
Simple Question:
Is there a way to programm the PIC 18F2545 via the RS232 Port of the PC and without a Programming Unit? |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Mon Jul 30, 2007 1:33 am |
|
|
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? |
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Jul 30, 2007 1:39 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
inservi
Joined: 13 May 2007 Posts: 128
|
|
Posted: Mon Jul 30, 2007 2:50 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|