6 years, 3 months ago.

PIC vs mbed arm lpc 1768

A colleague of mine recently finished a project using mbed arm plc 1768 but his supervisor just told him to change the micro controller to the PIC, UNLESS he can justify why mbed is better than PIC. I need all the help I can get to win this argument! Please feel free put in your two cents and save a hard worker's time and effort!

The Microchip company supplies wide range of PIC microcontrollers.
Please specify the PIC product number.

posted by Yoshi Mimura 13 Mar 2014

3 Answers

6 years, 3 months ago.

As Yoshi said, PIC has a ton of microcontrollers, so you cannot just say the LPC1768 is better because...

Then what for sure is important is the project. Which tasks does the microcontroller have to perform?

Finally, are we talking about a company or a student project? The problem is that with your description I can see two reasons for his question: First is in a company they might do everything on PICs. Then if there is a problem and your collegue doesn't work there anymore, there is a larger chance someone else can fix it for example. Option two is that it is a PIC fanboy, because he always used PIC everyone should. Why is this an option? Because besides option 1 I don't see a reason why you would specifically demand a PIC. It could be that the LPC1768 is way overkill. But then he should have asked for a reason to use a core M3 instead of an 8-bit microcontroller.

6 years, 3 months ago.

The answer is extremely complex and partially depends on the exact PIC device or family in question, but I can speak at a high level about Cortex M vs. PIC. The ARM architecture is superior to PIC in many ways. From a core architecture point of view the load store architecture with 16, 32 bit registers provides an ideal target for 'C' compilers allowing for optimal code generation with reduced code size and higher performance than a PIC. Additional the strict Harvard architecture of a PIC creates a constrained system with limited (if any depending on the family) ability to execute code from RAM, and clumsy mechanisms to access data from flash. In contrast the ARM architecture with it's linear 4GB address space and internal bus switches allows seamless use of flash and SRAM for either code execution or data. Additionally all peripheral resisters are also mapped into this address space so they are accessible to high level languages as simple pointers in 'C' allowing for simplified code development. The interrupt system in the ARM architecture is optimized for low latency interrupt response and efficient implementation of nested interrupts from multiple sources. In addition fully programmable interrupt level (16 interrupt priorities on a LPC1768), by interrupt source allows a developer to optimize the system architecture. Contrast this to the rather limited interrupt capabilities of most PIC devices where the developer has to use great care to work within the inflexible interrupt priority system to attain adequate interrupt latency. The debug capabilities of a LPC1768 are far beyond what is available on PIC. Along with basic breakpoints the LPC1768 also provides data breakpoints and in conjunction with the Data Watchpoint and trace unit can implement unobtrusive data watchpoints and through the DAP (with the proper debugger and development tools) allow access to all internal memory while the processor is running. Lastly the LPC1768 implements the Embedded Trace Macrocell which provices unobtrusive, full speed instruction trace for efficient debug of complex problems. The benefits of a ARM based device can be best articulated when more details are know such as particulars of the application and the exact PIC device in question so these are generalities so if you can provide more detail I can be more specific as this is just the high level benefits.

6 years, 3 months ago.

The project in question is a single axis solar tracker, employing a stepper motor, two LDRs for tracking the sun, and a two AA battery charger through the panel. The battery charge status will be displayed on the LCD through the microcontroller.

Any help to put the argument in my favor will be greatly appreciated!

Well the LPC1768 is a bit on the overkill side of things for that. But is it a student project, a one-of-a-kind company project, or intended for mass production?

Depending on which PWM pins you are using it might even be possible to directly replace the LPC1768 with an LPC11u24 if that makes someone feel better because it is more power efficient. The main question is though: Why does that supervisor say it should be made with a PIC?

posted by Erik - 14 Mar 2014

It's a student project, and the supervisor argued that PIC is cheaper, so why spend more.

posted by Mohamed Sulaiman 14 Mar 2014

At this point, the LPC1768 is free: you already have it. Using something that you already have negates the cost. It would cost more to buy a PIC to re-implement the project. If this were in the proposal stage, where you're evaluating options, that would be one thing.

Consider also that the project is done and it works. If the prof is really worried about cost, then he'd consider the cost of buying a new part and re-implementing the entire project on the new chip - and risking potential defects - just for the sake of using a PIC.

If you were to mass produce it, Ok, maybe the prof would have a point. But you're done, and it works. At this point, anything else is just overrun, which is most definitely a cost.

Was there anything in the project requirements that said you had to use a PIC?

posted by Aaron Minner 15 Mar 2014

Well I haven't exactly finished the project, I am currently at programming stage. The LPC1768 I have is borrowed from the Uni, and if I probably want one that would be dedicated to the project, I might have to order my own. And because there is a limit of 75 pounds per project there is a cost issue. How much would a PIC cost that could replace the LPC1768?

posted by Mohamed Sulaiman 15 Mar 2014

The PIC itself? Pretty much nothing. Just as the LPC1768 is fairly cheap. Although you would also require a programmer. And from a business perspective the cost of the time to change everything to a PIC is also huge.

Only if he was worried about cost, why specifically require a PIC? I know the Chinese are even copying AVR's, so why no Chinese AVR rip-off, that is surely cheaper.

What I would propose to them if they worry about the cost: Switch to one of the Freescale boards: http://mbed.org/platforms/?tvend=4. They are sold via Farnell and similar ones, and I assume your university can easily order from those. They are something like 7-8 pound, and that is including programmer, debugger, all passives, and USB <> Serial bridge. You can use pretty much the same code, you only need to change some pin names, and the cost is alot less.

posted by Erik - 15 Mar 2014

Hmm that is interesting, I will look in to it. Thank you

posted by Mohamed Sulaiman 15 Mar 2014

I was looking at FRDM-KL46Z, the one with the LCD, I am using the LCD in my project for battery status indication, is the LCD on this platform capable of displaying the charge status in anyway while the microcontroller gets feedback from the batteries? And will the stepper motor and LCD libraries be the same for FRDM-KL46Z as it was for LPC1768?

posted by Mohamed Sulaiman 15 Mar 2014

I've done some work on both the LPC1768 and the KL25Z, and, as Erik mentioned, it was a matter of changing pin names, for the most part. The libraries used - Serial, etc - are the same.

posted by Aaron Minner 16 Mar 2014