Pic circuit with built in programmer

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Post Reply
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Pic circuit with built in programmer

Post by Newz2000 »

Hello,<p>I'm *imagining* a simple circuit that has a serial port for two way communication with a PC. With the flip of a switch (or pound of a fist) the serial port becomes the interface to a programmer for the pic processor. This would be for a newer Pic, such as the 16f628 of 16f88.<p>Am I barking up the wrong tree, or can this be done simply? OK, just to preclude an obvious comment, I'm trying NOT to use low voltage programming (I don't want to lose a pin).<p>Following up on the "barking up a wrong tree," I'd like to power the circuit with 12v or less, yet the data sheet says programming requires 13v. Has anyone confirmed if its possible to program with 12v? The Pic uses very little current; the 13v just triggers programming mode.<p>I'm not asking for anyone to do the work for me, I'm just trying to do some investigation work to see if this is feasable. It seems that most serial programmer circuits revolve around the JDM style programmer, which uses a lot of parts (imho). Maybe the lack of information could be because serial port programming is now so common and easy that it just doesn't get mentioned, or it could be because it's so uncommon that no one is using it. Its also possible that I just don't know what to search for, which is why I'm asking here.<p>I'm trying to create a "human to computer interface" that has the ability to update its firmware through software and use as few parts as possible. The parts I plan to use now are:
Pic 16f628
Serial port hardware (Max232 et al)
Interface components (switches and LEDs)
Stuff to handle power. Really, I only need 4.5 - 6 volts, but I figure a 12v power supply is needed to enable programming, but if I'm wrong, please correct me.<p>[ June 27, 2005: Message edited by: Matt Nuzum ]</p>
rstofer
Posts: 115
Joined: Sun May 15, 2005 1:01 am
Contact:

Re: Pic circuit with built in programmer

Post by rstofer »

Maybe all you wish can be done but I doubt it. If it was possible, somebody would have posted it to the Internet.<p>If you really want serial port programmability, why not consider a boot loader? These can be fairly small in code space and use the USART for transfer.<p>The next problem is the programming algorithm itself. You need to be certain the bootloader programs in terms of the proper block size which varies among devices.<p>By the way, most of the simple PIC programmers only work on a very few devices and often not all that well. There are timing and rise time requirements for both Vpp and Vcc that some of the programmers just don't meet.<p>I gave up on 3 fairly expensive PIC programmers and just moved to the PICStart Plus. Microchip ought to be capable of programming their own devices. I should have done that in the first place.<p>You can buy a 16F877 with a bootloader already programmed for $8 at www.junun.org See http://www.junun.org/MarkIII/Info.jsp?item=12<p>There is a BotLoader program available in the files section of the Yahoo MiniSumo Mark III group although Hyperterminal will work if you set the end of line delay to 100 mS. Parameters are 38400,n,8,1 with a 20 MHz crystal or ceramic resonator.
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: Pic circuit with built in programmer

Post by Newz2000 »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by rstofer:
Maybe all you wish can be done but I doubt it. If it was possible, somebody would have posted it to the Internet.<p>If you really want serial port programmability, why not consider a boot loader? These can be fairly small in code space and use the USART for transfer.<hr></blockquote><p>Yes, I'm considering the bootloader approach. Maybe that is the easiest way. I've ordered a 16f88 so that I could test this method out.<p>My burning question about the bootloaders, and maybe this will be answered when I get a chance to try it out, is how do you have to change your program to accommodate the loader?<p>Regarding the compatibility of simple programmer circuits with multiple MCUs, I plan on implementing the circuit specifically for a CPU, so that isn't a concern.<p>Thanks for your suggestion, I will definately try this out.
rstofer
Posts: 115
Joined: Sun May 15, 2005 1:01 am
Contact:

Re: Pic circuit with built in programmer

Post by rstofer »

As far as the 16F877 bootloader from Junun, the only accomodations required are: you can not set the fuses, your program must be ORGd at 0x003 (you can't use addresses 0x000..0x002) and the upper 2k is reserved.<p>There are other bootloaders around. Microchip has some as well. I have used the 16F88 but not with a bootloader.<p>There is a version of the bootloader for the 16F877A which uses a different programming algorithm. I think you can find it at the Yahoo MiniSumo Mark III group files section.
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: Pic circuit with built in programmer

Post by philba »

each bootloader is somewhat different in its requirements - usually you have to make room for the bootloader to take over the reset vector at 0. <p>You might try the bootloader that sparkfun has. It's known to work on the 16F88. The changes are documented there.<p>[ June 28, 2005: Message edited by: philba ]</p>
Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:

Re: Pic circuit with built in programmer

Post by Gorgon »

Hi Matt,
Check this out and see if you can use it. I think it is what you want, with example code:
http://www.microchip.com/stellent/idcpl ... e=en012031 <p>TOK ;)<p>[ June 28, 2005: Message edited by: Gorgon ]</p>
Gorgon the Caretaker - Character in a childrens TV-show from 1968. ;)
bodgy
Posts: 1044
Joined: Tue Dec 04, 2001 1:01 am
Location: Australia
Contact:

Re: Pic circuit with built in programmer

Post by bodgy »

Actually if you want to be really really clever and go to the top of the class and be called all those nice kind names. Have a look at Wouter Voti's entry in the Pic competition a few years back at Circuit Cellar.<p>He realised that on the 18F series and the 16F that have debugging capabilities, they can actually be programmed via the MCLR pin.<p>He won a noticeable mention. Wouter used to teach EE in Holland and now is a contractor.<p>Colin
On a clear disk you can seek forever.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 84 guests