New PIC18s, k42 family: Vectored interrupt, 12 Bit ADC, DMA and stuff. - Page 1
Forum section: electronics / general

author: JPortici
author_rank: Super Contributor
timestamp: March 12, 2017, 05:35:40 pm
content: PIC18F25K42 and familyhttp://www.microchip.com/wwwproducts/en/PIC18F25K42http://ww1.microchip.com/downloads/en/DeviceDoc/40001869B.pdfhttp://www.microchip.com/forums/m978114.aspxi'm very excited for this one. Just some highlights:- Vectored Interrupt Table (yup. you read it right.)- DMA- 12 bit ADC with computation (automated triggering, precharge, sampling, then filtering and whatnot)- Programmable boot memory block (i have a bootloader with crypto that doesn't fit in boot sector)- Peripheral pin selectand another truckload of peripherals.why in this day and age of ARM MCUs?without rehashing the same pointless debate, this is a drop-in replacement for many of our products (that used pic 18f2525 then pic18f26k22/80)i'm gettin a couple this week to test. according to guys on the microchip forum it seems very promising.

author: Kleinstein
author_rank: Super Contributor
timestamp: March 12, 2017, 05:58:52 pm
content: The vectored interrupts are something I would miss with the PICs - should be pretty easy to implement too. Also 12 Bit ADC is nice to get on par with ARMs and Xmega family.Microchip was missing an ARM for quite some time - they only recently got one from Atmel. So they sill have there top 8 bit family to compete to some of the easier jobs. They still have the option to run on 5 V if you want to and can thus directly drive white LEDs and some LCDs modules.Let's hope they fixed the bug with interrupt priorities - that did not work on the early PIC18 (though I have not checked for quite a while). 2 Levels of HW context switching somewhat gives hope on this.

author: JPortici
author_rank: Super Contributor
timestamp: March 12, 2017, 06:46:25 pm
content: apparently yes, IVT is a true IVT, at the expense of two more cycles to fetch the vector.If you ask me, still a lot of cycles saved if your interrupt is at the end of the if-then-else tree. Actually, already some cycles saved if you didCode:if (FLAG and ENABLE)for example, this will make a pulse generator (by toggling pin then reloading a timer at interrupt) a lot less wobbly.hey, maybe i could just use the DMA for that.aah... possibilities

author: Buriedcode
author_rank: Super Contributor
timestamp: March 12, 2017, 09:41:40 pm
content: I've been a fan of PICs for along time, and in recent years was impressed with the enhanced mid-range peripherals. DMA and IVT are nice to have, but whenever I thought a projected needed a these I was already using cortex M0's. They could keep adding stuff to 8-bit PIC's, but I think with all the peripherals about, the limitation of 8-bit devices is just that, the CPU. So I wonder is there really any point in adding DMA and IVT to PIC18? Unless of course they are <$1 in which case they could really compete with the low-end 32-bit market.

author: Bruce Abbott
author_rank: Frequent Contributor
timestamp: March 13, 2017, 08:52:58 am
content: Quote from: Buriedcode on March 12, 2017, 09:41:40 pmThe main problem with 8 bit PICs isn't the 8 bit CPU so much as the slow CPU clock and banked RAM. The banking issue is due to their particular 'risc' instruction set, and CPU frequency is probably limited by memory speed (AVR is also 8 bit, but runs 2-4 times faster than a PIC18 at the same clock frequency).OTOH, many applications don't need a high power CPU if peripherals can handle most of the workload. 8 bit PICs are now coming with advanced switched mode PWM and motor controllers, configurable logic cells and numerically controlled oscillators that are almost like having a CPLD built in. A 32 bit CPU doesn't help much when you are only manipulating a few port pins - it's the smart peripherals that make the difference.

author: JPortici
author_rank: Super Contributor
timestamp: March 13, 2017, 09:38:27 am
content: let me quote myselfQuotethat particular pinout is very popular among PICsI am in the middle of redesigning a board which used the 26k22. Plan was to just upgrade the mcu but due to new requirements i have to move to a dsPIC33EV, unless i want to emulate a peripheral on the pic18 (DMA/IVT will be extremely handy for this).It's a matter of < 8 jumpers to make the board compatible with pic16,18,24 and dspic33EV (the 5V/Automotive ones)and jumpers are needed for the dspic only (one vdd becomes vcap, remove connection to vdd. move programming headers as they become avdd/avss. keep one pin stuck at vdd as it is vdd in the dspic)granted, banked ram is still a mess to deal with, but in the end i'm not sure i would gain any benefit in migrating to a new architecture, neither in power consumption nor in development cost

author: Buriedcode
author_rank: Super Contributor
timestamp: March 13, 2017, 04:58:05 pm
content: Quote from: Bruce Abbott on March 13, 2017, 08:52:58 amAgreed, but my point was about the CPU itself, where *some* calculations or code is required. In recent years I've moved away from using PIC's as the 'main processor' in small applications (even where 8-bit would probably do just fine) and just use the PIC's for their peripherals. This is of course, what they are designed for - one rarely uses everything a micro has to offer, but if it costs less than a dedicated ADC, or some glue logic, then a micro does the job. Often replacing several IC's, or off-loading tasks from the main CPU. The consistency in peripherals as well as the 'standard pinouts' are good selling points, making selecting the 'right PIC for the job' a piece of piss.I am still hesitant to use a PIC as an SMPS controller - the hassle of design and reliability for me, doesn't trump the low cost of a dedicated controller, but they certainly do have impressive peripherals that are really pushing integration. The CLC's I thought were a bit of a gimmick a few years ago, but I've found myself using them to hook together oscillators, or mux serial streams, a case of didn't know you needed it until you got it. Built-in opamps and HS comparators, whilst having pretty terrible specs, can often save board space for an LM358 or LM393. The 14 and 28 pin devices have become my 'go to' devices for adding modular functionality to a project.