Confusion between Arduino and PIC, Which one is better for learning?

Thread Starter

alex.will

Joined Jan 13, 2021
16
Hi I am new in this field and want to learn programming for Embedded but I am confused between arduino and PIC, which one is better to learn for carrier growth and as per industry demand?
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
I have never used the Arduino, just individual Picmicro's now.
As far as I can tell an Arduino began as a easy tool for fast prototyping, aimed at students without a background in electronics and programming.
If you want to get into learning micro's in some depth, then learn initially through Assembly programming.
There are sites such as Nigel Goodwin tutoriols, or Gooligum series.
Max.
 

MrChips

Joined Oct 2, 2009
30,708
If you want to get in on the ground floor and work your way up in the embedded market, learn how an MCU works and how to program in ASM.

The original Arduino is based on an Atmel ATmega328 MCU. If you want the best of both worlds, start off by learning to program any Atmel AVR chip and you can transfer that knowledge to Arduino to your advantage.

In way of an analogy, suppose you want to become an automotive engineer. The VW Beetle is like the Arduino in the automobile market. Would you want to learn how to drive a VW Beetle or how the internal combustion engine works?
 

nsaspook

Joined Aug 27, 2009
13,081
To really learn Programming for Embedded you need to first learn the underlying hardware and the physical rules for what the embedded system controls. You then use a programming language/software to implement an embedded control system. The level (ASM to HLL) of language you select for the task is usually secondary if the selected language has the features necessary to implement and control the functions you need. The actual programming is sometimes the most frustrating part of the project because there are usually many ways to do the same thing, with nearly infinite possible interactions with other parts unless software design, language selection and programming implementation are all executed carefully.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,156
I agree with the comments above. For your objective, you need to learn advanced concepts which the Arduino platform purposefully hides from you. The Arduino has its place. I am an Arduino advocate, but it’s perfect for my applications but one, which I hope to migrate soon.

I’m replying to you representing the Arduino perspective.

So please seriously consider the other advice given you.
 

BobTPH

Joined Jun 5, 2013
8,812
Are you already competent in programming? If not, neither is the best place to learn programming. You are better off learning on a PC or MAC, where hardware considerations are minimized. Once you are comfortable with programming, the take on embedded.

Bob
 

upand_at_them

Joined May 15, 2010
940
PIC is a microcontroller. Arduino is a development board and platform that, as mentioned, was designed for non-engineering people (actually an art/design school). They're not the same thing. Arduino boards mostly contain Atmel microcontrollers.

Arduino has libraries for everything. Seriously, if you want to do something, someone has made a library for it already. Microchip does have libraries for PIC's, but there are almost no third-party libraries...so if Microchip didn't create the library, you're out of luck.

Forget assembly. While I do program in assembly for PIC's sometimes, I don't recommend it for beginners. Microchip doesn't even recommend it, as they're pretty much dropping support for it. They want people using their C compiler.

Arduino was designed from the ground up to be C optimized. PIC was not. Maybe that's going to change now that Microchip bought Atmel. Professional PIC developers are only rarely using assembly - visit the Microchip forums and see - they're largely using C. And as microcontrollers continue to get more powerful - and more C optimized - the small benefit from assembly will continue to diminish. This isn't 1970, there's no reason to know assembly anymore.

If I want to do something quick, to test an idea or a new sensor/module, I whip it up in Arduino. I tend to make finished projects with PIC's, though, as they have lots of great on-board peripherals and I'm quite used to programming them (15+ years).
 

MrChips

Joined Oct 2, 2009
30,708
I disagree. I teach MCU and embedded programming. The first thing we teach is ASM before moving on to C. You cannot appreciate C code unless you have an intimate knowledge of how the MCU hardware works. Some C programmers don't know the difference between a byte, word, and long word because they never took the effort to learn it. My 2 cents.
 

djsfantasi

Joined Apr 11, 2010
9,156
I disagree. I teach MCU and embedded programming. The first thing we teach is ASM before moving on to C. You cannot appreciate C code unless you have an intimate knowledge of how the MCU hardware works. Some C programmers don't know the difference between a byte, word, and long word because they never took the effort to learn it. My 2 cents.
I understand where you are coming from. It’s hard for me to understand, because I learned ASM (self-taught) on the original TRS-80. And my college education (early 70s) we had to write an assembler for a mythical machine (creating an assembler in BASIC. A little irony). So, I had the background. And after 50 years of coding, sometimes it’s hard to understand how anyone doesn’t know the basics.

But I have a gut feeling that the insistence on learning ASM first is not the solution to the problem. The solution is better resources for learning C that emphasize the basics. Bytes versus words. Variable types (byte, char, short, int, long and float) and their representation. Twos Complement. Encoding schemes, where one learns that internally “A”, 65, 0x21 and 00100001 are all equal! You don’t need to be able to code in ASM to understand these concepts.
 

upand_at_them

Joined May 15, 2010
940
I disagree. I teach MCU and embedded programming. The first thing we teach is ASM before moving on to C. You cannot appreciate C code unless you have an intimate knowledge of how the MCU hardware works. Some C programmers don't know the difference between a byte, word, and long word because they never took the effort to learn it. My 2 cents.
Just because you teach it that way doesn't mean it's the best way. Lots of things aren't taught the best way. Take a look at Prof. Land's classes at Cornell. See if he teaches his students assembly at all. I bet MIT teaches C first, probably not assembly at all. There's only so much time. They want to get those kids up and running.

Who cares about having an intimate knowledge of how the MCU works? Operating systems aren't programmed in assembly either. The whole point of a programming language is to abstract out the stuff you don't need to know.

I know more programming languages that most programmers. And programming in assembly is just a barrier to getting things done. I don't care that it gives me an intimate knowledge...that just isn't important. It WAS important, decades ago, when getting every little bit out of the precious processor was necessary.

Sure, some C programmers don't know all the variable differences. So? Bad programmers exist. It's a normal distribution, just like everything else.

Focusing on the minute details first is backwards. First you generalize, THEN you focus down...IF that becomes necessary.

(Not intending to sound harsh, just blunt.)
 

nsaspook

Joined Aug 27, 2009
13,081
Programming in ASM on a 8-bit pic is not that complex so I would recommend it for the embedded programming learning experience if you've never programmed any device at that level. If you already have ASM experience on any device then I would skip the ASM programming learning step on a controller unless it was a resource requirement. What you need as a embedded programmer is NOT absolute programming skills for typical user applications normally taught in a programming class as symbolic logic operations for X symbolic result. What you need is the ability as a embedded guy that does programming is to translate physical properties into computer usable properties for digital manipulation back into physical properties. Too much abstraction beyond data structures IMO muddies the mental process at the small controller level dealing mainly in bits, bytes and integers..
 

jpanhalt

Joined Jan 18, 2008
11,087
Arduino has libraries for everything. Seriously, if you want to do something, someone has made a library for it already. Microchip does have libraries for PIC's, but there are almost no third-party libraries...so if Microchip didn't create the library, you're out of luck.
PICList.com (http://www.piclist.com/techref/piclist/index.htm) is a great resource for various routines and is mostly in MPASM. Of course, as the crowd has moved to C, that resource is less active, and most of its code is written for the earlier chips. Translating to the newer chips is not difficult, and it will run on them without modification.

As for plug and play projects, I would agree there are much fewer today in Assembly than in C. It all depends on whether one wants to just assemble kits or branch out on his own.
 

MrChips

Joined Oct 2, 2009
30,708
Sure, some C programmers don't know all the variable differences. So? Bad programmers exist. It's a normal distribution, just like everything else.

Focusing on the minute details first is backwards. First you generalize, THEN you focus down...IF that becomes necessary.
I don't buy that.

There are good people and there are bad people. There are good workers and there are bad workers. There are good administrators/leaders and there are bad administrators/leaders. If you are under-performing then you get retrained or you are fired.

I see this in today's goal oriented mentality. You want to get there fast and you don't care how you got there. You just want results. You are not willing to do the sweat and grunge work that is required to learn and do the job properly.
 

strantor

Joined Oct 3, 2010
6,782
If you want to get in on the ground floor and work your way up in the embedded market, learn how an MCU works and how to program in ASM.

In way of an analogy, suppose you want to become an automotive engineer. The VW Beetle is like the Arduino in the automobile market. Would you want to learn how to drive a VW Beetle or how the internal combustion engine works?
I like the automotive analogy. If you wanted to learn how cars work, would you be better off buying an engine (PIC) or a project car (arduino)? Either answer could be correct depending on how you define your goals. If you want to learn in general all aspects of automotive engineering, you would learn a whole lot more by buying an engine and building a car up around it. But if your goal is to study how to improve suspension travel then rebuilding carburetors would be a waste of time.
 

BobTPH

Joined Jun 5, 2013
8,812
Okay, I’ll throw in my 2 cents.

I think learning a high level language first is better because it teaches you about control flow and data organization right from the start.

It is much better to think of your program i. terms of if statements and loops rather than of labels and branch instructions.

Same for data, high level languages teach us about arrays and structures, not about address calculations.

Bob
 

MrChips

Joined Oct 2, 2009
30,708
Yes, there are good reasons for learning HLL first. But failing to learn ASM at some stage could hinder your development into embedded systems.

(As an aside, how does one understand pointers in C without grasping the concept of indirect addressing?)
 

Deleted member 115935

Joined Dec 31, 1969
0
Arduinos are a sort of half way house between a PIC and a "full" board such as a Raspberry Pi

Arduino, you program in a C format,
the environment takes care of a lot of stuff,
You have interrupts, GPIO , i2C, SPI , ram etc all well defined, and easy to use.
Depending which Arduino you chose, they can easily clock at 600 MHz,
e.g. https://www.pjrc.com/store/teensy40.html

PICs are a lot lower level to program,
You probably need to be into Assembler to use the small ones,
the larger you have the C environment,

If you can program a PIC, you should have no problems learning an Arduino, but on the other way round,.

It depends what your aim is
there are millions of people who have learnt PIC, and for there projects that's fine,
there are millions of people who program Arduinos, and for there projects that's just fine

I'd say , getting to a place that you have something useful , starting from zero, an Arduino is probably better,
PIC will never do you wrong, but it might take a while to get more than a led flashing.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
Well I for one am not sorry of the journey & grounding I experienced in assembly where there was virtually no choice when dealing with such as the PDP11 and Intel 8080/8085.
I Now enjoy using the smaller Picmicro's.
Yes Microchip has pretty much dropped their initial support for Assembly and now concentrate on C in all their new offerings, support programs and tech notes.
Now you do not Have to learn Assembly, but I somehow think those that do not become at least a little familiar with Assembly never really learn the 'natural' language of the device! :rolleyes: .
Max.
 
Top