Introduction to PIC12C508 chip programmer required. (Solved). - Page 1
Forum section: electronics / general

author: Jim0000
author_rank: Contributor
timestamp: March 08, 2023, 05:01:17 am
content: I am planning to build a little lost model aircraft buzzer alarm as per these instructions:https://www.rc-cam.com/lma.htmThe instructions are to use a "traditional PIC chip programmer".I have not much of an idea what this is, but found these offerings on aliexpress:https://www.aliexpress.com/w/wholesale-PIC-chip-programmer.html?catId=0&initiative_id=SB_20230307204221&origin=y&SearchText=PIC+chip+programmer&spm=a2g0o.detail.1000002.0Which one will do the job?And where would I find a beginners tutorial on how to use this type of equipment please?Jim.

author: DavidAlfa
author_rank: Super Contributor
timestamp: March 08, 2023, 05:53:32 am
content: Search a pickit2, they're $12.

author: JPortici
author_rank: Super Contributor
timestamp: March 08, 2023, 06:03:24 am
content: I don't think they can do PIC12C. the only official programmer that supports C parts should be the PM3if the OP uses PIC12F502 instead they can use any pickit

author: Jim0000
author_rank: Contributor
timestamp: March 08, 2023, 07:08:39 am
content: Thanks for the replies David and JP.However, as I am totally new to this, I will require more specific guidance before ordering parts.Jim.

author: jpanhalt
author_rank: Super Contributor
timestamp: March 08, 2023, 07:28:05 am
content: Quote for link:QuoteI would strongly recommend using either the 12F508 or 12F509. "12C" devices are not reprogrammable. The F stands for flash memory, which means you can reprogram them. I believe the PicSart II Plus can also program the 12C devices.but that device is not on this PC.When I started with Microchip, that is what I used to program 12F and 16C/16F devices. Virtually any MIcrochip programmer will work with the 12F devices too.Edit: I can't imagine why the authors did not post the extremely simplistic Assembly code along with the hex code. In any event, I disassembled that code and have attached it here.Advice, that would be a good place to start, if you plan to continue using MCU's and writing your own code someday.Edit2: BTW, The disassembler I used gave an end of file error for line 65. If you get such an error when trying to load it, just delete or comment out that line.

author: Jim0000
author_rank: Contributor
timestamp: March 08, 2023, 08:47:28 pm
content: QuoteThanks for that confirmation. I will order a couple of them, if I can find them that is.QuoteThanks for doing that. I don't know what that/they are yet, but plan to do some reading up and watching videos on the basics in the next few days.Jim.

author: jpanhalt
author_rank: Super Contributor
timestamp: March 08, 2023, 09:13:48 pm
content: So far as i know, when the transmitter's signal is lost, the code simply looks for a missing pulse, hence the input to pin4, which is input only on that chip. I have never needed one, as my crashes have all been "public."The technology is more than 20 years old.

author: Jim0000
author_rank: Contributor
timestamp: March 08, 2023, 11:02:45 pm
content: What programming cable(s) will I required to flash/upload/program the PIC12F508 please?There are multiple offerings from this vendor:https://www.aliexpress.com/w/wholesale-PIC-programming-cable.html?catId=0&initiative_id=SB_20230308130348&SearchText=PIC+programming+cable&spm=a2g0o.productlist.1000002.0Is one of those suitable?Jim.

author: jpanhalt
author_rank: Super Contributor
timestamp: March 08, 2023, 11:39:16 pm
content: That link leads to several options. Which one are you considering? Which programmer?I am familiar with PicKit 2,3 , ICD3, and PicStart II Plus. Let's presume you mean a PK2 or PK3. PIC's using ICSP (In Circuit Serial Programming) requires a minimum of 3 connections (!MCLR, Data and Clock) + ground and Vcc (V+). Typically, that is 5 (some chips require 6, but yours does not). They need to be short (i.e., 12" or less). I just use ribbon cable and 0.1" pitch headers or female sockets to match my programmer. If you use a ZIF socket for the chip alone (i.e., not attached to the board), then use the ribbon cable to that connecter. The chip/board is called "target." You need to go to settings>power and decide whether to power the target by the programmer or independently. I suspect you will choose the former. If the latter, then the board/chip need their own power, but the 5 connections mentioned still need to be made to the programmer or it won't detect the chip/board. You also need to select the voltage. In your case, that is 5V. The programmer connections go to the pins with the same labels. With that chip, they are pins 1 (VCC),4 (MCLR), 6 (clock),7(data) , and 8 (GND). Check the datasheet.PK2 pr 3 have a female socket for those 5 connections. The actual socket has 6 connections. You do not use #6. That is the 5 pins on the left (looking at the top with the socket to your left) are !MCLR (VPP), VCC, GND, DAT, and CLK left to right or top to bottom depending on how you hold it. The 6th is "AUX". It is not used for that chip.

author: Jim0000
author_rank: Contributor
timestamp: March 08, 2023, 11:42:56 pm
content: QuoteI am grateful that you did that for me, as I could not get the NZ URL link with the programming code to open.You obviously could, or you had another source? Or you found another repository/library?Jim.

author: jpanhalt
author_rank: Super Contributor
timestamp: March 09, 2023, 12:26:48 am
content: I just used the link you provided. It gave 2 ZIP files. One was the schematic, and the other was the Intel hex file. I copied and pasted the hex file into my disassembler. No magic involved in going from a hex file to Assembly language. The two extraneous lines were obvious once the disassembler gave the error. All that is needed to know is how the hex file is coded from the machine instructions. Of course, you lose the comments and labels, so to clean up that disassembly would take a little work, but not much. I have had very little experience doing that, The most significant issue one runs into with PICs and disassembly is the bank changes.

author: Jim0000
author_rank: Contributor
timestamp: March 09, 2023, 04:34:58 am
content: JP,Thanks for prevailing on this with me. I fear I may have to ask a great many basic beginners "stupid" questions before I can proceed.If this proves too much; I will not blame you for no longer replying.Quote from: jpanhalt on March 08, 2023, 11:39:16 pmI don't know yet; that is one of the questions I need someone to clarify for me.QuotePlease elaborate on this, as I don't even know what this "ribbon cable" connect to and from. It is to connect the board to the computer? Via a USB port? Or is it something else?Edit:I now realise (or suspect) this connects to the computer via a USB port. Will this cable serve the task, or part of required hardware?https://www.ebay.com/itm/153501803710?Also, I have one of these already:https://www.ebay.com/itm/180953299346But don't know if it can be used for this purpose.QuoteWhere are these found? In the computer programming editor?Jim.

author: jpanhalt
author_rank: Super Contributor
timestamp: March 09, 2023, 10:05:04 am
content: Attached is a snippet of a generic/copy of a PK3. The left cabe is just a standard USB cable. One end for your computer and the miniature (not micro) connector to the PK3. Center is a PK3. The front shows a female connector. Right is a ribbon cable with connectors on each end. The male end goes to the PK3, female end (usually) to a male header on the PCB with the chip you want to program. As mentioned, those cables need to be short. For my current programmer (ICD3) the ribbon is about 10". With my PicStart II Plus, they had to be even shorter. One obvious solution is simply to plug the PK3 directly into the board being programmed. Many people do that, so no ribbon cable is needed.I suggest getting your feet wet with a breadboard and chip. Then design and make/buy the PCB for your locator.* For something like that, I would solder the MCU to the board. "ICSP" is specifically designed for programming chips "in circuit." That is, already assembled in the final device, which is quite convenient for hobbyists.You need to install the programmer software you will be using. I still use MPLab 8.92. That may still be available in the Microchip site in some archive. Otherwise, at Microchip, your will be limited to MPLab X (or whatever it is called today). I cannot help you with that device. There are also non-microchip programmer tool suites. Again, I have no experience with any of them.Attached is a screenshot of MPLab 8.92 running on a Win7 machine. It operates like any other Windows program with dropdowns, etc. I've selected Programmer. The control I mentioned about power is located under Settings>Power.There is quite a learning curve for your first chip. I you do not plan to do more in the area of embedded controllers, I suggest another option. In the US, I would find a local RC model club. Most are licensed and can be found by contacting our national modeler's group ("AMA"). I suspect any club will have members like myself who would be delighted to to that programming for you.In recent years, model aircraft have been turned into potent weapons called "drones" by governments around the world. I dislike categorizing virtually any remotely controlled aircraft or airship as a drone, but that's the way it is. In brief, in the US and probably Australia, you will need to join a hobbyist's club and fly only in restricted areas to avoid a run-in with authorities. It is better to do that sooner than later. Models will soon be required to provide "remote ID." That's like a transponder used in full-scale aircraft, and it is increasingly likely that something akin to a flight plan will need to be filed. In other words, there will be more restrictions on model aircraft toys than there are on full-scale aircraft. For example, my models now have FAA registration numbers, and I must have a license to fly them that must be updated periodically. My license to fly full-scale aircraft is perpetual.In brief: Join a local modeler's club.*Remote ID will likely obliviate the need for a locator. Even if you don't know where your aircraft crashed, the government will.

author: mariush
author_rank: Super Contributor
timestamp: March 09, 2023, 10:46:32 am
content: The manuals and user guides for Microchip programmers are freely available on their website.For example, here's the user guide for Pickit 3:http://ww1.microchip.com/downloads/en/devicedoc/52116a.pdfPage 15 describes the 6 pin connector (but you only need the first 5 really so a 5 pin cable would also work)Page 22 shows how to connect the programmer to your chip. for example useful to know you also need a 4.7k - 10k resistor between Vpp/MCLR and Vdd (voltage) to program a chip.I would also recommend upgrading to a microcontroller that uses Flash memory, look for pic microcontrollers with 12F instead of 12C in name.MPLAB-X is the current IDE for PIC devices from Microchip and supports various programmers, but it's probably most "optimized" for newer programmers.The documentation contains a list of supported devices and which programmers can be used to program those devices, the pdf is here :https://packs.download.microchip.com/DeviceDoc/Device_Support.pdfYou'll find lots of PicKit3 programmers on eBay, but not all will be genuine (they should work just fine though), for around $30.If you want genuine programmer, the microchip Snap would probably be cheapest at around 40$ :https://www.microchip.com/en-us/development-tool/PG164100The downside is that it can only program chips that don't need high voltage for programming, so those 12C , 16C etc can't be programmed, and even some 12F and 16F chips can't be programmed.Newer generations made on newer processes can be programmed easily.You have to look at the list of supported devices above and see what 12F chips are supported. If you pick a more modern 12F chip, you'd have to check the datasheet to see if the assembly instructions are the same)

author: jpanhalt
author_rank: Super Contributor
timestamp: March 09, 2023, 11:06:26 am
content: Of course for that chip, only 5 pins are needed. I still use a 6-pin connector on the programmer (i.e., default cable), and when space allows, on the target as well as the 6th pin acts as a key. With only 5 on the target, if you happen to shift left, GND and VCC will be shorted. I add a plug to the 6th ("PGM/Aux") hole on the female connector. Then the male connector on my board lacks pin6. It's a trivial change, but it adds a little protection.

author: NorthGuy
author_rank: Super Contributor
timestamp: March 09, 2023, 07:27:03 pm
content: Quote from: mariush on March 09, 2023, 10:46:32 amSnap won't work on PIC12F508. It's HVP only.If you don't want to buy programmers, may be you can find someone local who will program the chip for you.If the HEX file doesn't work, nothing you can do (aside of learning how to write firmware for PICs or hiring someone).

author: westfw
author_rank: Super Contributor
timestamp: March 09, 2023, 09:15:47 pm
content: I suppose that SOMEONE should point out that the PIC12C508 is a very old "legacy" chip, and unless you found 100 of them for cheap on eBay, there is no reason you should use them in a modern project. The flash version (PIC12F508) is only slightly less obsolete (and still requires a specialized programmer, as you're finding.)There are newer 8pin PIC chips that I believe have low-voltage ISP programming, but at OP's apparent skill level, they would probably be better off with one of the tiny Arduino-programmable boards (like), and the Arduino environment. These will plug directly into the USB port of most modern computers, not require additional hardware, and I daresay provide a learning experience beyond what one would get by burning a found .hex file into an ancient chip (even if they use found source code for the Arduino, it'd be more useful just to look at than some PIC assembly code.)I'm a fan of minimalism, in general, but... not unless minimalism is actually your goal. Shucks, these days you could throw in a tiny ARM board and write your lost model alarm code in Python.

author: jpanhalt
author_rank: Super Contributor
timestamp: March 09, 2023, 09:21:02 pm
content: Quote from: westfw on March 09, 2023, 09:15:47 pmBeen there done that. That program will work with a 12%508/509. That has been pointed out. PK3 and ICD3 work fine with the 12F508, which I do not consider "specialized."

author: Jim0000
author_rank: Contributor
timestamp: March 10, 2023, 08:05:39 am
content: Quote from: jpanhalt on March 09, 2023, 10:05:04 amOk, thanks.QuoteYes, that has been my approach with the arduino projects I have constructed. If I proceed with this, I will certainly do that.QuoteI am totally accustomed to steep learning curves, it has become almost a way of life for me. However, I am still not sure I will proceed because of this and also the cost factor. It was first mentioned to me as a low cost project. I don't mind spending money on electronic gear that I will use, but another piece of gear sitting in the shed cupboard that I might never use again is a bit of a put off.QuoteThis suggestion gave me a bit of a smile. (No offence meant!). The reason is that I am associated with two local aeromodelling groups as well as the international slope flying fraternity that meets each year at Manilla NSW Australia. I would find it difficult, if not impossible, to find an individual among them that could, or would, talk even basic electronic theory, let alone programming.Many of my fellow flyers are almost technophobes!Edit:Correction: I have just thought of one fellow flier who almost certainly could do this for me!I'll follow that up!QuoteTrue!I am in Australia, however, we will most surely follow suit.Quote from: mariush on March 09, 2023, 10:46:32 amMany thanks. I have downloaded the manual and will read it.Quote from: westfw on March 09, 2023, 09:15:47 pmThat is a good suggestion!As I say above, I have constructed a number of arduino projects (using nano boards).Two advantages; suits my level of skill and experience. And, no extra programming boards required etc.However:That is only an audio buzzer device, which is better than nothing. However, I had my mind set on a RF beacon type.Perhaps the buzzer drive from the little board could be utilised to turn on a 433Mhz tx. ? (which I assume would also require a tone generator somewhere in the circuit.)I don't necessarily need morse code transmission as in the fancy one linked to in my opening post, just simple beeps, 1 or 2 per second will be quite sufficient.All that not withstanding, you have pointed me in a more achievable direction.Thanks.Jim.

author: Chat GPT
author_rank: Contributor
timestamp: March 10, 2023, 10:27:02 am
content: To choose a suitable PIC chip programmer, you'll need to identify the exact PIC microcontroller you'll be using for your lost model aircraft buzzer alarm. Once you know the specific PIC model, you can search for a programmer that supports that model.As for tutorials, Microchip, the manufacturer of PIC microcontrollers, offers many resources on their website, including beginner tutorials and application notes. Here's a link to their Getting Started with PIC Microcontrollers tutorial:https://www.microchip.com/en-us/learning/getting-started-with-pic-microcontrollersAdditionally, there are many online tutorials and guides available, such as the tutorials on the website you linked to for the lost model aircraft buzzer alarm. You can also find helpful resources on forums such as the Microchip Community forum or the Electronics Stack Exchange.

author: Jim0000
author_rank: Contributor
timestamp: March 10, 2023, 10:31:01 am
content: Following up the arduino alternative suggestion, I found this similar 433Mhz RF beacon based on an arduino pro-mini.This is much more within my "comfort zone", so to speak. Also, I have all the components in my stock ready to go.Accordingly, I will shelve the original PIC based option for now and see how this simpler one turns out.I will mark the thread as solved, but will check in each day for any follow up replies. At least, for a few days.Thanks again for all contributions.