EEVblog Electronics Community Forum

Electronics => Microcontrollers => Topic started by: expertmax1 on June 26, 2013, 12:00:36 am

Title: PIC equivalent of the M328P ?
Post by: expertmax1 on June 26, 2013, 12:00:36 am
Hey fellow members!

I'm currently working 40 hours a day on some AVR stuff and I like the structure, the simplicity of it all. Buuuut, I would like to learn about PIC. I might buy a PIC programmer and a PIC micro but I have no idea which one to get. I'm not used to the PIC nomenclature.

So I'm looking for PIC alternatives for this :

-> USBTinyISP
-> ATMega328P

Thanks (P.S. : NO PIC VS AVR DISCUSSION !!!)
Title: Re: PIC equivalent of the M328P ?
Post by: Skimask on June 26, 2013, 12:05:56 am
Just go to the microchip website, choose the 8 bit MCUs, use the parametric search for similar features for similar MCU's.
Off the top of my head, 16F88, 18f1320, 12F1840, and a whole load of others in that range.
Title: Re: PIC equivalent of the M328P ?
Post by: expertmax1 on June 26, 2013, 03:47:31 am
Fair enough, is there any USBTinyISP alternative for PIC ?
Title: Re: PIC equivalent of the M328P ?
Post by: Stonent on June 26, 2013, 05:35:37 am
http://www.aliexpress.com/wholesale?SearchText=pic%2Bprogrammer&CatId=0&initiative_id=SB_20130625213111&SortType=price_asc&filterCat=4099%2C400103%2C717&groupsort=1&page=3 (http://www.aliexpress.com/wholesale?SearchText=pic%2Bprogrammer&CatId=0&initiative_id=SB_20130625213111&SortType=price_asc&filterCat=4099%2C400103%2C717&groupsort=1&page=3)

Well there sure are a lot of "PICKit 2"s for sale that are in bright red cases...

I'm sure that's fully legit!

Title: Re: PIC equivalent of the M328P ?
Post by: Stonent on June 26, 2013, 05:37:51 am
(http://www.dhresource.com/albu_322447774_00-1.0x0/pic-kit2-simulator-pickit-2-programmer-emluator.jpg)

Wicrochip?
Title: Re: PIC equivalent of the M328P ?
Post by: JTR on June 26, 2013, 05:48:47 am
For a low cost entry into the pic world you can always buy a dev board that contains a preprogrammed PIC with a bootloader and save on the cost of a separate programmer. There are plenty of these around.
Title: Re: PIC equivalent of the M328P ?
Post by: westfw on June 26, 2013, 07:09:26 am
 
Quote
choose the 8 bit MCUs
Why limit yourself?  Microchip has PIC24 (16bit) and PIC32 (32bit) Pics in DIP28 as well, that are apparently rather more pleasant to program than the 8bit PICs.
Title: Re: PIC equivalent of the M328P ?
Post by: Andreas on June 26, 2013, 06:40:21 pm

So I'm looking for PIC alternatives for this :

-> ATMega328P


The nearest replacement for the ATMega328P in a 28pin case  is the PIC18F2520 in my opinion.
A alternative would be the 24FV32KA302 which has a 12 bit ADC and internal 16 Bit structure.

With best regards

Andreas
Title: Re: PIC equivalent of the M328P ?
Post by: Jeroen3 on June 28, 2013, 09:13:18 pm
With PIC 8 bits your not taking a step forward, just sideways.
Go ahead and explore the ARM Cortex-M0.

If you need DIP, you'll be having a hard time, but there are a few.
Title: Re: PIC equivalent of the M328P ?
Post by: cthree on June 28, 2013, 11:36:58 pm
With PIC 8 bits your not taking a step forward, just sideways.
Go ahead and explore the ARM Cortex-M0.

If you need DIP, you'll be having a hard time, but there are a few.

I'd agree. If you know the AVR platform then learning PIC is redundant, they are just two sides of the same coin. If you want to expand your horizons I agree that ARM is your logical next step.
Title: Re: PIC equivalent of the M328P ?
Post by: Stonent on June 28, 2013, 11:45:11 pm
I hadn't put a whole lot of thought into it but this looks pretty interesting:

http://www.arm.com/products/processors/cortex-m/cortex-m0.php?tab=Moving+from+8/16-bit (http://www.arm.com/products/processors/cortex-m/cortex-m0.php?tab=Moving+from+8/16-bit)

Quote from: ARM.COM
Instruction width

It is a common misconception that 8-bit microcontrollers use 8-bit instructions and ARM Cortex-M processor-based microcontrollers use 32-bit instructions. In reality for example, the PIC18 and PIC16 instruction sizes are 16-bit and 14-bit respectively. For the 8051 architecture, although some instructions are 1 byte long, many others are 2 or 3 bytes long. The same also applies to 16-bit architectures, where some instructions can take 6 bytes or more of memory.

The ARM Cortex-M processors utilize the ARM Thumb®-2 technology which provides excellent code density. With Thumb-2 technology, the Cortex-M processors support a fundamental base of 16-bit Thumb instructions, extended to include more powerful 32-bit instructions. In many cases a C compiler will use the 16-bit version of the instruction unless the operation can be carried out more efficiently using a 32-bit version.

Instruction efficiency

This picture is not complete without also considering that ARM Cortex-M processor instructions are more powerful. There are many circumstances where a single Thumb instruction equates to several 8/16-bit microcontroller instructions; this means that Cortex-M devices have smaller code and achieve the same task at lower bus speed.

And they follow with what appears to be a worst case scenario example where 31 8 bit assembly instructions are replaced by a single ARM instruction.
Title: Re: PIC equivalent of the M328P ?
Post by: mikeselectricstuff on June 28, 2013, 11:51:39 pm
With PIC 8 bits your not taking a step forward, just sideways.
Go ahead and explore the ARM Cortex-M0.

If you need DIP, you'll be having a hard time, but there are a few.

I'd agree. If you know the AVR platform then learning PIC is redundant, they are just two sides of the same coin. If you want to expand your horizons I agree that ARM is your logical next step.
The PIC32 range is pretty comparable to many low to mid-end ARMs, and have some DIP and low-density SMD options. You can use the same programmer/debug tools throughout the range from 8 to 32 bit. Many of the peripherals are also very similar.

In practice the differences between peripherals are far greater than between core architectures. Going from, say PIC32 to ARM isn't much different than from, say  NXP ARM to Atmel ARM.
 
Title: Re: PIC equivalent of the M328P ?
Post by: hans on June 29, 2013, 09:25:13 pm
If you really must get use an 8-bit PIC, and must find a functional equilevant of the 328P, then find a PIC18 with:
- 2kB RAM
- 16k or 32k FLASH words
- 12/16MIPS (although, if this is really critical, go for an another architecture instead)
- Works at 5V too..

If I do a quick search, you probably end up with a PIC18F26K22/K80.

From my experience, AVR and PIC are basically the same. I don't mind PIC's, but in general I find AVR's easier to pick up and play with.
PIC's sometimes have a scratch-your-head-for-some-time-why-this-doesn't-work problem, although that could also be experience with the devices..

However, the principles of both chips are the same. They have a CPU that runs instructions (although architectures differ), with peripherals that have a couple of registers that need to be set correctly. Both provide documentation on how to do that, and that's about it.

Moving to a PIC24/dsPIC33/PIC32 is not much different.. the CPU's run faster, more memory, the devices typically get bigger (because they tend to be used for bigger applications), and contain more peripherals/features. There are (plenty) of devices still available in DIP though.

ARM is a bit different, with a different architecture, more advanced and has it's advantages and disadvantages. If you really want to learn something different, pickup an ARM toolchain & devboard.
Title: Re: PIC equivalent of the M328P ?
Post by: amyk on June 30, 2013, 10:16:37 am
Quote
choose the 8 bit MCUs
Why limit yourself?  Microchip has PIC24 (16bit) and PIC32 (32bit) Pics in DIP28 as well, that are apparently rather more pleasant to program than the 8bit PICs.
He asked for an equivalent to an 8-bit, so that's what he got...

PIC32 is actually MIPS which is another (rather smaller) competitor to ARM, and in the same league.
Title: Re: PIC equivalent of the M328P ?
Post by: glatocha on July 03, 2013, 01:23:19 pm
Quote from: ARM.COM
Instruction width

It is a common misconception that 8-bit microcontrollers use 8-bit instructions and ARM Cortex-M processor-based microcontrollers use 32-bit instructions.

Really? is it a COMMON misconception?
Those marketing guys do think we are stupid.
Title: Re: PIC equivalent of the M328P ?
Post by: glatocha on July 03, 2013, 01:29:40 pm
Hey fellow members!

I'm currently working 40 hours a day on some AVR stuff and I like the structure, the simplicity of it all. Buuuut, I would like to learn about PIC. I might buy a PIC programmer and a PIC micro but I have no idea which one to get. I'm not used to the PIC nomenclature.

So I'm looking for PIC alternatives for this :

-> USBTinyISP
-> ATMega328P


For smallest PIC with USB there is 14pin 16F1454. If you don't mind 20 pin there is really cool LowPinCount USB Dev Board (used to be possible to buy with PicKit3 - don't know if still).
I like this board as there is a lot of space for own soldering and for each pin you can solder triple headers.
Also USB framework from Microchip is in my opinion quite friendly. For simple COM port simulation on PC side.

Good Luck
Title: Re: PIC equivalent of the M328P ?
Post by: andersm on July 03, 2013, 01:30:30 pm
Those marketing guys do think we are stupid.
Even hang around on a programming forum?
Title: Re: PIC equivalent of the M328P ?
Post by: glatocha on July 03, 2013, 01:40:18 pm
Those marketing guys do think we are stupid.
Even hang around on a programming forum?

Probably yes, but why you asking?
Title: Re: PIC equivalent of the M328P ?
Post by: andersm on July 03, 2013, 06:24:48 pm
Those marketing guys aren't completely wrong.
Title: Re: PIC equivalent of the M328P ?
Post by: c4757p on July 03, 2013, 06:29:29 pm
There are two classes of programmers: Ones who care how the computer actually works, and ones who don't give a rat's ass. Both groups manage to be successful in slightly different fields. I would fully expect the latter group to hold this misconception; if any in the former group do, they need to be beaten with their keyboards.

To judge which group a programmer is in, offer him a cup of "java". If he cringes violently, he's in the former group. :P
Title: Re: PIC equivalent of the M328P ?
Post by: Jeroen3 on July 05, 2013, 10:07:24 pm
Or ask him about See Sharp. (C#, Microsoft's version of Java)
But I think you can expand category one to those that use C the same as on computers, with floats and printf's on an arduino atmega.

If you ask any chip manufacturer what they have to offer instead of an Atmega328p, most of them will point to their 32 Bit, low pin count packages, eg lqp48 with a cortex m0.
8-Bit is getting out of fashion. But be aware, 32 Bit will have its day in 2038.

But reading all of above makes me think he just switched from lane instead of car and now uses PIC.
Rather identical, but not getting you anywhere faster. I'm not going to to light the pic-avr flame.
Title: Re: PIC equivalent of the M328P ?
Post by: cthree on July 06, 2013, 04:24:42 am
Claims of the death of 8 bit micro controllers are greatly exaggerated.
Title: Re: PIC equivalent of the M328P ?
Post by: JTR on July 06, 2013, 07:44:59 am
Those marketing guys do think we are stupid.
Even hang around on a programming forum?

 :-DD
Funniest thing I have read on the web for the last month.   :-+
Edit: Actually... Has it been in month since I read the C Vs ASM thread?  :scared:
Title: Re: PIC equivalent of the M328P ?
Post by: nctnico on July 06, 2013, 10:29:04 am
Claims of the death of 8 bit micro controllers are greatly exaggerated.
I wouldn't be sure about that. I haven't used one in a design for over 15 years!
Title: Re: PIC equivalent of the M328P ?
Post by: amyk on July 06, 2013, 11:14:17 am
Claims of the death of 8 bit micro controllers are greatly exaggerated.
I wouldn't be sure about that. I haven't used one in a design for over 15 years!
Depends what sort of designs you're talking about...
Title: Re: PIC equivalent of the M328P ?
Post by: glatocha on July 06, 2013, 11:19:47 am
(http://m.eet.com/media/1182386/20130430pcicinsightsmcu562.jpg)

from: http://www.eetimes.com/document.asp?doc_id=1280803 (http://www.eetimes.com/document.asp?doc_id=1280803)

Still there is a lot of space for 8bit. Maybe as "intelligent" peripherals for 32bit, but will see.
Title: Re: PIC equivalent of the M328P ?
Post by: madires on July 06, 2013, 11:51:52 am
To judge which group a programmer is in, offer him a cup of "java". If he cringes violently, he's in the former group. :P

Good code needs strong coffee  ^-^
Title: Re: PIC equivalent of the M328P ?
Post by: madires on July 06, 2013, 12:03:49 pm
Still there is a lot of space for 8bit. Maybe as "intelligent" peripherals for 32bit, but will see.

I think it's more about selecting the right MCU to solve a problem than throwing the latest and greatest at the problem. Or would you use a big fat IGBT to switch a 20mA LED?
Title: Re: PIC equivalent of the M328P ?
Post by: glatocha on July 06, 2013, 12:15:50 pm
Exactly.
On the other hand. If you look at AVR, PIC16/18, MSP430. I think somehow they were always in the same basket. Even if MSP is 16bit

So I guess for most app, those ALU size is not so important.
Title: Re: PIC equivalent of the M328P ?
Post by: westfw on July 09, 2013, 07:52:44 am
Quote
http://www.eetimes.com/document.asp?doc_id=1280803
I don't think I trust a "survey" that lumps together 4-bit and 8-bit microcontrollers, to have said anything meaningful about 8bit micros.
Title: Re: PIC equivalent of the M328P ?
Post by: nctnico on July 09, 2013, 11:00:56 am
Still there is a lot of space for 8bit. Maybe as "intelligent" peripherals for 32bit, but will see.

I think it's more about selecting the right MCU to solve a problem than throwing the latest and greatest at the problem. Or would you use a big fat IGBT to switch a 20mA LED?
Its more efficient to specialise on one MCU range from one supplier than to use several different MCUs and know little about each of them. If you choose ARM then you can choose from 8 pin DIP devices to 200+ pin BGA devices without needing different tools, programmers or different libraries. The only exception is low power which is where MSP430 comes in.
Title: Re: PIC equivalent of the M328P ?
Post by: madires on July 09, 2013, 01:36:34 pm
I think it's more about selecting the right MCU to solve a problem than throwing the latest and greatest at the problem. Or would you use a big fat IGBT to switch a 20mA LED?
Its more efficient to specialise on one MCU range from one supplier than to use several different MCUs and know little about each of them. If you choose ARM then you can choose from 8 pin DIP devices to 200+ pin BGA devices without needing different tools, programmers or different libraries. The only exception is low power which is where MSP430 comes in.

Of course everyone has his favourite, well known and convenient MCU. But based on project constraints we have to choose another MCU sometimes. And I bet, you had another favourite before working with ARM :-)
Title: Re: PIC equivalent of the M328P ?
Post by: nctnico on July 09, 2013, 05:39:49 pm
Except for low power I'd like to hear constraints which rule out ARM... Thats the whole beauty of today's world. You don't need to make do with crappy & slow architectures which are just in the way of getting work done. I have build projects around Z80 processors, 8051, Hitachi H8/300(0), 68HC11 and probably some others I have forgotten. Nowadays I can do 95% of the projects with ARM based controllers and if I need low power then I use an MSP430. Maybe some projects are so simple I could get away with PIC, AVR, Attiny but those don't give any financial advantage. In most cases using an ARM has other benefits like fast PWM which make life much easier and strongly reduce external component count. For one of my customers I have developed a keypad with touch sensors. Because I can sample and process at relatively high speed there are only a few capacitors on the board. All the signal processing (anti-aliasing filtering) is done inside an ARM controller. I started the design with an I2C adc and analog comparators but the ARM controller is cheaper than the I2C ADC alone and the software people have less work if the ARM controller can deliver the data in a form which is directly useable. Last but not least the ARM controller is perfectly happy with 1.8V.
Title: Re: PIC equivalent of the M328P ?
Post by: amyk on July 09, 2013, 09:19:36 pm
Except for low power I'd like to hear constraints which rule out ARM...
...and cost.
Title: Re: PIC equivalent of the M328P ?
Post by: westfw on July 09, 2013, 10:44:29 pm
Quote
Its more efficient to specialise on one MCU range from one supplier than to use several different MCUs
Yes.  Personally, I really like learning about different MCUs, but I'm finding it very frustrating how "scatter brained" that leaves me.

Quote
If you choose ARM then you can choose from 8 pin DIP devices to 200+ pin BGA devices without needing different tools, programmers or different libraries.
Quote
Unfortunately, this is pretty much an illusion.  All your experience on the 8-pin NXP CM0+ chips is going to be pretty worthless on a STM CM4 chip, and that in turn will be useless on the CA8 system running droid or linux (and that won't help much on those iPad/iPhone apps.)
The (recommended) tools aren't the same (they COULD be, sort of, in the same sense that those tools also work on AVR and MSP430.  (gcc and eclipse, right?  No problem!  Hah!))  The libraries aren't the same (except for the tiny core of CMSIS stuff, and everybody copies posix/etc), and even the philosophy changes drastically, especially if there is an OS involved.)

That's one of the reasons I mentioned the PIC24 and PIC32 chips over the PIC16/PIC18.  If you get to the point where "I have a chip with a surplus of memories that I can program in C without awful compromises", you've probably passed the biggest step toward "everything is the same" that you'll see.  I'd put ARM, MSP430, PIC24, PIC32, AVR, and MIPS over that line, but probably not PIC18...
Title: Re: PIC equivalent of the M328P ?
Post by: nctnico on July 09, 2013, 11:14:04 pm
Except for low power I'd like to hear constraints which rule out ARM...
...and cost.
ARM controllers can beat or match the prices of most 8 bit controllers. But be sure to look at the entire cost of the design and not just the part itself! NXP has announced the new LPC800 device (already sampling) will start at 39 cents.

@westfw: you have to stick with the same supplier ofcourse. Unfortunately every supplier uses their own peripherals. I have been using ARM7TDMI devices from NXP for many years and when the new Cortex Mx devices from NXP came I could use 99% of my existing code. IOW: the peripherals are mostly the same which NXP did on purpose. But then again, the peripherals from NXP already where superb. I once made a project with an STR700 (also ARM7TDMI) from ST and the peripherals in that microcontroller are a complete joke.
Title: Re: PIC equivalent of the M328P ?
Post by: jebcom on July 10, 2013, 02:36:19 am
Quote
NXP has announced the new LPC800 device (already sampling) will start at 39 cents.
This is very interesting:
LPC800: Switch Matrix Configuration (https://www.youtube.com/watch?v=illRLotwk5s#ws)
I wonder how many PIC part numbers each LPC800 can replace.
Title: Re: PIC equivalent of the M328P ?
Post by: westfw on July 10, 2013, 05:36:39 am
I do have a bit of an aversion to 28pin microcontrollers that end up spending 7+ pins on power, 3 pins on dedicated functions (OSC, RST), and 4+ pins for JTAG ("You can turn off JTAG, but you might not ever be able to program the chip again.")  (The particular chip I'm talking about here is the LM3S102; one of the very first CM3 aimed at "microcontroller applications."  Manufacturers have gotten better since then; the latest NXP8xx series chips look quite reasonable.)
Title: Re: PIC equivalent of the M328P ?
Post by: madires on July 10, 2013, 11:36:40 am
Except for low power I'd like to hear constraints which rule out ARM...

Here we go:
- We got a million of MCU X in the warehouse.
- We got a strategic partnership/alliance with MCU vendor X.
- The boss' new sportscar was paid by MCU vendor X.
- The boss' wife says that MCU X got a cute logo.
Title: Re: PIC equivalent of the M328P ?
Post by: Rufus on July 10, 2013, 12:13:11 pm
Quote
NXP has announced the new LPC800 device (already sampling) will start at 39 cents.
This is very interesting:
LPC800: Switch Matrix Configuration (https://www.youtube.com/watch?v=illRLotwk5s#ws)
I wonder how many PIC part numbers each LPC800 can replace.

If you are talking about the switch matrix many Microchip parts have had peripheral pin select for ages.

If you are talking about the tool I just find it depressing that anyone thought it was worth spending time developing or making a video bragging about it. The generated code is gibberish.
Title: Re: PIC equivalent of the M328P ?
Post by: JTR on July 10, 2013, 01:56:03 pm
I do have a bit of an aversion to 28pin microcontrollers that end up spending 7+ pins on power, 3 pins on dedicated functions (OSC, RST), and 4+ pins for JTAG ("You can turn off JTAG, but you might not ever be able to program the chip again.")  (The particular chip I'm talking about here is the LM3S102; one of the very first CM3 aimed at "microcontroller applications."  Manufacturers have gotten better since then; the latest NXP8xx series chips look quite reasonable.)

Whatever you do then, don't try to use the 28-pin PIC32MX in USB OTG configuration.  :scared:
Title: Re: PIC equivalent of the M328P ?
Post by: nctnico on July 10, 2013, 03:28:12 pm
Except for low power I'd like to hear constraints which rule out ARM...

Here we go:
- We got a million of MCU X in the warehouse.
- We got a strategic partnership/alliance with MCU vendor X.
- The boss' new sportscar was paid by MCU vendor X.
- The boss' wife says that MCU X got a cute logo.
- Scrap 'm. Its cheaper anyway.
- A good reason for vendor Y to get you a better deal
- Vendor Y can provide a big boat AND a sportscar AND a boob job for the boss' mistress
- How about the boss' mistress?
Title: Re: PIC equivalent of the M328P ?
Post by: fcb on July 10, 2013, 03:40:24 pm
Reminds me of a tale an FAE told me many years back, it went (allegedly) something like this:

***** introduces new PIC killer micro (**?), and gives £10K to anyone that designs it into a volume product - to help get existing products changed over from a PIC (16C54?) ***** deliberatly designed the ** micro to have the same pin-out but spun through 180. The theory is you chuck out the PIC and put in the ** the other way round.

All good, until ***** couldn't deliver on a new BIG contract for a household white goods manufacturer due to some process issue or other.  Along rides Microchip, suggests turning their part through 180 and saved the day...

Title: Re: PIC equivalent of the M328P ?
Post by: jebcom on July 10, 2013, 05:48:03 pm
Quote
If you are talking about the switch matrix many Microchip parts have had peripheral pin select for ages.

If you are talking about the tool I just find it depressing that anyone thought it was worth spending time developing or making a video bragging about it. The generated code is gibberish.
With the PIC parts that I've used, each pin has certain functions that you can select. I don't see it as a matrix. I thought it was interesting in that I might be able to avoid some of the pin function conflicts that I've run into with PICs. I can't always get the combination of peripheral functions that I need. Maybe the NXP stuff is just marketing hype and it's no more flexible than PICs; I don't know.

The tool reminds me of the configuration tools that came out in the early days of PowerPC. If you didn't want to make project out of just getting the thing configured, you could buy a tool to make it quicker. But you need to trust the tool and its comments; if you want to make a change, go back to the tool. You can ignore the gibberish and understand the comments, but that's a personal preference. But of course if somebody changes the random-looking hex value without updating comments, you're hosed.

Title: Re: PIC equivalent of the M328P ?
Post by: nctnico on July 10, 2013, 05:52:39 pm
Reminds me of a tale an FAE told me many years back, it went (allegedly) something like this:
***** introduces new PIC killer micro (**?), and gives £10K to anyone that designs it into a volume product - to help get existing products changed over from a PIC (16C54?) ***** deliberatly designed the ** micro to have the same pin-out but spun through 180. The theory is you chuck out the PIC and put in the ** the other way round.
Putting paperware or devices still in their sampling state in a design is never a good idea. Better wait until companies like Farnell, Digikey, etc have the parts in stock c.q. for sale. A good electronics designers knows that (or will learn the hard way).
Title: Re: PIC equivalent of the M328P ?
Post by: Rufus on July 10, 2013, 06:15:47 pm
Quote
If you are talking about the switch matrix many Microchip parts have had peripheral pin select for ages.
With the PIC parts that I've used, each pin has certain functions that you can select. I don't see it as a matrix.

A tedious and 4 year old presentation on PPS from Microchip

What is Peripheral Pin Select (https://www.youtube.com/watch?v=KZcL8cjqphE#)

The first parts had it in 2007.
Title: Re: PIC equivalent of the M328P ?
Post by: nctnico on July 10, 2013, 08:55:11 pm
Thats pretty late. The H8/300 and H8/3000 series from Hitachi already had multifunction pins and I used those in 1997.