PIC programming - where to start and which programmer to get - Page 1
Forum section: electronics / general

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 13, 2025, 04:40:23 pm
content: I am at a juncture where I need to create a device controlled over a serial port but optically isolated and powered from a radio keypad connector. I am very familiar with Arduino, but even at 50mA, the Micro draws more current than I would like the device to draw. The original device I am trying to emulate draws 16ma. The internals have some leeway, but I don't want to push them too much.So one option suggested to me waz to use a PIC, because they have much lower power usage. So I did some reading and read this thread:https://www.eevblog.com/forum/microcontrollers/im-a-beginner-pic-programmer-whats-the-best-programmerdebugger-to-use/So I meet the familiar with Arduino first requirement, so now which devices to play with. I do have a TL866II programer like the opin that thread and with lots of adapters for various types of chips. But it wasn't clear whether this would work with MPLAB software or not.I also work on Linux, so read this thread as well:https://www.eevblog.com/forum/microcontrollers/pic-programming-how-should-i-start/Sadly it descended into a bit of a Windows vs Linux debate, which I am not interested in. MPLAB X IDE runs on Linux so discussion over. So the other suggestion was to buy a Pickit3 or Pickit4 Programmer. I did eventually find a Pickit4 but at 190GBP that's quite expensive, when the Pickit3 is around 30GBP. Amazon also has Waveshare Pickit5 at slighty less than the Pickt4 costing 160GBP.So the first question - will my TL866II work with MPLAB X IDE, or do I need to by a Pickit?Second question - does Pickit3 actually still work with MPLAB X IDE. The first thread suggests that it no longer does?Third question - what to expect from PIC programming. I gather one can use a C language - does MPLAB X IDE support this? Does it have "libraries" or does one have to manually program UART control etc etc. The output is just pulsing a GPIO but do PIC chips have timers to do that? I get the impression one works more directly with the hardware rather than at application level?I guess the only way is to try and see, but I don't want to spend 100GBP's doing that. From those two threads I have some of the information I need. I hope the answers to the above questions will fill in the rest.

author: chilternview
author_rank: Frequent Contributor
timestamp: August 13, 2025, 04:56:04 pm
content: I use a PicKit 4 with a Macbook Pro, it just works for me. I've never tried using a TL866 to burn PICs even though I have one, it's just easier when you've got MPLab set up to program from there. If you watch and wait on eBay you should be able to get a PicKit at a reasonable price.The advantage as I see it of using the PicKit is hardware debug. Set breakpoints in your PIC code and single step thru functions. Easy.MPLab supports C, you need to download the appropriate compiler when you install MPLab. The free one is fine. The C runtime library is not perfect (where's vsprintf, Microchip???) but it mostly works. Assembler is not for me, did that 50 years ago, not going there again.As for libraries, well for example most of the UART functionality is in hardware, it's just a case of handling interrupts e.g. when a character is read and setting the baud rate etc. Not difficult really although there are plenty of quirks in the PIC world that will catch you out first time around and the documentation doesn't really give good examples of what's important to know (like setting up all the ports before using them).

author: tooki
author_rank: Super Contributor
timestamp: August 13, 2025, 05:34:21 pm
content: Quote from: WaveyDipole on August 13, 2025, 04:40:23 pmWhat the hell is up with those prices you found? On Digikey, a Pickit 5 costs £56+VAT. It's currently out of stock, but they're expecting stock tomorrow. That is well above their free shipping threshold.Microchip itself has over 700 pieces in stock right now, at £55.47, presumably plus VAT. No idea what their shipping costs are. (To Switzerland, it's about $11, shipping from the UK. So I can't imagine UK shipping is expensive.)Waveshare is simply taking a stock Pickit 5 and bundling it with adapters, cables, and a micro-SD card. Is that really worth an extra £100? I very much doubt it.

author: voltsandjolts
author_rank: Unknown
timestamp: August 13, 2025, 05:44:26 pm
content: Quote from: WaveyDipole on August 13, 2025, 04:40:23 pmI'm not familiar with arduino but I'm sure AVRs can be configured to take much less than 50mA!!

author: tooki
author_rank: Super Contributor
timestamp: August 13, 2025, 06:02:15 pm
content: Quote from: WaveyDipole on August 13, 2025, 04:40:23 pmHave you actually done anything to minimize the current draw of the Micro? The ATmega32U4's maximum current draw, excluding whatever you power from GPIOs, is specified at 27mA. The blue power LED on the board draws 2.5mA by itself. You can reduce current dramatically by running it at 4 or 8MHz instead of 16MHz, and a bit further if you run it at 3.3V instead of 5V.See also:https://docs.arduino.cc/learn/electronics/low-power

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 13, 2025, 08:23:10 pm
content: Quote from: tooki on August 13, 2025, 05:34:21 pmI don't know. Its just what I found with a random search. I have no problem paying the £55.47 but I suspect it will have VAT of 20% added plus a postage charge, probably at least 5GBP so I expect the overall cost will be somewhere around £70 or more. That's before one considers import taxes and tariffs on goods from the USA. Unfortunately it looks like I need to create an account and give away a significant amount of personal detail just to get the full cost details which is annoying. I don't generally deal with companies that cannot be upfront about things like tax and shipping costs. I have contacted them for this additional information and will sleep on it as they say. Its might still work out much cheaper than the 160GBP being asked by Waveshare on Amazon so thank you for pointing them out. The sad things is some people may end up paying the Waveshare price without realizing.I did a bit more digging on the TL866II and it seems that it might not be compatible with MPLAN X IDE. It seems Microchip only support their own devices, so if I go with Microchip, then I will need to buy the Pickit.I don't know anything about any other brands of PIC chips so if anyone could fill me in it would be appreciated. Are there ny competitors that are worth considering?Quote from: tooki on August 13, 2025, 06:02:15 pmI must admit that I haven't and am only looking at ball park figures. Yes LEDs could certainly be removed. I am also only needing to drive one GPIO pin. That's all it needs. Haven't tried driving at lower frequencies yet but the project does deal with sub-millisecond time intervals. So long as that is still possible with reasonable accuracy then I see no problem reducing the clock speed and adjusting the code execution timing.BTW, is there much difference between the Pickit 3 and the 3.5? Is the 3.5 actually genuine?

author: westfw
author_rank: Super Contributor
timestamp: August 13, 2025, 09:45:03 pm
content: QuoteAn Arduino draws 50mA because nothing on theboardmakes any effort toward being low-power. It's got a power-hungry regulator, a power-hungry op-amp, a power-hungry USB/Serial converter, and a bunch of power-hungry LEDs. ("power-hungry" might be a bit of an exaggeration, but they're certainly NOT "optimized for low power.") The ATmega328p itself (which can still be programmed with Arduino) should consume less than 10mA at 16MHz and 5V (and less than that at lower speeds/voltages. Even before you make any attempts to lower "average" power consumption with the low-power modes.)The AVRs and PICs have quite similar "real" power consumption, and IMNSHO switching from an architecture that you're "very familiar" with chasing lower power would be a mistake.Note that many of the "super low power" quotes in datasheets refer to optimal use of the "sleep" modes, which affect average rather than instantaneous consumption, and might not be applicable to your usage.TI's MSP430 series has a reputation of being very low power, and are still programmable in an Arduino environment ("Energia") (But again, some of that is superior sleep modes.)

author: Adrian_Taylor333
author_rank: Regular Contributor
timestamp: August 14, 2025, 12:12:27 am
content: Best option would be a Pickit5.It's about to have much longer support lifetime in it.Other than obsolescence and Bluetooth support, there is not that much difference between Pickit4 and Pickit5.Well, maybe also virtual serial ports to the target, not sure about that one.It supports PIC ( 8-bitters, dsPIC and MIPS-based 32-bit models) ,AVR and ARM, both in low-voltage and HV programming modes.Much cheaper option is "MPLAB Snap", but check the device support for actual devices that interest you.https://www.microchip.com/en-us/development-tool/PG164100

author: shabaz
author_rank: Frequent Contributor
timestamp: August 14, 2025, 12:22:12 am
content: I don't know what your use-case is, but if your aim is to only activate your circuitry when the serial port is connected, and if that serial port happens to be a USB-UART, then even if you're optically isolating somewhere, you could theoretically use power from the USB port, so that you might not need to steal any power from the radio keypad port.The way to do that would be to use an isolated DC-DC converter module, price can be sub-$10. Which is obviously more expensive than a low-power microcontroller, so it's not a solution for a commercial product, but does mean you can continue to use whatever microcontroller you're already comfortable with (and the fact that there's a ton of resources on Arduino can be very helpful for newcomers, versus trying a significantly different IDE).A Pi Pico can work directly with the Arduino IDE too, so again it's almost-identical to working with the Uno, and draws quite a bit less current (but still more than the 16 mA you mention). A Pi Pico will use about 28 mA on average, when running typical code (at least, that's what I've seen with a multimeter; not investigated further). So just moving to a Pi Pico alone would save a fair amount of power compared to the 50 mA you mention.MSP430 that@westfwmentions is a great idea since the Energia environment will look very familiar if you're coming from Arduino IDE.

author: brucehoult
author_rank: Super Contributor
timestamp: August 14, 2025, 01:10:44 am
content: Quote from: WaveyDipole on August 13, 2025, 04:40:23 pmJust say NO. If you don't have a pre-existing reason to use PIC then don't start now. Ugh.What level of PERFORMANCE do you need?An ATTiny85 chip needs no external components -- I've used them without even a board, just solder on GND and Vcc and wires on whatever GPIO pins you want. By default it just starts up and runs at 1 MHz, using 0.3mA with a 2V+ power supply. Or you can run it at 4 MHz on a (min) 3V supply at 1.5mA, or 8 MHz on a 5V supply using 5mA.Those numbers are all way below the 16mA you want to beat. You don't even need any sleep mode tricks.You can program it using the normal Arduino IDE and libraries, using an Uno (or Mega or whatever) as the physical programmer, using the supplied ArduinoISP sketch.https://www.instructables.com/How-to-Program-a-ATtiny-With-Arduino/https://mou.sr/45QeVF6Forget about PIC.

author: brucehoult
author_rank: Super Contributor
timestamp: August 14, 2025, 01:25:21 am
content: The CH32V003 is also a good modern option. It costs $0.10 in an 8 pin package or $0.20 in a 20 pin package (18 GPIOs). It's a 32 bit CPU and uses 8mA at 48MHz with all peripherals enabled, or 0.4mA at 750kHz. Standby mode (clock stopped but GPIO changes wake it up) uses 11µA. You can use it with Arduino IDE and libraries, or bare metal. You can buy complete premade boards for around $1.50.https://www.aliexpress.com/item/1005005221751705.htmlI just plugged one of mine into a USB power measuring device and it showed 0.01A. Unfortunately that's the limit of its resolution.

author: westfw
author_rank: Super Contributor
timestamp: August 14, 2025, 03:01:37 am
content: QuoteSNAP is a bit deprecated. The most recent low-end ($30) programmer is the "Microchip PICKit Basic"https://www.microchip.com/en-us/development-tool/pg164110OTOH, it looks like the remaining SNAPs are being sold for only $11 !The PICKit BASIC seems to be re-packaged SNAP, perhaps with some bug fixes, and the $30 kit includes some cables, adapters, and pretty case, whereas the SNAP was just a bare PCB... Both will program and debug pretty much all of Microchip's Microcontrollers, including a range of PICs, AVRs, and ARM... (Hmm. Neither does "high voltage programming", though.)Comparison page:https://www.microchip.com/en-us/tools-resources/debug/programmers-debuggers

author: mariush
author_rank: Super Contributor
timestamp: August 14, 2025, 03:56:26 am
content: The SNAP is $11 :https://www.digikey.com/short/7wfv04w9At that price... just get one.The Basic is $30 :https://www.digikey.com/en/products/detail/microchip-technology/PG164110/25965142The supported devices for each programmer is here :https://packs.download.microchip.com/DeviceDoc/Device_Support.pdf

author: Adrian_Taylor333
author_rank: Regular Contributor
timestamp: August 14, 2025, 04:40:57 am
content: @mariush:SOmeone asked about the functional difference between Snap and basic on Microchips forums.No one could find a meaningful difference outside Basic version having colorful plastic enclosure.

author: westfw
author_rank: Super Contributor
timestamp: August 14, 2025, 06:06:22 am
content: QuoteDoes BASIC have a hardware fix for UPDI devices (https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/MISC/ETN36_MPLAB+Snap+AVR+Interface+Modification.pdf)

author: voltsandjolts
author_rank: Unknown
timestamp: August 14, 2025, 08:18:17 am
content: Quote from: westfw on August 13, 2025, 09:45:03 pm^ This.

author: mariush
author_rank: Super Contributor
timestamp: August 14, 2025, 09:59:15 am
content: There's some PIC16LF microcontrollers that work down to 1.8v, so that may be a benefit.As for the UPDI fix, it looks like one could easily take off the resistor, solder a couple thin wires to the pads and a small 2 pin jumper or a slide switch you could place near the 8 pin header (jumper installs means the resistor will be placed in circuit, from that line to ground)

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 14, 2025, 10:30:33 am
content: Thank you. Some good points being made here. Some quick bullet point observations:I also came to the conclusion that if I got a Pickit, then I would probably choose the Pickit 5 for support longevityThere is no pre-existing reason to use a PIC, it just that it was suggested on account of lower power consumption. I already have a working prototype that uses an Arduino Micro.Level of performance required is not very high at all. It just needs to send pulses with sub-millisecond intervals.Activation on serial connect is not necessary, but might be useful to consider.Haven't considered an ATtiny85 as I have never used them. Thank you for the suggestion. Sounds like it could suffice but I would need to add a UART. I expect that the TL866II or one of those FTDI boards could be used to program it?Not come across the CH32V003 before. Will look into that option.Objective is PC control of a receiver, so the project could be powered from the PC USB port. The current prototype does exactly that.I considered wireless options, e.g. ESP, but the power draw would be excessiveand would probably require a separate external power source."The AVRs and PICs have quite similar "real" power consumption" - interesting to note. I was given to understand that PICs draw much less, but there is a large variety of PIC chips to choose from as there is for Arduino programmable MCUs. Already on here I have been given examples of Arduino alternatives that can do better than the Micro board."Note that many of the "super low power" quotes in datasheets refer to optimal use of the "sleep" modes" - exactly and to drive GPIOs you have to wake up.I spoke with Microchip via chat this morning and am very disappointed. I guess its because they are a manufacturer and ship in volume, but they wouldn't provide any information unless I created an account with them and placed a firm order. They wouldn't even tell me whether the order would ship from the UK or the US. That would make a BIG difference. However, I did manage to get a page of US shipping information.https://www.microchipdirect.com/shipping-infoLooks like it would cost GBP28 (I am assuming that the package will weigh more then 500g) to ship from the states. When it arrives in the UK, I may or may not get hit with further import fees - depends what mood the customs official is in and which way the wind is blowing. If its shipped from the UK it might cost a lot less to ship, but will still carry 20% VAT.I would seriously consider a competitor if I knew whether there were any and who they might be?The PIC and PICkit seems to be the most popular offering though?Quote from: westfw on August 13, 2025, 09:45:03 pmThat's a good point. I think, taking into account this and all the other comments, if I were to purchase the Pickit5, it would be because I want to learn PIC programming long-term rather than being about just this one-off project. In any case, from my experience with Microchip so far, it seems that I might as well wait until the Pickit5 is available from other outlets like Farnell CPC, Rapid, Mouser, DigiKey etc that are better able to cater to the ordinary consumer and are usually upfront about additional costs.I would consider a PICkit3 (or PICkit3.5 if these are geniune - note it says "Kit 3.5" not "PICkit 3.5") to dip toes in water so to speak if:a) I could tell what is genuine and what isn't. Looks like the majority on Amazon and eBay are probably cloned fakes?b) I could be sure it (genuine article or clone - in the unfortunate event that I ended up with one) would work with the current MPLAB X IDE.Since both seem to be in doubt, it seems the better choice again would be to wait for the PICkit5 to become available through a reputable outlet.

author: brucehoult
author_rank: Super Contributor
timestamp: August 14, 2025, 10:53:31 am
content: Quote from: WaveyDipole on August 14, 2025, 10:30:33 amAs I mentioned before (and gave a link to instructions) you can use the standard ArduinoISP sketch, supplied with the IDE, to program an ATTiny85 using another Arduino (it doesn't matter whether it's an AVR one or not). You don't need any special programmer unless you brick it really badly.As for UART, see:https://hackaday.com/2019/03/13/attiny-gets-a-tiny-software-uart/Read the comments too.The main issue is whether 6 GPIOs are enough for you. The ATTiny85 does come in a 20 pin package too, but there are a lot of NC pins.The ATTiny85 was my go-to small cheap MCU from around 2018 until I started using the CH32V003 (10x cheaper, much faster, somewhere between an ATMega168 and ATMega328 in RAM/flash, comes in 8, 16, 20 pin packages with up to 18 GPIOs) instead in 2023.

author: chilternview
author_rank: Frequent Contributor
timestamp: August 14, 2025, 11:06:24 am
content: Quote from: WaveyDipole on August 14, 2025, 10:30:33 amYou really want to buy from DigiKey or Mouser, don't bother talking to Microchip they will not be interested. The US distributors like Digikey have free shipping over £33 or thereabouts and make it just as easy as ordering from RS in the UK (and usually quite a bit cheaper); delivery is typically 2-3 days. So for a picKit5 from Digikey you are looking at about £67 including VAT (which they charge, so you don't need to worry about any import charges this end).

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 14, 2025, 11:43:57 am
content: Quote from: brucehoult on August 14, 2025, 10:53:31 amFair enough and thank you. I have spare Arduinos to configure one as an ISP programmer as well as those FTDI boards. Sounds like either will do.Quote from: WaveyDipole on August 14, 2025, 10:30:33 amInteresting read, especially the comments. I see that there is a bit of a low level vs Arduino programming debate going on there as well... I am curious enough to buy a handful (ATTiny85 or CH32V003) to dig in and start learning though.Quote from: WaveyDipole on August 14, 2025, 10:30:33 amOne or two will suffice so the smaller packages will be fine.

author: mariush
author_rank: Super Contributor
timestamp: August 14, 2025, 01:23:35 pm
content: Quote from: chilternview on August 14, 2025, 11:06:24 amTME.eu may be an option if only for the cheaper shipping - they ship from Poland, probably still gonna have to deal with customs but otherwise...They say they will have Microchip SNAP in stock from the 1st of October (week 36/2025) for 9 GBP :https://www.tme.eu/gb/details/mplab-snap/programmers/microchip-technology/pg164100/And pickit5 is supposedly gonna be available in stock next week at 59 GBP plus shipping :https://www.tme.eu/gb/details/pickit-5-icd/programmers/microchip-technology/pg164150/

author: David Hess
author_rank: Super Contributor
timestamp: August 14, 2025, 03:50:55 pm
content: I learned and used PIC in the past, but suggest AVR will be better if you are starting from scratch. Power requirements are comparable, but AVR has much better C support, and maybe lower cost development.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 14, 2025, 06:15:28 pm
content: Quote from: mariush on August 14, 2025, 01:23:35 pmI have purchased from TME some time in the past and had good service. Didn't think about them actually, but thank you for the reminder. Its a possible option.Quote from: David Hess on August 14, 2025, 03:50:55 pmDavid, thank you. I have been using programming Arduinos for quite some time now so am not quite 'starting from scratch'. I have done some writing to registers, working with expander chips and using interrupts so have some familiarity with writing directly to hardware and emulating hardware protocols. I think PICs might be the next step in terms of learning and development, although I have now separated that goal from this specific project.I did notice the mention of SNAP earlier and these can be had for quite a low price. I have seen a video showing one connected with DuPont wires to a small breadboard for programming so this might be a cheap way to get started and acquainted with the technology and software before deciding to spend much more on tooling. I think someone noted that it may support a smaller range of chips and that does indeed seem to be the case - a much smaller range. For 10GPB (or thereabouts) plus postage it seem quite tempting.

author: David Hess
author_rank: Super Contributor
timestamp: August 14, 2025, 08:48:25 pm
content: Quote from: WaveyDipole on August 14, 2025, 06:15:28 pmIf you are already familiar with Arduinos, then AVR is a much better choice than PIC. PIC is not going to teach you anything that AVR cannot, except dealing with archaic architectures.The only reason I might use PIC now is for a peripheral not available in AVR, and even then I would consider implementing the required peripheral externally.

author: Howardlong
author_rank: Super Contributor
timestamp: August 14, 2025, 10:40:23 pm
content: I use PICs for 95% of my day job, and as a result I have practice in everything PIC from PIC10F to PIC64. I keep example devices in stock for pretty much every device family released over the past 15 years, and most have dev boards where available. I also have _every_ debugger they've released in the past 25 years.FWIW, my Microchip journey goes back to the General Instrument days of the 70s: Microchip was spawned from the GI Microelectronics division in 1987. Yes, I'm that crusty.As for a programmer/debugger, I'd say PICkit 5 is the one to go for, not least because it:o Programs high voltage Vpp devices;o Has an integrated UART-serial bridge;o Can power devices for tinkering about;o Will program every MCU in Microchip's line-upo Will debug every MCO with on-chip debugging (almost every chip over the past 15 years).Neither the Snap nor the PICkit Basic have a high voltage programming mode, which excludes some old chips, and also imposes limitations on newer chips sharing a GPIO with the reset (MCLR) pin, not big deal unless you're desperately short of pins.PICkit 3 would be a mistake nowadays. The latest IDE has dropped support for Gen 3 programmers and debuggers, and support for new devices stopped some years ago.Gen 4 and Gen 5 programmer/debuggers support all chips, barring the Vpp limitation of Snap and PICkit Basic.o Gen3 includes PICkit 3, ICD 3, RealICE, PICkit-on-board3 (PKoB3 integrated onto older dev boards)o Gen4 includes Snap, PICKit 4, ICD 4, ICE 4, PICkit-on-board4 (PKoB4 integrated onto newer dev boards)o Gen5 includes PICkit Basic, ICD 5.Another approach, if you're only interested in the 8 bitters PIC12 thru PIC18 released in the past 15 years or so is the Curiosity LPC board DM164137 for 8 to 20 pin devices. This has a DIP socket and PKoB4 programmer/debugger with a handful of LEDs and buttons.For 28 and 40 pin DIP PIC16 & PIC18 devices, there's the Curiosity HPC board DM164136. Again it includes the PKoB4 programmer/debugger, and a few LEDs and buttons.Both boards include a UART to Serial bridge integrated into the programmer/debugger. You can program your device on the board, then put it into your own circuit. You can also wire up the debug pins into your own circuit, and debug your target in its target environment.Almost all PIC10 through PIC18, even newly released ones, are available in DIP. Only the higher pin count devices (over 40 pins) aren't.For PIC24, dsPIC, and PIC32 generally need purpose built dev boards or your own design with an external programmer/debugger. For a while about ten years ago, there was the Microstick I and II that supported numerous 28 pin PIC24, dsPIC33 and PIC32 in DIP packages. There are also several 16 bits & 32 bit PIC32M available on PIMs (plug-in modules) that plug into the Explorer 16/32 board.Unfortunately, no new PIC24, dsPIC or PIC32 have been released in DIP for some years, although those that are are not EOL.One of the best things about Microchip is that as a general rule of thumb they don't EOL anything. Very occasionally a device will EOL, but that is due to things like them using an esoteric package that they can't make anymore.However, one of the worst things about the Microchip ecosystem are the MPLAB X IDE and MCC frameworks, and it's become worse in the last year or so. My suspicion is that's because anyone who knew anything has been shipped off to work on the new VSCode implementation.Unfortunately the VSCode implementation is even more bleeding edge than MPLAB X.Something to note about the all 8 bit PIC cores is that their cycle time is 1/4 the clock speed.The 16 bits PIC cores' cycle time is 1/2 clock speed.All 32 bitters are 1:1 cycle time and clock speed.Whether it's an archaic architecture or not isn't necessarily relevant. The first functioning ARMs out of the foundry came out over 40 years ago now, yet the basic underlying architecture pervades to this day, with some tweaks.The same applies to the 8 bit PICs, with only 9 years ahead of ARM. I'm pretty sure we don't refer to ARM as "archaic". 8 bit PICs have undergone a number of improvements to their core architecture over the years. They're still regularly releasing new devices with new features, including some substantially more complex programmable logic on chip. For PIC16, it's these peripherals that keep it going.PIC18 had a core facelift a few years ago with vectored interrupts and DMA, that was quite a shot in the arm for the product line up (no pun intended), and again they enjoy many of the same peripherals from the PIC16 heritage.If you're programming the 8 bitters in C, the archaic nature of the core, particularly bank switching, won't affect you at all. But if it's assembler you're after, I can't really recommend these 8 bitters as a good introduction.PIC24 and dsPIC30/33F/33E are 16 bit and use a rather pleasing architecture, a million miles away from the 8 bitters and their pesky bank switching. They're definitely not RISC, enjoying tons of addressing modes available to most instructions.PIC32M is the MIPS core, so although it's the best supported PIC32, it's a dead end as far as development goes: MIPS' owners have switched to RISC-V. PIC32C is the ARM processor, and is the new kid on the block in PIC32 terms.Regarding low power, it's all about experience, experimentation, and knowing your way around a datasheet. I did asub-microwatt LCD clockwith a PIC a few years ago, which shows what can be achieved. More recently, that technology found its way into a novelty wrist watch.There are some interesting new developments coming out of Microchip, such as the dsPIC33A and PIC32A series. These are their own 200MHz 32 bit core, and it's not ARM, MIPS or RISC-V. I've been working with these chips intensively recently, and for raw compute in DSP applications they're difficult to beat in terms of efficiency. As well as a 72 bit fixed point DSP core, they include a double precision FPU. What really floated my boat as a game changer in my area of mixed signal work is that they have sin() and cos() in silicon, 4 cycles each, although with instruction interleaving you can get that down to a single cycle.So that's my take. TL;DR PICkit5, or one of the 8-bit Curiosity LPC/HPC dev boards that I mentioned.

author: Adrian_Taylor333
author_rank: Regular Contributor
timestamp: August 15, 2025, 03:38:02 am
content: Quote from: Howardlong on August 14, 2025, 10:40:23 pmDifference between the two is that ARM had a great idea and a vision. THis is why ARMs around the world rock in phones, tablets etc - their basic formula to decruft existing computing has survived and is thriving.PIC OTOH has been misused desing from the start, which then methastasized all over MCU space and liquified into diarrhea that started oozing everywhere.Its initial mission was to act as a extremely dumb but cheap controller, executing small piece of code, while emulating some hardware.Typically executing couple tens of instructions in a tight loop and having the context of maybe couple tens of bytes of data.This is why it was extremely dumb from the start. Originally it didn't have even indexing mode FFS. And certainly no stack.Since you can't make Einstein out of Frankenstein, this shows today big time.PIC16 is totally braindead and should be avoided. For thousand reasons.Quote from: HowardlongPIC18 is PIC16 with a Band-Aid on its forehead. With extra charge for the Band-Aid.Don't touch it with a 10ft pole if you don't have to.Quote from: HowardlongUsing C can't hide its problems:* small controllers need one to be frugal with their resources* PICs are not that compiler friendly* Microchip's whole SDK stack and each component within has its own problems, compilers included* MC compilers are old and lag gcc/clang/etc. Those that are gcc-based, are fork of very old versions* free versions have only VERY basic -O0/1 optimisation level (no-O2/3, no LTO, AFAIK no PGO etc)* non-free versions are priced insanely for what they are* there is a speed tax. Already scarce resource (CPU muscle) gets dilluted further by C, both for covering its own inefficiencies and for plastering over the HW cracks and holes.Outside of 5V world, 8-bit MCUs make little sense. AND PIC line makes no sense even within that niche.Only exceptions that come to mind might be some special models with exact peripheral fit for a particular app. And/or an exceptionally low price.Or maybe long-term availability.For everything else there are far better options.Why would one expect better price for a 8-bit micro, if its core is usually only a small part of the whole chip area ?Most of the chip area is consumed by FLASH etc.Since these things are made on oldest processes, which are more robust (greater distances, gate-oxide thickness, less EMI, thermal and electromigration problems etc etc),5V world makes sense. I suspect that its also easier to have more durable FLASH as a side-effect.Once the performance need get bigger, oldest processes get more costly and bang/$€ equation changes.

author: brucehoult
author_rank: Super Contributor
timestamp: August 15, 2025, 04:06:18 am
content: Quote from: Adrian_Taylor333 on August 15, 2025, 03:38:02 amWith even I think 180nm (and TSMC for example offers 5V toleration down to 28&40 nm, and others to 130nm) 8 bit don't even have a cost advantage because you get pad-limited wth the MCU itself taking only a small portion in the middle of the silicon die with a lot of totally wasted space. You might as well use that space for a 32 bit processor.With 32 bit Cortex-M0 and RISC-V flash MCUs selling for around 10c it's only the 3c 8 bit PIC clone Padauk priced significantly lower, and that's an OTP chip which is ok for volume manufacture but not development. The flash version of the Padauk actually costs more than the PY32F002A and CH32V003/002, and only has 1k instructions and 64 bytes of RAM, vs 6k-10k instructions and 2-4 KB RAM for the 32 bit chips.

author: cv007
author_rank: Frequent Contributor
timestamp: August 15, 2025, 05:58:16 am
content: If you want to try a pic, Microchip makes several pic16F curiosity nano boards. They are inexpensive (~$10), come with a programmer/debugger on board and are a quick way to get started. If you decide to go a different direction, you are out $10. They also have the same type of boards for their newer avr's also, which are a 'better' avr than the original.I would recommend the curiosity eval board (DM164137), but prices now seem insanely high for that (I think they were ~$20 when I bought mine long ago).I doubt you will find big differences in power consumption among the mega328/avr01/pic16F, and it pretty much boils down to voltage and clock speed (for the mcu). For the pic, you have to keep in mind the clock speed is x4 the cpu speed so datasheet power comparisons have to adjust (4MHz avr vs 16MHz pic). The power consumption data in the datasheets will be pretty accurate, provided you understand what mcu state the data apply to. If you have external power consumption, obviously that is a separate matter.You can use MPLABX in Linux, and it will work fine. The C compiler they have (XC8) also works fine, and the 'free' version without every optimization is also fine.An old project for a PIC16F15323 written in C-https://github.com/cv007/3DigitLed/tree/masterThese newer pic's (not so new anymore) are actually pretty nice. Peripheral pin select, nice peripherals, and quite simple to setup/use pretty much anything in the mcu. I have not used them in quite a while and prefer using the gcc toolchain (C++) so the 8bit pic wouldn't be my first choice, but I also would not exclude them if they had something that was a good fit for what is needed.Also an old project for a 10F322 (I think it was an LF), also in C (must be before I decided I dislike defines/macros),-https://github.com/cv007/2button_remote/blob/master/main.c(this has been in use for many years, same cr2032 battery, I think it sleeps at maybe ~100 nA)I think you should first figure out where all your power consumption is originating- mcu, external devices, etc. If you will be gaining nothing with a different mcu, it would probably be nice to know now instead of later.

author: westfw
author_rank: Super Contributor
timestamp: August 15, 2025, 06:02:07 am
content: QuoteAFAIK, there are no more "genuine" PICKit3s being sold. MicrochipDirect doesn't even list the PICKit4 any more. (Microchip is pretty good at continued manufacturing of their chips. Not so much, their development tools.) (My records show I bought my PICKit4 in 2018. That's a pretty long time ago.)The PICKit3 was particularly long-lived and widely cloned because the firmware was downloaded "on demand", and the clones therefore didn't need to pirate the firmware. (And then there was 3rd party firmware to program AVRs and other stuff, back before the Atmel acquisition.)QuoteI don't think "much smaller range" is particularly accurate. SNAP doesn't support the long-obsolete PIC16Cchips, or the slightly newer Flash chips that still required HV programming. And you have to avoid putting the newer chips into modes where they sacrifice a low-voltage programming pin to create another IO. But those aren't very big limitations...I did some adapters for SNAP to ISP/UPDI/SWD, since microchip charges (or used to charge) a small fortune for the various cables that went between their low-cost programmers and the actual chips and/or standard programming connectors:https://oshpark.com/profiles/WestfW

author: Howardlong
author_rank: Super Contributor
timestamp: August 15, 2025, 08:35:52 am
content: Quote from: Adrian_Taylor333 on August 15, 2025, 03:38:02 amWell yes, but you also get more frugal devices when it comes to the power budget. In the real world away from banner specs, practically speaking you will almost never achieve better power consumption with an ARM device in button cell energy level applications.QuoteWhy do you care? It's done for you.QuoteAll of the compilers are pretty good in general. But I agree, the IDE and particularly the frameworks (MCC) are crap, which is why you don't use MCC except for very complex peripherals like USB. Bare metal is almost always the way to go with the 8 and 16 bitters.QuoteIn general I find them pretty good and bug-free (unlike the IDE and MCC frameworks). And I use them every single day. I have discovered three compiler bugs in 20+ years of using Microchip C compilers, I'd say that's pretty good.QuoteThe free versions of all the current XC compilers go up to and including -O2. IME, there's not much difference between -O2 and -O3 in most cases.LTO/PGO: XC8 uses omniscient code generation, all offer procedural abstraction. LTO is offered in XC32. You will need a PRO or eval licence to use them.For at least 90% of the time I work in -O0, not least because it's good enough and I like my debugging to step logically and be able to place breakpoints where I want. As I mentioned, practically speaking, the difference between -O2 and -O3 is marginal, particularly on XC8. I am sure you can find edge cases where -O3 issubstantiallybetter, but I can't think of one particular occasion when it has been. System & regression testing, and release to production? Yes, of course I use -O3, because I can!QuoteI suggest that you revisit. If you want the PRO features, the licensing completely changed about six months ago. I agree though, that the sticker shock on three annual renewals was bad. Now there is a single licence for all three compilers at around the same price as just one of the three compilers previously.Alternatively, you can also use a pay-as-you go monthly subscription.Even more alternatively, there is a hack on this forum to enable the PRO features on the XC-16, XC-DSC and XC32 compilers which still works to this day.BTW, development of XC16 is over, because it's been rebranded to XC-DSC. Gotta love marketing, however the rationale is that this compiler now also supports the 32 bit dsPIC33A series.QuoteThis applies to every C compiler on every architecture.A reminder for you that theclock I mentionedup thread, is written in pure C, with no assembler. It draws 386nA at 1.8V, and that includes keeping the LCD running. I guarantee you will not find an ARM processor that will achieve that.QuoteMicrochip also offer a range of 5V ARM within the PIC32CM range.QuoteMost of these peripherals aren't niche. Offloading work to hardware is a long tried and tested means of reducing the need for CPU resources.The biggest friction to using 32 bit MCUs is the lack of the very peripherals you're discounting as "niche".QuoteYou do realise that even some of the 20+ year old devices have been refactored onto much newer process nodes? There is a downside to this... some old devices that had sleep currents in the picoamp range are now in the 10s of nanoamps.The process nodes used for all devices have moved as time has gone on, not least because there are no foundries with the equipment to make them any more.If you think 8 bit MCUs are going away, PIC or otherwise, you couldn't be more mistaken.Youmight not have an application for them, but there are plenty who do.Of course the world has been increasingly moving to 32 bitters, but the market for 8 bit isn't declining, quite the opposite, and it's increasing at roughly the same rate as that for 32 bitters.We also missed out one thing, low pin count. If you want low pin count, 8 bits is the place to be. Sure, there are low pin count 32 bitters, but the range is as limited as their generic peripherals.I was quite excited by TI's announcement five months ago regarding the "world's smallest MCU", a Cortex M0+ XMSM0C1104 in a 1.62 x 0.88mm BGA package. And what do you know, it was a paper launch, and you still can't buy it. Frustrating, as I'd invested in the tools to evaluate it.As you can tell, I'm open minded about the architectures I use. It's the best tool for the job at hand, and 8 bit, including PIC, is quite often a better fit than shoehorning in 32 bits just because you can.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 15, 2025, 09:05:13 am
content: Quote from: Howardlong on August 14, 2025, 10:40:23 pmThank you for actually confirming that issue of support. I read that this might be the case, but it was not clearly confirmed.Quote from: Howardlong on August 14, 2025, 10:40:23 pmAgreed on that, especially after the comments from @westw as well below. Thank you.Quote from: Howardlong on August 14, 2025, 10:40:23 pmHad a look at the Curiosity boards. I thing I would presef the PICkit5 because it basically it support all types of PIC chip in pne package but thanks for pointing out the options.Quote from: Howardlong on August 14, 2025, 10:40:23 pmI actually saw a comment about that elsewhere where the author mentioned they had stuck with IDE 8 because they couldn't get on with IDE X although he didn't actually give any details. I didn't know there was a vscode plugin, but if that's even worse...Just seen your new post appear....

author: Howardlong
author_rank: Super Contributor
timestamp: August 15, 2025, 09:08:30 am
content: Quote from: cv007 on August 15, 2025, 05:58:16 amI still do recommend it, but yes, what happened to the pricing?!? This is an order from May 2021.QuoteSleep current on the older PIC10F20x series is even lower, in the picoamps.(I don't recommend the PIC10F20x or PIC10F22x by the way, unless you really need those picoamps, there are just too many other compromises).

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 15, 2025, 09:09:10 am
content: Quote from: Adrian_Taylor333 on August 15, 2025, 03:38:02 amOoh! That's quite a stong comment!Quote from: Adrian_Taylor333 on August 15, 2025, 03:38:02 amDid notice from the specs that they generally have only a handful of kb's of flash andf less in terms of peripheral hardware, although some of the newer ones do appear comparable to AVRs.Not quite sure whether that places the ATtiny? It seems closer to but more advanced than the PIC, but if you now look at the Microchip website for an ATtiny, they direct you to an AVR. The new range of ATtiny2 chips are apparently considered part of the AVR "family" which gets a little confusing, although it seems for a small Project like this one, the ATtiny would make sense.Then again, I also see pics used in all sorts of hardware?Quote from: Adrian_Taylor333 on August 15, 2025, 03:38:02 amI did wonder whether to bother with the 8-bit versions. For this particular project and initial learning, an 8-bit with best clock speed and more than minimal memory (7kb+) would probably suffice. However, going forward in the longer term, especially where one needs to interoperate with a 3V3 environment, that's probably a valid point.

author: brucehoult
author_rank: Super Contributor
timestamp: August 15, 2025, 09:27:18 am
content: Quote from: Howardlong on August 15, 2025, 08:35:52 amNo, that's not correct.Part of the design of the RISC architectures appearing from about 1985 on is that they provide everything needed to make compiling high level languages such as C or Pascal as efficient as possible, and they don't provide anything extra to that, that won't be used by C compilers. Most of the time there is really nothing to be gained by going to asm unless you are doing something very specialised that is outside the C execution model. An example of that is multiple entry points to the same function with some of them adjusting the arguments or doing a little work and then falling through past another entry point. Though even that example if less strong with ISAs that pass arguments both arguments and return address in registers and have compilers that know how to do tail calls ... and a peephole optimiser that removes a JMP to the next instruction.In MIPS, any of the Arm ISAs, or RISC-V it is really very hard to beat a modern compiler on code that can be naturally expressed in C.An example where you can still get a small advantage in asm is where you have aswitchstatement with a lot of cases that are mostly about the same amount of code. C will generate an array (jump table) with pointers to the code for each case, or offsets to add to the PC, or jump instructions. In asm you can scale the selector by a size that is large enough to fit the code for most of the cases (let's say 16 or 32 bytes, but it doesn't have to be a power of 2 if you have a fast multiply instruction, or a shift-and-add) and just jump directly into the appropriate code. Cases with less code need to be padded with NOPs (or followed with `.align`), and cases with more code have to end with a JMP to the rest of the code somewhere.Actually, it not that a compilercan'tdo this -- in fact they could do the tedious bookkeeping of keeping track of the code size in each case and optimising the common size better than a human can -- but just that no onehasprogrammed the necessary algorithm into the compiler. And in most cases the 1 or 2 instructions saved is not worth the trouble. Unless that switch, in a loop, isthehot code for the program e.g. in Apple's original M68k emulator on PowerPC, where the vast majority of m68k instructions could be emulated by one PPC instruction  and Gary Davidian built an array of 65536 entries containing two PPC instructions each (the 2nd being a JMP).I should mention CISC. CISC ISAs were designed to maximise programmer productivity, even at the expense of producing larger slower code. DEC knew darned well that the VAX 11/780 was going to be slower than the PDP 11/70, but to them it didn't matter because machines were getting cheap and programmers were getting expensive and overworked, and customers could just buy more machines. It is also very convenient for compilers to take advantage of the CISC features. It simplifies the compiler. But on those CISC machines you could often get faster code by not using the single-instruction convenient things that, actually, did too much, did more than you needed in a particular case, in a too-general way. So a good asm programmer could beat either of a lazy asm programmer or a compiler that used the powerful instructions. or at least set up, and then branch to common code that handled many instructions.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 15, 2025, 09:31:09 am
content: Quote from: cv007 on August 15, 2025, 05:58:16 amYes, I stumbled across a couple of those nano evaluation boards as well. Of course one is limited to just that single onboard PIC chip, but I guess it is a possible "student" learning option.On the other hand the Curiosity board would be a more flexible option and I did find a DM164136board on eBay for GBP30 in a somewhat tatty box, but then discovered that it can e purchased from one of the main resellers for about the same price. The DM164137is rather more expensive as you point out.I just discovered that the PICkit5 is now available in the UK from Mouser. Even though the cost is higher it does have several advantages. I was almost ready to pull the trigger to invest in it with the goal of learning and alternative to AVR hobby project use but....It is unfortunate that some recent comments are calling into question the programming of PICs in the first place which has rather muddled the picture. I am willing to branch out and learn, but its pointless to spend money if the technology no longer makes sense today.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 15, 2025, 09:31:42 am
content: Quote from: westfw on August 15, 2025, 06:02:07 amThat explains a lot.I did wonder why there were no PICkit4 on the shelf anywhere at alk but lots ot PICkit3.Quote from: westfw on August 15, 2025, 06:02:07 amI based that on the compatibility list that I recently downloaded from Microchip, where quite a few chips are shown as not supported on the SNAP comapared to the PICkit4. Then again, PIC is still all new to me so I am learning here from everyones comments which I am grateful for. The first dozen or so PIC chips that I chose from that were avaialble on Farnell were not supported. I then resorted to searching the other way around - looking at the compatibility list and then checking stock at Farnell. None of the PIC18 chips appear to be supported by SNAP, but some of the (I presaume newer) PIC16 ones are. A lot of the lower numbered ones (PIC12 etc are not supported.) There are quite a few in other ranges as well, up and down the list. Haven't looked too deeply into the reasons. What did also become apparent is that although Farnell still had stock of some DIL chips, the ones like PIC16F99999 (i.e. with 5 digits following) were not available in DIL packages, only SOIC and other square types. No surprise I suppose because everything very much SMD now. But yes, my comment probably was a bit inaccurate.

author: Howardlong
author_rank: Super Contributor
timestamp: August 15, 2025, 09:40:33 am
content: Quote from: WaveyDipole on August 15, 2025, 09:05:13 amMPLAB X first...Difficult to know where to start, but it has so many quirks when using it you come to accept them. Once you're in the zone on a single project, it mostly works OK, but if I start changing projects it gets confused, and I often find I have to restart it.Perhaps one of its ongoing biggest issues is its flakiness with the hardware programmer/debuggers, however I've yet to use any IDE that doesn't have problems in this regard. Again, once you're in the zone and everything's working nicely on a single project you can go for hours without a hitch.Microchip have a terrible QA on their updates, and just like everyone else these days there's a CI/CD mantra of releasing frequently, foregoing full regression testing, and to hell with the end users. Thankfully there are ways to sandbox your MPLAB X versions, and have multiple versions with different updates coexisting (look for the "-userdir" option).MCC, a collection of frameworks that they promote, is a whole other can of worms, and again, it's difficult to know where to start.While configuring the chip and its peripherals with a GUI has its attractions, you still have to understand your chip at a datasheet and errata level if you intend to do anything more than a blinky.It suffers from the same squidgy balloon effect: they fix one thing, then break something else.For almost all of my 8 and 16 bit work I use bare metal, and use MCC for two things:1. Generate code for programmable logic peripherals, then I paste the generated into my bare metal project;2. USB: there's not really any practical alternative.For PIC32 work, particularly in the past couple of years, I've gradually moved over from bare metal to MCC Harmony for 80% of my work. This isn't because MCC Harmony is particularly good, it's because the complexity and breadth of these devices has developed to a level where it simply is faster to use the code generator, and both accept and work around its limitations & bugs (of which there are many).The biggest problem of MCC Harmony (Harmony is for 32 bitters only) is its learning curve. To use it effectively you have to get into the grove and resist fighting it. This means you have to consider everything within your application must be written as a state machine. Your code will be state machines dependent on other state machines. Once you're comfortable with that, the friction to adoption is much, much less.Unfortunately the MCC Harmony examples often confuse things by flattening their application code into a single monolithic state machine, rather than implementing multiple state machines, each with a single responsibility. Now I generally object to the inorganic forcing of software programming principles onto people, however MCC Harmony pretty much enforces much of the SOLID principles mantra without you realising it if you want your code to be maintainable. After a while, it all makes sense, but man, is that learning curve steep.Edit: One of my biggest bugbears with Microchip is their content management.For example, they release changes that render their own tutorials useless. Nothing could be more off putting than investing time, effort and $ only to find that the beginner tutorial just doesn't work. I don't think Microchip is alone in this.I'll also add that Microchip's repo and document management is dire. As well as documentation, they lose entire repos. Because much of their development framework is now on cloud-based repos, the loss of a framework repo can and does make maintaining older projects impossible as you can't even recreate a functioning development environment to maintain your project.

author: tooki
author_rank: Super Contributor
timestamp: August 15, 2025, 10:00:04 am
content: Quote from: WaveyDipole on August 13, 2025, 08:23:10 pmFYI: To the UK, Digikey ships with DDP incoterms if you use UPS shipping, which means VAT is collected at the time of ordering, and all customs clearance is taken care of: the price you see at checkout is the total final price, full stop.Mouser UK says: “Incoterms:DDPAll prices include duty and customs fees on select shipping methods.”As for Microchip direct: I already told you that Microchip ships thosefrom their UK warehouse, so why would you think you’d be paying for taxes and tariffs on US goods? They’re already imported. You’d be placing a domestic order.Between this and your subsequent statement about the power consumption, you seem to like to base your decisions based on defeatist assumptions, rather than going to the effort to find the actual answers…

author: Howardlong
author_rank: Super Contributor
timestamp: August 15, 2025, 10:00:20 am
content: Quote from: WaveyDipole on August 15, 2025, 09:31:09 amI'm going to put a fly in the ointment here!There are two versions each of DM164136 (28 & 40 pin) and DM164137 (8, 14, & 20 pins). Microchip never changed the part number.The earlier versions have PKoB3 so will not support the newest chips, nor will they work with the latest 6.25 version of MPLAB X (6.20 is the last version to support Gen 3 programmer/debuggers). They don't have a UART serial bridge either.The newer versions have PKoB4 which will support all the current PIC12/16/18 DIP devices released over the past 15 years or so. They also have a UART serial bridge on board.A gentle reminder that none of these boards support high voltage programming.Here's how to identify them visually:

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 15, 2025, 10:02:05 am
content: Quote from: brucehoult on August 15, 2025, 09:27:18 amMust admit I hear that C compilers are pretty much well optimised these days, although I gather the offering with the free MPLAB X IDE is rather inefficient. Could one simply use an alternative compiler e.g. gcc?The last time I used assember was while hacking BBC Micro 6502 code in the 80s. That knowledge might still be around in the grey cells somewhere, but might be rather difficult to retrieve some 40 years later..... I have no objection to learning PIC assembler, but I think you hit the nail on the head when you said "unless you are doing something very specialised".Just one question; I presume that for PICs, when various comments are referring to C, that does literally mean C and not C++? So its no Arduino-like language but and one loses the object oriented stuff that is available on Arduino AVRs? Does one still have std:: libraries at least?

author: tooki
author_rank: Super Contributor
timestamp: August 15, 2025, 10:10:57 am
content: Quote from: WaveyDipole on August 13, 2025, 08:23:10 pmI very much doubt MPLAB X supports the TL866II directly in any way. I can’t find any evidence to that effect.But moreover, why would you want to? The PicKit gives you a HUGE advantage, in being able to do in-circuit programming and above all, debugging. That’s incredibly useful.Quote from: WaveyDipole on August 13, 2025, 08:23:10 pmYou mean like a PIC clone? I don’t know of any, but who knows what Chinese semiconductor makers make. But what would this accomplish for you?Quote from: WaveyDipole on August 13, 2025, 08:23:10 pmQuote from: WaveyDipole on August 13, 2025, 08:23:10 pmI don’t know. But who cares? You can’t buy either of those new anymore. And newer PIC chips are only supported with newer PicKit devices anyway. I don’t know why you wouldn’t just buy a PicKit 5 and call it a day.

author: tooki
author_rank: Super Contributor
timestamp: August 15, 2025, 10:17:31 am
content: Quote from: westfw on August 13, 2025, 09:45:03 pmWhat you wrote here is completely correct for an Arduino Uno, Arduino Pro, or Arduino nano, all models based on the ATmega328p. But the Arduino Micro is not based on the Atmega328p, but on the ATmega32u4, which has native USB and doesn’t use a bridge.

author: tooki
author_rank: Super Contributor
timestamp: August 15, 2025, 10:26:30 am
content: Quote from: WaveyDipole on August 14, 2025, 10:30:33 amWhile you do have to create an account to use the web shop, you do NOT have to place an order to find out shipping information. When I checked for Switzerland, it said it would ship from the UK warehouse. (I already told you this, remember??) There is no way they’d ship from their US or Thai warehouse to a UK customer when they can ship from the UK warehouse.On the Microchipdirect website, the footer has a link about international ordering, with shipping info and prices. UK shipping is like £5.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 15, 2025, 10:28:03 am
content: Quote from: Howardlong on August 15, 2025, 09:40:33 amHoward, you're on a roll! Having a hard time keeping up....Thank you so much for all the detail. Very helpfull indeed!Quote from: Howardlong on August 15, 2025, 09:40:33 amAll very true, especially the latter unfortunately.Quote from: Howardlong on August 15, 2025, 09:40:33 amNow that's something not easily done with Arduino IDE.Quote from: Howardlong on August 15, 2025, 09:40:33 amThat's not so unusual in the Arduino world either. But yes understanding chips using datasheets - that's something I have already become accustomed to as I have worked with direct writing to registers etcQuote from: Howardlong on August 15, 2025, 09:40:33 amUugh. Have to agree with that. To me, it all depends on what you are ttrying to achieve and the best way of acheiving that goal. I guess I will have to bear that in mine when looking at their examples.Quote from: Howardlong on August 15, 2025, 10:00:20 amOk, so I am still learning the terminology and although I noted it, was still not sure what PKoB3 and PKoB4 mean so did a google search. This is what I got as a reply:Quote from: StupidAIOk, just posted that for a bit of humour, but eventually I found the answer I think:https://onlinedocs.microchip.com/oxy/GUID-B9254D1C-4CD6-466C-8BEB-7E7560FD6FBC-en-US-1/GUID-A72BDCBF-1DC2-44DC-82FF-1898F399E4C2.htmlI think its clear that I would be better off buying a device with PKoB4 support. Thank you for that information and the 'gentle reminder' :-).

author: tooki
author_rank: Super Contributor
timestamp: August 15, 2025, 10:31:22 am
content: Quote from: chilternview on August 14, 2025, 11:06:24 amMicrochipdirect is literally their direct-sales website. Why would they be “not interested”? You sign up, you add the item to the cart, you pay, and they send it to you. They wouldn’t set it up to work that way if they didn’t want it.

author: Howardlong
author_rank: Super Contributor
timestamp: August 15, 2025, 10:31:31 am
content: Quote from: brucehoult on August 15, 2025, 09:27:18 amRespectfully, I don't agree.It could be argued that x86, PIC24 and dsPIC, for example, are better suited to C than load-and-store RISC architectures like MIPS, ARM or RISC-V because of their base/frame pointer and the pointer addressing modes available to most instructions, not just load and store.Perhaps I should've phrased it better, how about "This applies to every C compiler on every architectureto some degree".Yes, I fully agree that PIC16 makes a C compiler work hard. But in almost all circumstances, one just doesn't care because you almost never need to concern yourself with it when writing source code. I am not saying you don't need to concern yourself with the generated code. I look at compiled code every day of my working life whatever architecture I'm developing on. What I am saying is that as a programmer, from experience when writing C for the PIC10/12/16/18, you almost never need to concern yourself with the mundane aspects of dealing with bank switching or how variables are allocated when writing code, or the visibility of data, something you do have to when writing assembler. But I am also not advocating for people to jump intowritingassembler on PIC either. I do think it's valuable to be able to at leastreadassembler on any target processor that you're writing C on.

author: tooki
author_rank: Super Contributor
timestamp: August 15, 2025, 10:32:42 am
content: Quote from: mariush on August 14, 2025, 01:23:35 pmHow is that cheaper than free shipping, with customs already cleared, with Digikey or Mouser?!?

author: Adrian_Taylor333
author_rank: Regular Contributor
timestamp: August 15, 2025, 10:33:07 am
content: Quote from: WaveyDipole on August 15, 2025, 10:02:05 amWhen people are talking about how good have compilers got, they mean modern, powerful many-core CPUs as targets.And even there humans are at disadvantage as no assembler I know of does tracking instruction interdependencies, their various execution phase latencies and trhoughputs of various execution chain elements etc.And yet some crews like FFMPEG developers still insist on using pure assembler in hot paths. And they win with hand-written assembly even there.Whomever said that PIC16/18 is streamlined for compiled code is a clueless or moron, possibly both.It is only somewhat less of an utter crap than previous PCI generations.With old micros like PIC, MCS48/49/51 (8051 and brethren) one can't really optimize the algorithm but data form and layout.On any 8-bit PIC DATA LAYOUT IS THE KING.CPU core it basically tetraplegic, so data has to be manuevered and shaped so that it flows through the crappy core with the least hickups and womits.I usually have to rewrite the code and data a few times to get it right.There is no way any C/C++/etc compiler can do that.Reason is simple - compiler has to make extremely conservative assumptions on code transformation during the optimisation and data transformation is almost non-existent.It can't do much more than to optimize-out some variable etc.IMO, on PIC16/18, one has no luxury of using C, even if there were no other problems within the SDK stack.On more decent things like AVR and similar tools, one has no reason to do so. Assembly is there is already awesome.In general, I find it less unnerving to write my own asm source than to wrestle with C compiler and/or (god forbid!) Microchip's libraries, like Harmony etc.Those are on whole another layer of crappiness.

author: brucehoult
author_rank: Super Contributor
timestamp: August 15, 2025, 10:43:04 am
content: Quote from: WaveyDipole on August 15, 2025, 10:02:05 amMy comments above about modern instruction sets (post 1985) DO NOT APPLY to PIC, which is from 1976 and was designed as a simple Peripheral Interface Controller and not as a general-purpose CPU.No you can not use gcc for PIC. GCC in general only supports 32+ bit CPUs and a few selected 16 bit ones.The original PIC instruction set (PIC16 and below) is extremely unfriendly to compilers and can not support the normal full C language.PIC18 (in 2000) added a few things that help a bit but it's still awful, and is still a minority of the 8 bit PIC market. PIC24, PIC32, PIC64 are completely different instruction sets and not what people mean when they simply say "PIC" without qualification.QuoteMy "unless you are doing something very specialised" applied to modern CPUs, not PIC. In (8 bit) PIC you absolutely should use asm, or you should use another better ISA such as AVR or Arm or RISC-V.QuoteNo, C and C++ are the same language in this conversation.C++ makes more use of pointers to structs and pointers to functions (virtual functions in C++) but all the same fundamental features exist in C and require the exact same kinds of instructions from the CPU, even if idiomatic C++ code uses them a bit more often than idiomatic C code (let alone contorted restricted C code designed to compile efficiently on PIC).

author: tooki
author_rank: Super Contributor
timestamp: August 15, 2025, 10:45:03 am
content: Quote from: WaveyDipole on August 14, 2025, 10:30:33 amNo idea where you got the notion that an FTDI board can be used. The only Arduino/ATmega/ATtiny boards that can be programmed with an FTDI (= UART adapter) are boards already preloaded with a bootloader. But to load the bootloader, you first need a “real” programmer like a PicKit (or Arduino with the ArduinoISP sketch).(In contrast, just as an example, the ESP32 series has a serial bootloader out of the box, so an FTDI can be used to program one; in fact, Espressif’s official programmer is just an FT2232.)

author: Howardlong
author_rank: Super Contributor
timestamp: August 15, 2025, 10:49:49 am
content: My experience of Microchip Direct here in the UK is that orders usually take about a week to 10 days elapsed, so you don't want to be in a hurry.First, they seem to take a couple of days to even dispatch the item from Thailand or wherever stock is actually sitting, but they only ship to Microchip's UK HQ, not direct to the punter. Then the UK HQ ships the items to you via Fedex/TNT overnight.Recent examples:Order on 22 June was delivered on 3 JulyOrder on 22 May was delivered on 30 MayOrder on 8 May was delivered on 13 MayOrder on 2 May was delivered on 12 May

author: Howardlong
author_rank: Super Contributor
timestamp: August 15, 2025, 10:54:44 am
content: Quote from: brucehoult on August 15, 2025, 10:43:04 amThey added a load of stuff in 2016 including vectored interrupts and DMA revitalising the line-up, as I've mentioned previously on this thread.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 15, 2025, 11:00:54 am
content: Quote from: tooki on August 15, 2025, 10:00:04 amI don't doubt that you are no correct, but it would be nice if they would confirm that. Instead they used pressure tactics stating that unless I give them full personnal contact and other details and create an account they couln't give me any information. The point is kind of moot because I will not be buying direct from them. Eve on the UK site they quote prices without mentioning whether thats before or after VAT so one can only assume that its before and decide accordingly. I didn't mean to question what you are saying an apologise if it came across that way.Quote from: tooki on August 15, 2025, 10:00:04 amOuch! I like to base my decisions on facts. For purchasing decisions I usually like to have the purchasing source confirm what has been said on a forum, but that has not been the case here. Not in the least bit your fault - but theirs, so perhaps I am being rather defeatist about dismissing Microchip as a direct purchasing source.On the other hand, I am not too hung up on the power usage if the solution will be powered from USB. However, I have found the discussion of varions optimising techniques interesting and do have a genuine desire to understand this better. I am therefore grateful for all the comments on the subject. Its not something that I have had the need to delve into before, but I understand that in some circumstances such optimisation it might be essntial.So far in connection wit this specific project, the discussion has shown that I have at least 3 options:- optimise the Micro (32u4)- use a different AVR such as 328P or ATtiny- use a PICIf low power consumtion end up being required, then it has also shown that optimising code and hardware is the key so I am considering those options leatning more about power optimisation. In the meantime, I now have a working prototype using the board I had to hand as proof of concept. The next step might be to see how it can be best implemented. For example, could one add Bluetooth (BLE) and still keep power below around 20ma? There is also the issue of RF noise so lots to think about.In the meantime information has been coming my way thick and fast over the last couple of hours so still catching up with the reading.....

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 15, 2025, 11:04:25 am
content: Quote from: tooki on August 15, 2025, 10:45:03 amGood point. Indeed the bootloader is essential for USB-to-serial. Was forgetting that. Thank you.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 15, 2025, 11:14:35 am
content: Quote from: brucehoult on August 15, 2025, 10:43:04 amNoted.Quote from: brucehoult on August 15, 2025, 10:43:04 amAlso noted.Quote from: brucehoult on August 15, 2025, 10:43:04 amOk, so its C, but a "contorted restricted C code designed to compile efficiently on PIC". Interesting to note.

author: brucehoult
author_rank: Super Contributor
timestamp: August 15, 2025, 11:14:54 am
content: Quote from: Howardlong on August 15, 2025, 10:31:31 amNo, and I addressed that in the parts of my message you didn't quote.Those CISCy addressing modes on all of the arithmetic instructions make life a little easier for asm programmers (but not much, honestly), and maybe for compilers -- though even that is arguable for an optimising compiler because it hugely complicates decisions around CSE -- but it doesn't result in technicallybettercode, just more convenient in some way.The same for frame pointers. They only exist to simplify life for the human programmer, so that the same stack frame item is at the same offset all the time, regardless of stack pointer pushes and pops. But that's merely a mental crutch, a compiler can easily keep track of changing offsets (and a human can with some effort), and it costs instructions and memory traffic and code size and performance to maintain the frame pointer.

author: tooki
author_rank: Super Contributor
timestamp: August 15, 2025, 11:30:16 am
content: Quote from: WaveyDipole on August 15, 2025, 11:00:54 amIf you’re planning to add Bluetooth or WiFi, then just go with an ESP32 series, with the understanding that they aren’t the most power-efficient MCUs out there. (But if you can power it from USB or a wall wart or from power somehow extracted from the device it’s controlling, this might not matter.)I used a tiny ESP32-C3 board (the DFRobot Beetle ESP32-C3) as a remote control transmitter last year, albeit using the ESP-NOW protocol, not Bluetooth LE. I forget how much current draw I measured when idle. It rises a lot while actively communicating.

author: David Hess
author_rank: Super Contributor
timestamp: August 15, 2025, 11:57:15 am
content: Quote from: tooki on August 15, 2025, 11:30:16 amIs there an ARM equivalent to the ESP32? The last thing I want to do is learn another microcontroller architecture or become more dependent on China.Hmm, looks like the STM32 is exactly that with a SoC version that includes Bluetooth and Wi-Fi. I wonder how they compare.I forgot that Infineon bought Cypress.

author: brucehoult
author_rank: Super Contributor
timestamp: August 15, 2025, 12:07:16 pm
content: Quote from: Howardlong on August 15, 2025, 10:54:44 amWhich is not relevant to C vs asm code quality.

author: David Hess
author_rank: Super Contributor
timestamp: August 15, 2025, 12:09:20 pm
content: Quote from: brucehoult on August 15, 2025, 12:07:16 pmI thought the PIC18 was their answer for better C support.

author: brucehoult
author_rank: Super Contributor
timestamp: August 15, 2025, 12:16:04 pm
content: Quote from: David Hess on August 15, 2025, 11:57:15 amOriginal ESP32s (and ESP8266) were the obscure Xtensa ISA which is normally used deeply buried inside a chip and no one except the chip manufacturer knows its there or programs it. Espressif were, as far as I know, the first to expose an Xtensa to end-user programming and Cadence were not all that happy with them.Recent ESP32s are RISC-V and the company has said all future ones are expected to be.This is no doubt a controversial opinion, but 32 bit Arm is becoming a legacy technology like PIC, continuing to be used in old designs (and minor updates to them) for a long time, but with fewer and fewer new products built around them.

author: tooki
author_rank: Super Contributor
timestamp: August 15, 2025, 12:27:36 pm
content: Quote from: David Hess on August 15, 2025, 11:57:15 amI recommended ESP32 because the OP is already familiar with the Arduino framework, which has robust ESP32 support. (Espressif also managed to maintain high product availability during the pandemic, unlike ST. It seems to be a well managed company. And while Espressif itself is Chinese, the chips are manufactured by TSMC in Taiwan.)FYI, Espressif is little by little migrating to the open-source RISC-V architecture.Which STM32 has WiFi? I checked their website and the only WiFi product I see is a separate WiFi module intended as a “companion” to an STM32 MCU. They have many MCUs with Bluetooth, zigbee, etc. but none with WiFi.

author: Tation
author_rank: Regular Contributor
timestamp: August 15, 2025, 12:32:05 pm
content: In no way will a ESP32 device provide BLE connectivity powered by, say, a CR2032 cell. But there are other chips capable of that, e. g. from Nordic (Arm) or from Telink (RISCV), with offerings below 10 mA.With the added benefit (over PIC) of support in Zephyr, free dev tools... Can't see the benefit of trying BLE from architectures different of Arm/RISCV.

author: SiliconWizard
author_rank: Super Contributor
timestamp: August 15, 2025, 12:38:51 pm
content: Yeah, for low-power RF stuff such as BLE, Zigbee, ... and if you have no use for WiFi, I would clearly also recommend against ESP32 solutions. They are not low-power by any means and there are much better alternatives out there.Nordic is one serious contender, and On Semi RSL series are also impressively good. All ARM based.But for WiFi, there's very little competition, at least in this price range.

author: Picuino
author_rank: Super Contributor
timestamp: August 15, 2025, 12:41:54 pm
content: https://learn.sparkfun.com/tutorials/reducing-arduino-power-consumption/all

author: shabaz
author_rank: Frequent Contributor
timestamp: August 15, 2025, 12:42:52 pm
content: Quote from: David Hess on August 15, 2025, 11:57:15 amI've used the ESP32 for a few projects, I like it.Not quite the same thing (for hobby projects at least, it might not matter if it's all on one SoC or not) there's the Pico W, or Pico 2 W (latter supports switchable ARM and RISC-V) which both have a basic 2.4 GHz WLAN and BLE. Quite decent SDK too, and works with GNU tool chain. I've not used the W variants much, but find myself using the basic Pico (RP2040) a fair bit. For low cost, low power BLE I think there are a ton of options, at the low end there's some Dialog castellated board modules easy to prototype with, I've found a few uses for them (picked up about 50 of them when they were extremely low priced like sub-$2 but now they've gone up a bit).

author: tooki
author_rank: Super Contributor
timestamp: August 15, 2025, 12:45:29 pm
content: Quote from: Tation on August 15, 2025, 12:32:05 pmWell, as I said, I recommended ESP32 to the OP because of his familiarity with the Arduino ecosystem: ESP32 is robustly supported there. But it’s definitely not low-power. (Though it remains unclear whether low power is actually a core requirement or not; OP has sorta flip-flopped on that…)

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 15, 2025, 12:50:09 pm
content: Quote from: Picuino on August 15, 2025, 12:41:54 pmThank you. Interesting article.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 15, 2025, 12:54:57 pm
content: Quote from: tooki on August 15, 2025, 12:45:29 pmMy current prototype is connected via USB so can draw power from the PC USB port so power draw is not that important in this scenario. Ideally, I would like to arrive at a wireless solution that requires perhaps no more than 20-25ma of current. I don't think that WiFi will be viable - it just draws too much - but am investigating whether Bluetooth is plausible. I came across a BM70 module for example, but it still needs a controller to drive it and might draw more than I would like. I am therefore interested in those Nordic and Telic options so Googling. A range of 5 metres would probably suffice, but 10 would be great.I suppose one could also use nRF24 modules, with the receiver + ATtiny on the radio end and an Arduino plus transmitter on the PC end. I have some of thhose lying around as well. The nRF module supposedly draws 13.5mA when receiving, so if I can keep the ATtiny to below 12mA then my goal would be achieved. The PC end is powered from USB so no problem. However, I do have a couple of Bluetooth dongles lying around which would be more convenient to use on a PC than making a 3D printed case for an Adruino plus nRF24 transmitter. Still, it *might* be a possible solution.I would have to test to see how much an ESP32-C3 draws when driving just that single GPIO and running BlueTooth. That *might* also be a solution if it can be optimised down enough, but I'm told that these draw like 110mA, but no doubt that's before any optimization is applied and probably running WiFi. I just plugged it in with the OLED display I had connected and running a display demo and the current draw is around the 25-30mA mark. Disconnecting the OLED does not make much difference but it does drop to below 20mA.

author: coromonadalix
author_rank: Super Contributor
timestamp: August 15, 2025, 01:38:34 pm
content: you have the "snap" board who almost do the same job as a pickit4 for less, paid 10,99 ea directly at microchip ?https://packs.download.microchip.com/DeviceDoc/Device_Support.pdfPlease note, Microchip’s SNAP Debugger does not work with UPDI/PDI and TPI based formerly Atmel AVR devices unless the R48 pull-down resistor is removed and a 1k to 10k pull-up resistor is installed between TVDD (J4-2) to TPGD/DAT(J4-4).

author: David Hess
author_rank: Super Contributor
timestamp: August 15, 2025, 01:52:18 pm
content: Quote from: tooki on August 15, 2025, 12:27:36 pmLooks like they only have Bluetooth. I thought they also had Wi-Fi because they are listed with "2.4 GHz".I will keep looking.Quote from: brucehoult on August 15, 2025, 12:16:04 pmHaving participated in a couple of RISC-V discussions, I have even less interest in adopting it. It reminds me of the all theory and no practice systems designed by university computer professors.

author: brucehoult
author_rank: Super Contributor
timestamp: August 15, 2025, 01:59:53 pm
content: Quote from: David Hess on August 15, 2025, 01:52:18 pmA very strange take given all the design decisions that were made emphasising practicality and efficiency -- especially for tiny cores -- over being pretty.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 15, 2025, 02:49:56 pm
content: Hmm, I tried a number of NimBLE-Arduino library examples (couldn't get any of the Espressif included ones to compile) on the ESP32-C3 and for client applications the current draw was around 90mA. For the server application it was 50mA. That's similar apparently to WeAct Blackpill.Of course, I am just running off-the-shelf examples here without any optimization. I am using the FNIRSI FNB48S USB tester to measure current draw. If it can be optimzed down then it might be viable but would require significant current saving. There's not much in the way of components on this ESP32-C3 Mini board although there is a power LED that could be removed. The rest must be being drawn by the BlueTooth radio and I am researching possible ways of reducing that. Suggestions include reducing clock speed (where have I head that before) and scan frequency. Lowest operating voltage is 3.3V so not much can be done about that.

author: westfw
author_rank: Super Contributor
timestamp: August 16, 2025, 12:01:14 am
content: QuoteNot quite true. If you have a real FTDI breakout with all the pins, AVRDude added the ability to bitbang AVR ISP protocols, quite a while ago:Code:# FTDI USB to serial cable TTL-232R-5V with a custom adapter for ICSP# http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm# http://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_TTL-232R_CABLES.pdf# For ICSP pinout see for example http://www.atmel.com/images/doc2562.pdf# (Figure 1. ISP6PIN header pinout and Table 1. Connections required for ISP ...)# TTL-232R GND 1 Black -> ICPS GND (pin 6)# TTL-232R CTS 2 Brown -> ICPS MOSI (pin 4)# TTL-232R VCC 3 Red -> ICPS VCC (pin 2)# TTL-232R TXD 4 Orange -> ICPS RESET (pin 5)# TTL-232R RXD 5 Yellow -> ICPS SCK (pin 3)# TTL-232R RTS 6 Green -> ICPS MISO (pin 1)# Except for VCC and GND, you can connect arbitual pairs as long as# the following table is adjusted.programmerid = "ttl232r";desc = "FTDI TTL232R-5V with ICSP adapter";type = "ftdi_syncbb";connection_type = usb;miso = 2; # rtssck = 1; # rxdmosi = 3; # ctsreset = 0; # txd

author: westfw
author_rank: Super Contributor
timestamp: August 16, 2025, 12:17:48 am
content: QuoteIt was. And it IS "better." (IIRC: multiple "index registers", and a flatter address space (rather than having data interleaved with SFRs), Top of Stack readable, and (sort-of) push/pop instructions.)It's just that it's still pretty awful... (and still 4k max for data.)

author: westfw
author_rank: Super Contributor
timestamp: August 16, 2025, 01:02:12 am
content: QuoteOld and expensive.Try one of the new "xtiny" chips like the ATtiny402.They haven't exactly replaced the tiny85 - there's no 8pin DIP with 8k of program memory, but you can get 8pin SOs with 4k and 14pin SO with 32k (attiny3224), and they have all the peripherals missing on the tiny85 (like UART and I2C)

author: brucehoult
author_rank: Super Contributor
timestamp: August 16, 2025, 02:29:23 am
content: Quote from: westfw on August 16, 2025, 01:02:12 amHalf the RAM and flash of an ATTiny85 (so, more like an ATTiny45) and no DIP, for $0.50 vs ATTiny85 at $1.26 for MLF-20, $1.50 for SOIC-8, or $1.66 for DIP-8.DIP is a large part of the attraction for hobby users. For many people if you can't get a chip in DIP then you'll want to buy a chip already on a breadboard-friendly breakout board, preferably with any required external components such as caps or crystals, and probably with an LED and/or push button(s).Unless -- as many others have pointed out -- you're making something in high volume, it's better to get the one in the easy to use DIP-8 package (if you like that), even if it's $1 more.

author: tooki
author_rank: Super Contributor
timestamp: August 16, 2025, 08:01:49 am
content: Quote from: westfw on August 16, 2025, 12:01:14 amOh, interesting! Thanks for the heads-up.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 16, 2025, 03:59:17 pm
content: Quote from: westfw on August 16, 2025, 12:01:14 amThank you for that as well. My breakout boards have all of the necessary pins so I can give it a try.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 16, 2025, 04:20:29 pm
content: Quote from: westfw on August 16, 2025, 01:02:12 amGlad I saw your post before I placed an order! I was going to order one or two ATtiny85 for historical interest, but was also looking at ATtiny1624's which are almost AVR-like for features. Its interesting that Microchip directs you to the AVR family of chips when you look for PIC. The new range of PIC products are now apparently part of the AVR family.On the PIC side I am looking at PIC16F887-I/P simply because tutorials seems to use these. I also picked one from the PIC18 range - PIC18F26Q24ESP along with the PICkit5. That's my "training" budget spent. I am thinking of ordering two of each of the chips I mentioned - firstly in case I brick or toast one - secondly to have one for development and one for actual deployment in a project.One thing that bothers me is that if PIC are now being re-branded as being part of the AVR family and being updated with AVR features, except perhaps for having a larger range of memory options (mostly with much less), then will the PIC line eventually merge into AVR? So is it still worth investing in PIC?Incidentally, I did also raise a question on the Arduino forum because although the PICkit5 can program AVR chips, there seems to be no support for it in the Arduino IDE? One can still use the serial port or a USBASP programmer, but it would be nice to be able to use one programmer across the board.

author: shabaz
author_rank: Frequent Contributor
timestamp: August 16, 2025, 05:35:38 pm
content: Hi,PIC16F887 is a two-decade-old part, so there may well be lots of documentation for it, however I don't think it is supported in the Arduino environment, nor will it help when you wish to transition to BLE or WLAN from your current USB-UART.The ATmega and ATtiny parts will work with Arduino (but Google to confirm any specific part you're thinking of).ESP32, and Pico W, both support wireless capabilities, and both are Arduino-environment-supported, plus, no separate programming tool required (not a major issue since you're willing to purchase a programmer, but if you wish to share your project for others to construct, then it's a small barrier whereas ESP32 and Pico W just need a USB cable for uploading firmware.Sometimes other people fix things or add features with you can benefit from too, so it's nice to make it easy for others to pick up and run with your project, if that's what you wish to do (I don't know if you're developing a commercial product, or hobby project).Others can also fix things and test easily since typical Arduino/Atmel parts, ESP32 and Pico are way more likely to be in hobbyists's hands these days rather than that PIC part, if you need the support as you develop your project (for instance, I may have a few of these old PIC parts lying around, but I will for sure have more Atmel ICs, since Arduino is so popular).If one is new to BLE, then they may need a bit of help since all the terminology and procedures are unusual for a newcomer, so it's worth picking a popular part with a lot of info out there.EDIT: Sorry, just realized this is a PIC thread specifically. I got it confused with the earlier thread that wasn't PIC specific.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 16, 2025, 07:35:04 pm
content: Quote from: shabaz on August 16, 2025, 05:35:38 pmYes, indeed, just chosen for compatibility with tutorials.Quote from: shabaz on August 16, 2025, 05:35:38 pmThat is understood, but from what I have been able to determine, its not a likely option at the low power levels that are required in this instance, whether that's WiFi or BLE. If externally powered, then yes, would be obvious option. I have ESP32 (WROOM and C3), Pico W and Arduino Connect so could use either of those with an external power source.Quote from: shabaz on August 16, 2025, 05:35:38 pmThat is a very valid point and one of the reasons why I chose Arduino for the odd project or two that I have made public. The low power requirement (ideally less than 25mA) was the reason a PIC was suggested by someone for this one, under the assumption that it uses less power that AVR. Wireless was not a necessity, but a nice to have if possible. It seems that power usage between PIC and AVR may not be as clear cut as first stated and I also need to pay attention to optimisation for low power. In this case, no, its not for a commercial project.Quote from: shabaz on August 16, 2025, 05:35:38 pmAlso a good point. I have done a little with BlueTooth beyond the HC05 module, but not in a while and not with BLE.Quote from: shabaz on August 16, 2025, 05:35:38 pmGlad you got confused and posted here (no offense intended) as you have made some good points, so thank you for your post. Since the idea of using a PIC was proposed and I had little prior knowledge, after a bit of reading with little understanding it seemed sensible to ask the experts!The jury is still very much out on whether to tool up and learn PIC, but it won't neccessarily be for this specific project, but for the general learning experience, assuming its still worthwhile in (the later half of) 2025.

author: Howardlong
author_rank: Super Contributor
timestamp: August 16, 2025, 08:00:49 pm
content: Quote from: WaveyDipole on August 16, 2025, 04:20:29 pmThat's news to me. Which "new range of PIC products are now apparently part of the AVR family"?QuoteI do wish these tutorials would be updated. Nobody develops new products with these old smokers in them.QuoteThese are pretty new. Their main claim to fame is their secondary voltage domain. FWIW, the Q41 and Q71 series are awesome for analogue: I wrote a USB PD encoder and decoder for them, all the signal conditioning was done on chip.QuoteI think I need to understand more about how you've drawn this conclusion.What is become clear is that Atmel Cortex ATSAM family branding is being dropped for new parts in favour of PIC32C branding.There's a lot of talk about serial style programmers. That's all they are, programmers. You will not be able to debug with them. That's the biggest bugbear of mine with the Arduino IDE, there's no debugging.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 16, 2025, 08:40:16 pm
content: Quote from: Howardlong on August 16, 2025, 08:00:49 pmOk someone or something is messing with my head!I just did exactly the same as I did several times yesterday to find the page. I just looked for ATtiny and PIC devices and from the search results ignored the sponsored entries and picked the direct Microchip company link. Yesterday I kept getting informed about the AVR family. Today I am being taken directly to the product page. I am now questioning myself as to whether I imagined it, was it for PIC, was it for ATtiny or was it a dream....? Will try again in the laptop on a while as I was working on that yesterday but I am very confused right now! Just got a down for maintenance page as well.Perhaps need to hold fire on that assertion.Quote from: Howardlong on August 16, 2025, 08:00:49 pmSeems to depend on whether the board platform supports it I think, but point taken. They do have a built-in gdb-server and openocd tool in IDE2.3.x. it does require the appropriate debugging interface. I haven't used it yet. Debugging has been a known shortcoming in Arduino IDE for some time.

author: westfw
author_rank: Super Contributor
timestamp: August 17, 2025, 05:40:01 am
content: QuoteOne has to be careful with hobbyist-oriented tutorials, because they tend to lag far behind "current" products. Especially the GOOD tutorials, which in addition to starting behind, tend to remain "a long time."I guess it's good news that you're finding tutorials that don't still use the PIC16F84...The PIC16F has several sub-families:"Baseline" MCUs, with a 12bit instruction word. 16F5*. Avoid these unless you really need those SOT23-6 packages!"Mid-range" MCUs, with a 14bit instruction word. This includes the 16F887 you mentioned. Max of 8k program memory, 368bytes RAM..."Enhanced Mid-range" MCUs, also with 14bit instructions. Usually PIC16F1*. 32k program space! Up to 4k RAM! 2 index registers!Somewhat explained here:https://developerhelp.microchip.com/xwiki/bin/view/products/mcu-mpu/8bit-pic/

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 17, 2025, 03:54:23 pm
content: One tutorial I came across is from EEVblog land, called Gooligum and uses these:PIC10F200-I/PPIC12F509-I/PPIC12F629-I/PPIC12F1501-I/PPIC16F506-I/PPIC16F684-I/PPIC16F1824-I/PThe first 4 are not even PIC16F*...The last one is a PIC16F1*, but doesn't have anywhere near 32kb program space. Only 4096kb unfortunately, although I did wonder whether you meant ones with 5 digits like PIC16F18857 which has 56kb flash and 4k RAM? It seems the next kevel down provides 28kb flash.The Gooligum tutorial was last updated 4 years ago but referrs to PICkit2 and PICkit3, so might be rather older than that.Some other devices I have encountered in tutorials:Instructables:PIC18F22K80Deepblue Embedded:PIC16F877AVarious videos:PIC16F84APIC16F627APIC16F628AMicrochip also has the "Microchip University" which is probably more up to date but I have not looked at it in depth yet.So, I am really unsure what chips to buy to get started, but I suspect I would be wasting money by buying a unit of each of them.Can I also ask whet the difference is between I/P and E/P? I found that ither letters referred to different packages or features etc, but couldn't find the difference between these two.

author: mariush
author_rank: Super Contributor
timestamp: August 17, 2025, 05:24:28 pm
content: A lot of tutorials will use a particular version of microcontroller simply because it's available in DIP package.I would skip the pic10 completely, you can do the tutorials for pic10 with pic12f series.I'd look atPIC12F1572https://www.digikey.com/en/products/detail/microchip-technology/PIC12F1572-E-SN/4740863low pin count (6 io), up to 32 Mhz, 3.5 KB of code (2KB of 14 bit words), 256 bytes of ram, 10 bit ADC, 5 bit DAC, 16 bit PWM (3 independent with their own timers), Complementary Waveform Generator (CWG), uart .. so quite versatile. no i2c or spi, but otherwise quite a lot of features.For i2c/spi there's PIC12LF1552https://www.digikey.com/en/products/detail/microchip-technology/PIC12LF1552-I-MS/3872317which would also work with 1.8v to 3.6vPIC16F1503https://www.digikey.com/en/products/detail/microchip-technology/PIC16F1503-E-SL/2775810simple soic-14 pin ... up to 20 mhz, 3.5KB of code, 128 byte of ram, 10bit adc, 5bit dac, two comparators, two Configurable Logic Cell (CLC) modules, Numerically Controlled Oscillator (NCO), CWG, i2c/spi supportand from the pic18f family I'd look at some DIP chips just to breadboard them easilyex PIC18F47Q10https://www.digikey.com/en/products/detail/microchip-technology/PIC18F47Q10-E-P/12807242and I'd get a version that has USB support like PIC18F2450 or PIC18F4450https://www.digikey.com/en/products/detail/microchip-technology/PIC18F2450-I-SP/1015621https://www.digikey.com/en/products/detail/microchip-technology/PIC18F4450-I-P/1015629

author: tooki
author_rank: Super Contributor
timestamp: August 17, 2025, 05:25:04 pm
content: Quote from: WaveyDipole on August 17, 2025, 03:54:23 pmThat information is right in the datasheets. For examplehttps://ww1.microchip.com/downloads/en/DeviceDoc/40001239F.pdfHint: it’s on one of the last few pages.

author: WaveyDipole
author_rank: Frequent Contributor
timestamp: August 17, 2025, 08:22:42 pm
content: Quote from: tooki on August 17, 2025, 05:25:04 pmThank you. Had another look and eventually found it. I=85deg, E=125deg.

author: westfw
author_rank: Super Contributor
timestamp: August 17, 2025, 08:33:08 pm
content: QuoteThey are PIC16F "architecturally"; they just got a bit anxious about differentiating the (back then, very uncommon) packaging (PIC10F is the 6-pin SOT23, PIC12F is 8pin DIP or SO.)QuoteAgain: "architecturally" up to 32k program space (instructions, not bytes, BTW.) Lower memory chips will sell for less...(If you're used to other 8bit architectures, anarchitectural limitof program memory to 2k, or RAM to 144bytes (or 8k/368) may seem particularly strange. Just one of the joys of the PIC16 architecture!)