![]() |
Forum Index : Microcontroller and PC projects : MaxiMite as 8 bit PIC programmer
Author | Message | ||||
MOBI Guru ![]() Joined: 02/12/2012 Location: AustraliaPosts: 819 |
About 8 years ago, I wrote a VB6 programme to assemble 8 bit PIC code and write the hex file data to the pic. I have been tinkering on and off for a few weeks translating the VB6 to MM code. The idea being that the MM editor be used to write the assembly code to the on board SD card, then assemble it and dump the resulting HEX code to an 8 bit pic. So far, I can read a hex file into the MM and dump the programme, eeprom data and config byte to the desired pic (not 32bit pics). The programme will handle up to 2048 words and 256 eeprom. So far, it has two programming modes, i.e sequential and 4 word block mode. Programming speed seems to be quite reasonable. The current version uses LV programming but the HV mode software is built in. HV means including a 12v(ish) supply plus a 12v MM controlled switch for the reset/HV pin. This is needed if the config of the PIC has been set to HV mode otherwise. Most early programmers only worked with HV mode. I swapped from using mostly string functions for data manipulation to numeric arrays. The full hex file is dumped into arrays on the MM and sent from there to the PIC. There are consequently a few routines that are not used but I've left them in checking out. I don't know if anyone still uses 8 bit pics? I'll clean up the code and post it in a day or two just to show the basic functions. If there is any interest, I'll also translate the Atmel Programmer version. David M. |
||||
MOBI Guru ![]() Joined: 02/12/2012 Location: AustraliaPosts: 819 |
No nibbles - not really surprised, I guess 8 bit pics are a thing of the past. Here is some code and a picture. The .ASM file is the code to blink a led on pic16f88 pin RB0. The hexfile.HEX file is the assembled pic 88 code and is currently hard coded but the code can be altered to allow user selection of different HEX files. The file picprog8.bas is the MM programmer code. The file "spare code" is leftover routines from conversion from strings to number arrays. In the MM code, progmode can be "1" or "2". "1" is for say a 628 chip and "2" is for a block programmed pic such as a F88. The pin connections can be seen from the .BAS code. Menu item 1 puts the pic in LV programming mode and must be selected first. Menu item 6 erases the PIC Menu item 10 loads the hexfile to the arrays and extracts the config word. Menu item 5 programmes the memory and eeprom and config. Even if no one uses this, there should be some useful code blocks in it. This code and programmer are only functional and can be "prettied" up to make it more user friendly. 2015-02-04_065828_HEXFILE.zip David M. |
||||
CircuitGizmos![]() Guru ![]() Joined: 08/09/2011 Location: United StatesPosts: 1427 |
Don't be discouraged. I think that this is a fine idea. I use Atmel 8 bitters more than PIC 8 bitters. Atmel programming is relatively easy and could be an alternate processor here. Micromites and Maximites! - Beginning Maximite |
||||
MOBI Guru ![]() Joined: 02/12/2012 Location: AustraliaPosts: 819 |
@ CG, Thanks for the encouragement. I intend to continue the project anyway. Next step is a PIC8 assembler. After that is operational, I'll translate my VB6 Atmel programmer to MM code. Should be a few challenges there. Lots of DATA statements. The VB6 version used linked arrays. There maybe enough room in the MM code to have the assembler and programmer in the one code package - otherwise use Chain command? don't think I'll tackle an Atmel assembler though. A few too many instructions and also the code construction is rather complex. Later on, if someone else wants to climb on that wagon, I'm prepared to have a go. Also, I still have on the back burner the MM based uMite programmer. With that one, I think the PE can be loaded as data statements. future job! David M. |
||||
CircuitGizmos![]() Guru ![]() Joined: 08/09/2011 Location: United StatesPosts: 1427 |
I should have said that better and with emphasis. I DID type louder when I typed the word "programming". ![]() I meant to just suggest that Atmel chip burning-programming (loading code to chip) is rather straight forward. It is SPI transfer stuff. You are reading a hex file from SD already, programming that hex file into an ATmega or whatnot is straight forward. It would be a hexfile meant for the Atmel microcontroller, of course. For that matter, similar routines could read/write serial EEPROMS or FLASH to and from the SD card. Micromites and Maximites! - Beginning Maximite |
||||
MOBI Guru ![]() Joined: 02/12/2012 Location: AustraliaPosts: 819 |
@ CG Yes, the options in using a MM for this sort of thing are pretty wide. Limited by imagination and curiosity. One of the things I didn't like about AVR was the number of pin configurations between chip versions. At least the 8 bit PIC had pretty standard programming pins. I used AVR studio to write the code/hex file and my VB6 (with a MCU dongle between the USB serial and programmer board to handle the pin manipulation) to do the actual programming. I think that using spi on the MM will be far simpler and faster(??) David M. |
||||
Frank N. Furter Guru ![]() Joined: 28/05/2012 Location: GermanyPosts: 946 |
Hi David, to use the Maximite as PIC programmer is really cool!!! I programmed in the past many 8 bit PICs. Can you tell me which controllers are supported by your programmer? (I have some 16F628, 16F877, 12F6XX, 10F2XX in my drawer...) Thanks Frank |
||||
MOBI Guru ![]() Joined: 02/12/2012 Location: AustraliaPosts: 819 |
Hi Frank, Thanks for the interest. As it stands, it will do 16F88 series. It is capable of programming any 8 bit pic but some changes will need to be made to the code such as selecting programming mode and Flash and eeprom . It should do a 628 but the only 628 chip I have seems to be defective. I'll have to try it on Pickit3 some time. This initial version was designed to get the various programming functions working but as I said earlier, it needs to be prettied up. One thing that would be handy is a config file to remember the last pic programmed or a "set up" screen that allows changing the flash size. Also it might be desirable to leave the configword to last to allow different options to be programmed selectively. There is a long way to go. If you want to alter the code, all I ask is that my reference at the header be left intact. Also, I will be continuing to modify so we don't want too many versions out there. David M. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9589 |
As a slight digression - nice to see you around the forums again, MOBI. I'd wondered what had become of you, as no posts from you for ages. Nice to know you are still doing the good work. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
Frank N. Furter Guru ![]() Joined: 28/05/2012 Location: GermanyPosts: 946 |
Hi David, I am very interested in your further work! Frank |
||||
elproducts![]() Senior Member ![]() Joined: 19/06/2011 Location: United StatesPosts: 282 |
Mobi I haven't been to the forum in a while so I was excited to see your post. Great job getting this to work on Maximite. I mostly work with 8-bit PICs so the fact you can program one on Maximite is something I've been looking for. I'll give it a try when I get a chance. I mostly use the Great Cow Basic open source compiler which has its source code written in BASIC. I wonder if Great Cow Basic could be reworked to run on Maximite and then combined with your programming code to make Maximite a complete 8-bit development tool. www.elproducts.com |
||||
MOBI Guru ![]() Joined: 02/12/2012 Location: AustraliaPosts: 819 |
@ el, Good to see a bit of interest. I am currently working on a set up menu so that PIC parameters can be saved to a config file or adjusted to suit the pick in hand. At the moment, the system can programme virtually any 8 bit pic. Give me a few days to refine things and I'll post the next edition. The plan is to use the edit function of the MM to produce the assembly language source code (the easy bit) and a bare bones assembler to produce the .HEX file and then my picpro8 code to programme the PIC. All without leaving the confines of the MaxiMite. One has to be careful to keep appropriate backups as it doesn't take much to screw things up when playing with the MM picprog source code. David M. |
||||
MOBI Guru ![]() Joined: 02/12/2012 Location: AustraliaPosts: 819 |
up date. Hi all, I have got pretty well all the main functions for the 8 bit PIC programmer working There are two programming algorithms selectable from the SETUP menu. Progmode 1 for older PICs and Progmode 2 for block programmable PICs. A 16F84A will work on Progmode 1 but will have to be wired for HV mode - that means hardware. I don't have a 16F628A to test, so if someone does. can they try it? Else, I will get one some time, but I don't really have a use for them, mostly F88 or F819. Menu option 7 MUST be entered first and necessary parameters set before trying to load a HEX file. The MM to target pic connections can be ascertained from the Picprog8.bas file and 8 bit PIC datasheet. If there is any confusion, give me a yell either post or pm. I have included a HEX file called RFID to see how long it took to Flash a fair sized programme. About a minute including verify. If anyone wants to have a fiddle, feel free. It has a lot of checks and balance to be put in yet, but at least it works (for me). Next step is to start on writing a very bare bones assembler. I spent a few hours trying to get the verify function working. The PIC Programmer commands are 5 bit binary strings and I had inserted a space at the beginning of the "read eeprom" command and it now had a length of 6 instead of 5. Couldn't see it for looking! Start Up Menu 99 = Quit 1 = Low Voltage Programming mode 2 = Target Pic "run" mode i.e. MCLR to VDD 3 = Display contents of Target PIC Flash Memory 4 = verify Flash and EEprom 5 = Programme flash, EEprom and Config Word 6 = Erase Pic (Enter Programming mode first (option 1) 7 = Go to Parameter setup menu - must be done first 8 = Read config word - must be in programming mode 9 = write config word - must be in programming mode 10 = Load selected HEX file as per parameters set up menu 11 = Display contents of data to be programmed OPTIONS Menu (Parameter set up menu) 1 = enter config word in HEX characters only e.g. 3fff not "3fff" or &H3fff 2 = Progmode (1 for sequential e.g. F628A and 2 for block mode e.g. F88) 3 = HEX file - enter as shown in MM FILES command 4 = Spare 5 = Spare 6 = FLASH memory upper limit (words) 7 = EEProm upper limit (bytes) 8 = Save set up 9 = Return to Main menu 2015-02-13_234645_PicProg8.zip David M. |
||||
Frank N. Furter Guru ![]() Joined: 28/05/2012 Location: GermanyPosts: 946 |
Hi Mobi! Thank you very much! I will test it at next opportunity! ...but I have no time at the moment (to much to do at work and a event of death in my family...) Frank |
||||
MOBI Guru ![]() Joined: 02/12/2012 Location: AustraliaPosts: 819 |
Hi Frank Sympathy to you and your family. See you when you are back on deck again. I also will be out of circulation for a day or two. David M. |
||||
MOBI Guru ![]() Joined: 02/12/2012 Location: AustraliaPosts: 819 |
Back home again and had a play. Previously, I thought my only 16F628A was defective, but have run it past PICKit3 and it programmes ok. I think the config word was giving me problems. Has to be erased in a special way if code protect has been activated. Now I think my algorithm for programming the 628 via the MM is not quite right, so must have a bit more of a play. First, I'll write a "LED blink" programme for the 628 and get it working using PICKit then see if I can get it to work on the MM. There are no problems with the F88 or F819 so far on the MM. David M. |
||||
MOBI Guru ![]() Joined: 02/12/2012 Location: AustraliaPosts: 819 |
Hi Again? An update on the MM PICPROG8 functions. I used the PICKit3 to set up the 628A with a simple routine that blinks all portB pins at a 1 second rate. Now that I have working firmware to go on with, I can play with the MM to get it to programme the 628A in Low voltage programming mode. All is LVP mode at the moment as it needs nothing more than the MM signal levels. The drawback is that you lose a pin on the 8 bit port. The PICKit3 (HV programming) is necessary to set up the LVP bit in the 628A configword if it has been previously upset. I'll update zip file when I get the 628A going on the MM. David M. |
||||
Frank N. Furter Guru ![]() Joined: 28/05/2012 Location: GermanyPosts: 946 |
Hi Mobi, these are good news! ![]() ...but it's not optimal to lose 1 pin on a 18 pin device... ![]() Did you work furthermore on a HV-version? THANKS! Frank |
||||
MOBI Guru ![]() Joined: 02/12/2012 Location: AustraliaPosts: 819 |
Hi Frank. The low voltage prog pin on the 628A is right in the middle of the 8 bit I/o port and severely restricts the uses of the device. I am sticking with LV programming for the moment as it doesn't need 12V(ish) switching. It won't take too much to knock up a transistor switch to operate the MCLR pin using a couple of 9v batteries and a potentiometer to set the programming voltage. A bit of current limiting could be included if you are nervous. The HV programming voltage is only a level and draws very little current. The software can be upgraded for 16 bit PICs as well. I have got the MM programming the 628A ok (and it runs) but have a bug in the verify routine. Bed time here and a day away tomorrow. Maybe back tomorrow night? David M. |
||||
MOBI Guru ![]() Joined: 02/12/2012 Location: AustraliaPosts: 819 |
Latest update on MM PICPROG8 programmer. It can now programme and verify the 16F88/819 family and also the earlier 16F628A variety and at an acceptable speed for a 8 bit PIC. So far, I have only coded for low voltage programming but the high voltage option is built in, just not currently selectable until the simple 12v soft switch is built. Anyone want to have a go? The sequence of operations is: x connect pic for low voltage programming. PGD, PGC, MCLRE, PGM 0V +5V (see software for MM pin usage) x Run PicProg8 x 'Setup' option 7 (set parameters) x 'Setup' option 8 to save data and option 9 to revert to main menu x 'Menu' option 10 - load HEX file x Apply power to the PIC x 'Menu' option 5 will erase and programme the PIC x 'Menu' option 4 will verify all programme and eeprom. If you want to set a different config word to that in the HEX file, first set a and save config word of 3FFF After having selected option 10 (load hex file), go back to the setup, alter the configword and save. Programme as normally and then reselect setup option 7, change the config word, save and return to main menu. Select option 1 (lv prog mode) then 9 which will write the new config word. This can be verified in option 8. the results are shown in binary with address 2007 being config and 2006 being device ID. Hope that isn't too confusing. Now to get a simple PICASM8 assembler working. 2015-02-24_111117_picprog8.zip David M. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |