• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC16 vs PIC18

Jon Wilder

Active Member
Is there really any purpose for the 12F or 16F families anymore? As many goodies as you get on a modern 18F and the price you get them for (the all new 18F27Q84 has LOTS AND LOTS of goodies like 2 full featured/3 limited feature UARTs, 2 SPI/2 I2C, 4 PWM controllers, 8 DMA controllers, a CAN module that supports CAN 2.0 and CAN-FD, vectored interrupts, and a whole host of stuff) and only runs about $1.60. At that price and for as much as you get, is there really even a point to using the 12/16F families anymore?
 

sagor1

Active Member
For most of my little projects, the older 12F and 16F suit me just fine. These are simple controllers doing simple jobs for me. One UART (if needed) is enough. The ram and program space is enough (for me). Even the 16f886 and larger are just too big for some of my simple controllers, they have resources I don't come close to using. I seldom use I2C or PWM. Definitley not DMA (I don;t think the old chips even have that)
Now, if someone is building something that needs multiple UARTs, tons of timers or ram, etc., then go ahead and use bigger chips. However, at that point, the Arduino family suits my needs better. If I ever need more, I'd look at the Teensy series, but so far I've not developed anything that complicated.
I just program for a hobby, to make simple tasks even simpler by using a PIC. For example, a friend had a complex logic gate controller looking at about 6 inputs and driving several outputs (some with delays). I re-designed that with a 20 pin PIC (16F690), and it all fit in place of over a dozen discreete IC's. Doing small delays was no issue. With an UART, he could send commands via serial to test certain outputs. With extra pins, I could turn on LEDs to show status, etc. Using a high end 18F was just to big a chip for me. Besides, I have all the setup for the older chips and don't have an inkling to upgrade everything. If what I have does the job, why upgrade? If I need a lot more, there are other architectures that can do the job.
 

ronsimpson

Well-Known Member
Most Helpful Member
There are little micro projects like the smart switches in flash lights, witches with delays, thermostats, etc, they need no UART, just two in and one out. The little 6 pin micros does the job. There are 8 pin parts so you can have a ADC, timer and some I/O.
 

Jon Wilder

Active Member
For most of my little projects, the older 12F and 16F suit me just fine. These are simple controllers doing simple jobs for me. One UART (if needed) is enough. The ram and program space is enough (for me). Even the 16f886 and larger are just too big for some of my simple controllers, they have resources I don't come close to using. I seldom use I2C or PWM. Definitley not DMA (I don;t think the old chips even have that)
Now, if someone is building something that needs multiple UARTs, tons of timers or ram, etc., then go ahead and use bigger chips. However, at that point, the Arduino family suits my needs better. If I ever need more, I'd look at the Teensy series, but so far I've not developed anything that complicated.
I just program for a hobby, to make simple tasks even simpler by using a PIC. For example, a friend had a complex logic gate controller looking at about 6 inputs and driving several outputs (some with delays). I re-designed that with a 20 pin PIC (16F690), and it all fit in place of over a dozen discreete IC's. Doing small delays was no issue. With an UART, he could send commands via serial to test certain outputs. With extra pins, I could turn on LEDs to show status, etc. Using a high end 18F was just to big a chip for me. Besides, I have all the setup for the older chips and don't have an inkling to upgrade everything. If what I have does the job, why upgrade? If I need a lot more, there are other architectures that can do the job.
I used to think the same way. But what I've realized over the years is that there's no rule that says you must use every on chip resource just because it exists. While an 18F27Q84 may seem like "too much" processor for the project, whatever resources I don't need to use I don't have to. But...the beauty of having extra resources available is that you have room for upgrades through field firmware updates.

My motto nowadays is to use the biggest processor that the budget allows for. And at $1.60 a pop, that's a very affordable device. With the new 18F's peripheral module disable registers, you can disable whichever peripherals you don't need to minimize current draw with just a few instructions.

While I started on the 16F family and can still code for them with my eyes closed in both assembly and C, I started using the 18F devices 5 years ago and haven't used a 16F since.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Both have their place - and many 16F series are pretty high spec these days.

Also, the 18F are considerably harder to set up, with a bewildering array of config options.

Personally I tend to use the 18F27K40 and K42, as they have impressive amounts of memory, plus a number of different 16F series.

From what I gather, the enhanced 16F series came first, with the enhanced facilities making their way later to the 18F series.
 

Jon Wilder

Active Member
Both have their place - and many 16F series are pretty high spec these days.

Also, the 18F are considerably harder to set up, with a bewildering array of config options.

Personally I tend to use the 18F27K40 and K42, as they have impressive amounts of memory, plus a number of different 16F series.

From what I gather, the enhanced 16F series came first, with the enhanced facilities making their way later to the 18F series.
I ordered the 18F27K40 a few months ago and was playing with them for this project as a replacement for the 18F26K22. Then the 18F27Q84 came out, and when I learned it had a CAN interface I got ideas on how to leverage CAN for added features as this is an automotive device. So I switched the project to use the Q84. A bit of a steep learning curve and I'm still figuring things out on it.

Sure there are multiple configuration words to set up, but once you learn the CONFIG words for a given processor, you set them up the same way 9 out of 10 times you code for it and thus can make a default setup template for them, changing the ones you need to.
 

MaxHeadRoom78

Well-Known Member
Is there really any purpose for the 12F or 16F families anymore? As many goodies as you get on a modern 18F and the price you get them for (the all new 18F27Q84 has LOTS AND LOTS of goodies like 2 full featured/3 limited feature UARTs, 2 SPI/2 I2C, 4 PWM controllers, 8 DMA controllers, a CAN module that supports CAN 2.0 and CAN-FD, vectored interrupts, and a whole host of stuff) and only runs about $1.60. At that price and for as much as you get, is there really even a point to using the 12/16F families anymore?
If you only need a application that can be achieved with a 8 pin, why use 18p to 20p IC's??
Overkill!
I have put together a few small projects on a 50mm x 50mm board using 12F's.
Max.
 

Jon Wilder

Active Member
If you only need a application that can be achieved with a 8 pin, why use 18p to 20p IC's??
Overkill!
I have put together a few small projects on a 50mm x 50mm board using 12F's.
Max.
I guess if your only concern is fulfilling only the current needs of the project then sure. But with a larger device, you design for open architecture that can have features added to it with field updates.
 

MaxHeadRoom78

Well-Known Member
I prefer a unique/designated design rather the the Arduino type of systems.
I have a few of the Picmicro development boards if needed.
Max
 

Jon Wilder

Active Member
I prefer a unique/designated design rather the the Arduino type of systems.
I'd like to hear the reasoning behind the unique/designated design aspect.

I'm not talking Arduino type systems at all. Still bare metal programming, just using a larger device to allow room for expansion and upgrades, and maybe even universal self written modules to speed up coding time for future devices.
 

MaxHeadRoom78

Well-Known Member
I don't like any more real estate than needed, I can get qty 10 custom 50mmx50mm boards for $5.00!
Plus the larger the real estate, the more cost for enclosure.!
 

Pommie

Well-Known Member
Most Helpful Member
allow room for expansion and upgrades
Sounds like "feature creep" to me. There's no memory left is a great thing to say when the customer asks for another (new) feature.

When I used to write games, we discovered that finishing early was impossible. If you finish a month early then they (the customer) will add features up until the end date.

My current project uses a 16F18854 which more than fills my requirement. The project is almost finished and I'm using 61% of flash and 46% of ram. Just checked and the 18F24Q10 is 13c cheaper ($0.78 -v- $0.65) so I may consider it for future projects - I just won't tell the customer.

Mike.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Well a quick glance at the 18F27Q84 datasheet shows it's severely lacking in features compared with many other PIC's, if you want CAN it's probably OK?, but otherwise not really worth a look. The 18F27K42 is a much better bet, with oodles more memory and features.
 

Pommie

Well-Known Member
Most Helpful Member
I have to admit, the Q series seems to be fantastic. It's a C64 (less video but much faster) on a chip for less than a dollar!!

Mike.
BTW, I'll admit, I've never filled 16k unless it involved graphic (or other) data. 16K of pure code is huge. Microsoft exempted.
 

Jon Wilder

Active Member
Well a quick glance at the 18F27Q84 datasheet shows it's severely lacking in features compared with many other PIC's, if you want CAN it's probably OK?, but otherwise not really worth a look. The 18F27K42 is a much better bet, with oodles more memory and features.
You must've looked at the wrong PIC because the Q84 beats the K42 in MANY areas. While they both have the same Flash and EEPROM capacities, the Q84 boats 5KB more SRAM than the K42 part.

Here's what the Q84 has that the K42 does not -

13KB SRAM (K42 has 8KB SRAM)
128-level deep hardware stack (K42 is only 31 level deep)
Four 16-bit dedicated PWM Modules, two outputs each, dedicated 16-bit timer, multiple clock and reset source selections, double buffered duty cycle registers
Two universal timers (K42 has none)
5 UARTS, 3 of the 5 UARTS are full featured (K42 only has 2 UARTs with 1 full featured)
CAN-FD Interface
JTAG Boundary Scan
8 DMA Controllers (K42 only has 2)
32-bit CRC Module (K42 is 16-bit)
8-bit Digital to Analog Converter (K42 is 5-bit)
12-bit Analog to Digital Converter w/Computation and Context Switching (K42 has the same sans context switching)
Storage Area Flash

As you can see, the Q84 has quite a bit more features than the K42. The only thing I can see that the K42 part has over the Q84 is one additional 16-bit timer, but the two universal 16-bit timers (which can be cascaded to one 32-bit timer) more than makes up for that.
 

gophert

Well-Known Member
Most Helpful Member
Once you make a high volume commercial product and understand the hidden costs of each square mm of PCB and the number of PCBs per panel and the surcharge for very narrow traces, and the efforts people undertake to save $0.05/device, you'll see the benefit of 6-pin and 8-pin devices.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
You must've looked at the wrong PIC because the Q84 beats the K42 in MANY areas. While they both have the same Flash and EEPROM capacities, the Q84 boats 5KB more SRAM than the K42 part.
Sorry, putting 18F27Q84 in google takes you to the wrong datasheet - you need to enter pic18F27Q84 to get to the correct one.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
957 page datasheet....That said it all... Pommie ! I should imagine the video could be done with the CLC like Sinclair did..
As I'm sure you know, you can run video easily from a PIC32, as the Maximite does, and his Video Terminal does.

While an 18F isn't as powerful, I imagine it should be possible to do something with it? - and of course if you can do time critical bits with the CLC you're not wasting any processing time.
 

fourtytwo

Active Member
Something I don't think has been mentioned about 16F vs 18F is the analogue peripherals (op-amps/comparitors & DAC) & high reselution PWM capability that seems to be a 16F specialty. I use the 16F1782 that I must admit can be a pain to program. I had to move up to the PIC24EP series to get more performance with similar peripherals, maybe there is something in 18F but I skipped it for some reason (could be I was fedup doing 16 bit math on an 8 bit chip).
 

Latest threads

EE World Online Articles

Loading
Top