Author Topic: Microcontrollers for beginners  (Read 7231 times)

0 Members and 1 Guest are viewing this topic.

Offline M.Zohaib UsmanTopic starter

  • Supporter
  • ****
  • Posts: 26
  • Country: ca
Microcontrollers for beginners
« on: April 14, 2021, 07:14:33 pm »
Hey everyone! I just completed my Arduino course and was planning to move onto something more professional like ATmega or PIC microcontrollers and processors. Can you guys please suggest which is the best place to start from? please let me know about different programming devices like Pickit and stuff im totally confused with them. Thanks in advance
Student Electronics Engineer. Working on Several different projects ATM. Hit me up if interested
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5890
  • Country: es
Re: Microcontrollers for beginners
« Reply #1 on: April 14, 2021, 08:42:40 pm »
I'd start with Microchip. A low end device like a pic16 or pic12 series, with few peripherals to not get overwhelmed at first.
MplabX is actually pretty good, the libraries are simple, and microchip forums are a great source of information.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: M.Zohaib Usman

Offline tmadness

  • Regular Contributor
  • *
  • Posts: 83
  • Country: us
Re: Microcontrollers for beginners
« Reply #2 on: April 15, 2021, 05:34:47 am »
A few things for your continued learning:
What is the extent of your understanding of how a microcontroller works inside ? Do you know what a memory mapped register is for example? Can you program a spi/timer/i2c/uart peripheral using a datasheet and registers?
If you answered no to the above then I would suggest stick with the atmega 328/arduino that you are probably using and rewrite your learned examples from the ground up. If you want to just move onto a more powerful platform, I suggest you look into the Teensy series. All the currently supported Teensy are ARM mcus from freescale/NXP.
 
The following users thanked this post: M.Zohaib Usman

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Microcontrollers for beginners
« Reply #3 on: April 15, 2021, 05:40:33 am »
You can go a long way with Arduino, the next step is probably standard C rather than the bastardized flavor of C++ Arduino uses. The specific hardware is not particularly important, you can even use the same atmega parts the Arduino uses. What is important is learning the language, once you know C well you can easily transition to a different microcontroller family. When you want to step up from there, STM32 seems to be the future. They're complex parts with datasheets hundreds of pages long so there's a lot to learn but it's still C.
 
The following users thanked this post: AmnevaR, M.Zohaib Usman

Offline Lindley

  • Regular Contributor
  • *
  • Posts: 195
  • Country: gb
Re: Microcontrollers for beginners
« Reply #4 on: April 15, 2021, 09:23:43 am »
Hi,

Completing a course is just the beginning, until you actually code your own project/s its hard to fully appreciate the full extent of the Arduino and C++.

You can switch to other micros, but their coding is still quiet similar to C++, just that things are done in slightly different ways from one manufacturer to another.

Our choice, once you have developed some Arduino projects of your own, would be to move onto the ESP32 which is Arduino IDE and C++ compatible, as is the Teensy range.
That more easily  allows you to open up the online world  to your projects, eg wifi and bluetooth.

You good link has a wealth of free ESP projects and code examples, plus paid for courses if thats your thing.

https://randomnerdtutorials.com/



 

Offline techman-001

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: Microcontrollers for beginners
« Reply #5 on: April 15, 2021, 10:22:13 am »
Hey everyone! I just completed my Arduino course and was planning to move onto something more professional like ATmega or PIC microcontrollers and processors. Can you guys please suggest which is the best place to start from? please let me know about different programming devices like Pickit and stuff im totally confused with them. Thanks in advance

Hi, this is my standard reply to this often asked question.

I personally don’t recommend The Arduino System because it was designed for people like artists with little technical knowledge so they could use libraries and ‘sketches’ to easily assemble (like Leggo) projects such as led lighting controllers for ice sculptures.

No embedded engineer would ever use Arduino, or recommend it to anyone wanting to learn about microprocessors. The only people recommending Arduino are Arduino users and Arduino kit and part sellers.

If you learn Arduino, you’re learning The Arduino System, you’re not learning microprocessors, even tho Arduino kits have a microprocessor in them.

Furthermore, the MEGA8 used in Arduino is ancient 8 bit technology, it was released way back in 1997!

Would your friends recommend a Stanley Steamer for your first car because it’s simple, instead of a easy to drive but complex Tesla electric car ?

Arduino uses The C Programming Language, which is widely assumed to be the superior programming language for embedded, except it isn’t. C was not designed for small embedded use.

Assembly language was designed for embedded and it will aid you in understanding microprocessors, unlike C which will just add another massive task for you on top of learning about microprocessors.

So I recommend a virtual Intel 8085 CPU and Assembly language using the Java based simulator in the url below. That way you don’t have to spend any money on hardware until you have enough experience to make an informed choice in a world of slick profit oriented advertising.

Learning Microprocessors’ a guide for using a useful Java based software, online book, and student examples. https://learning-microprocessors.sourceforge.io/

If embedded isn’t the most exciting thing you’ve ever seen or if it’s too boring, too hard, or takes too long to learn I recommend you examine your motivation for wanting to learn about microprocessors because more than likely you’re not going to be designing embedded devices in the long run. You will most likely be just be another Arduino kit sale.

If you gleefully assimilate all the 8085 info, choose your micro and build projects asap, LOTS of them because that’s the fast track. My recommendation is to choose a micro that has a well developed, proven and Free Software development environment, including advanced debugging behind it, preferably Linux, not Windows only.

Finally, be aware that microprocessors such as the STM32H7xx are light years ahead of the 8085, Mega8 and Cortex-M0 (my favorite), so you have a LOT of catching up to do once you have mastered the basics.

Good luck and have fun!

The author also maintains:

    Bluepill Diagnostics: https://mecrisp-stellaris-folkdoc.sourceforge.io/bluepill-diagnostics-v1.6.html
    Mecrisp-Stellaris Forth for Cortex-M; The Unofficial Doc: https://mecrisp-stellaris-folkdoc.sourceforge.io/
 
The following users thanked this post: Shock, M.Zohaib Usman

Offline mon2

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: ca
Re: Microcontrollers for beginners
« Reply #6 on: April 15, 2021, 10:24:46 am »
PICO PI is coming along very nicely and @ $4 - $5 USD resale is hard to beat. Now Arduino is building a variant using the PICO PI so looks very promising.

The PIO PI PIO interface is very much welcomed to mimic FPGA like state machines to communicate at blazing speed with external hardware that the current Arduino designs cannot support. Check out the many youtube videos and articles on the PICO PI and the PIO interface.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4026
  • Country: nz
Re: Microcontrollers for beginners
« Reply #7 on: April 15, 2021, 11:40:06 am »
So I recommend a virtual Intel 8085 CPU and Assembly language using the Java based simulator in the url below. That way you don’t have to spend any money on hardware until you have enough experience to make an informed choice in a world of slick profit oriented advertising.

This has got to be the worst advice ever!

First of all criticising the ATMega328 for being 8 bit and released way back in 1997 -- and then recommending instead to use an 8 bit 8085 released in NINETEEN SEVENTY SIX.

The AVR is better in every way, and in particular is at least 10 times more friendly to program in assembly language.

The 8085 (like the 8080/z80) is also an absolutely awful target for a high level language compiler. Whereas the AVR is a nice one.

Can you even buy a real 8085 now? I couldn't find one in a few minutes looking.

As far as I understand, the 8085 typically ran at 3 to 6 MHz, and needs 4 or 8 or maybe 12 clock cycles to execute an instruction. Basically, somewhere or under 1 MIPS. Maybe you can buy faster ones now -- after all you can get a 17 MHz 65C02 now.

The AVR executes most instructions in 1 clock cycle, so a 16 MHz AVR is basically a 16 MIPS CPU.

Maybe you meant the 8051. I don't know. It's also awful and from 1980 but it's probably better. And you can easily buy them now.

But the guy already *has* (I presume) an Arduino with an AVR.


Claiming there is somehow something "unprofessional" about learning to program an AVR microcontroller in C or assembly language just because it happens to be mounted on an Arduino is the height of arrogant and unprofessional bullshit.
 
The following users thanked this post: mathsquid, newbrain, james_s, WattsThat, harerod, srb1954

Offline Lindley

  • Regular Contributor
  • *
  • Posts: 195
  • Country: gb
Re: Microcontrollers for beginners
« Reply #8 on: April 15, 2021, 12:03:54 pm »
Depends in part what the OP is using micros for, just as part of his electronics hobby or as a path to employment ?

The advantage of the Arduino is that its so user friendly and well supported and wonder why folk knock it so much as it allows so many to venture into a new world of micros;   but as said. agree it does not give much insight as to the real working of the chip.

However not everyone can jump straight into Assembly code, particularly if doing so from home on their own without direct assistance as you would have if done at work or part of a college course etc.

We started out, many years ago,  with Machine Code on National Semiconductor chips but thankfully other workfolk and Farnells tech reps around to help us get started.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12851
Re: Microcontrollers for beginners
« Reply #9 on: April 15, 2021, 12:23:38 pm »
You can program ATmega and other AVR based Arduinos in raw C++ using the GCC AVR libraries.  The Arduino IDE installer installs a reasonably current version of the AVR GCC toolchain.  Its possible to use the Arduino IDE for raw C++ programs (with some limitations on file names, and you cant attach your own ISR to the Timer 0 overflow interrupt). 

See my comments (starting at #41) in https://www.eevblog.com/forum/blog/adventures-in-avr-isp-programming/

Also Westfw's comments are worth noting. At #35 he presents a batch file:
Code: [Select]
REM install-avr-tools.bat by Bill Westfield (WestfW)
REM  Find the avr-gcc tools that are part of an Arduino install, and
REM  add them to the PATH for the duration of the current shell.
REM  See [url]https://hackaday.io/project/19935[/url]
REM  [url]https://github.com/WestfW/Arduino-avr-tools-install[/url]
which you can use to let you use the AVR GCC installed by Arduino from the command line or from an alternative IDE launched from a batch file.

https://github.com/WestfW/Arduino-avr-tools-install

N.B. MPLAB X wants a full install of Microchip 'flavored' AVR-GCC and wont let you use the one from Arduino for AVR devices even though you can add it as a toolchain.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4026
  • Country: nz
Re: Microcontrollers for beginners
« Reply #10 on: April 15, 2021, 01:16:24 pm »
Depends in part what the OP is using micros for, just as part of his electronics hobby or as a path to employment ?

The advantage of the Arduino is that its so user friendly and well supported and wonder why folk knock it so much as it allows so many to venture into a new world of micros;   but as said. agree it does not give much insight as to the real working of the chip.

Nothing about Arduino prevents you getting insight into the real working of the chip!

You've got an editor. You've got a C compiler and assembler. You've got the headers with the register definitions. You've got a board with an AVR chip on it.

I really don't understand why so many people seem to think buying and using an Arduino restricts you to using only the Arduino libraries. It simply doesn't.
 
The following users thanked this post: Siwastaja, Ian.M, newbrain, george.b, james_s, tmadness, WattsThat, harerod

Offline techman-001

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: Microcontrollers for beginners
« Reply #11 on: April 15, 2021, 01:21:09 pm »
Depends in part what the OP is using micros for, just as part of his electronics hobby or as a path to employment ?

The advantage of the Arduino is that its so user friendly and well supported and wonder why folk knock it so much as it allows so many to venture into a new world of micros;   but as said. agree it does not give much insight as to the real working of the chip.

However not everyone can jump straight into Assembly code, particularly if doing so from home on their own without direct assistance as you would have if done at work or part of a college course etc.

We started out, many years ago,  with Machine Code on National Semiconductor chips but thankfully other workfolk and Farnells tech reps around to help us get started.

When I started in embedded in 1976 it was a task and a half to get a bare cpu up and running, the 6800 needed special clocks etc, the 6802 with only the requirement for a single clock was a revelation. I was a technician back then and we were expected to know. There were no courses on Microprocessors because few places had them. My first micro was a National PACE 16 bit development system with a teletype and paper tape.

Nowadays of course, assembly is so easy because there are so many free tools, real and virtual that for anyone serious about 'learning microprocessors' the task is much easier than back then.

That's why I recommended a virtual 8085, nothing to spend and the software is free. The url links a great book and would provide a decent start to a person wanting to learn the basics of *microprocessors*.

I don't care that it's old, its real, everything is there and everything we now have was birthed back in those days. I don't care if it's hard, lots of things are hard, either do them, or do them not.

Any idiot can 'make' something with Arduino, but they won't know anything worthwhile about microprocessors afterwards.



 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12851
Re: Microcontrollers for beginners
« Reply #12 on: April 15, 2021, 01:36:01 pm »
Nothing about Arduino prevents you getting insight into the real working of the chip!
Yes.  You can even debug on an Arduino, by cutting the jumper that connects Reset to the coupling capacitor to the USB UART chip and connecting any AVR debugger that supports Atmel debugWIRE to the ISP header using GDB or any IDE that supports it.  If you are feeling really cheap, you can hack together a 5V only clone of the Xplained onboard mEDBG debugger using an Arduino Leonardo or Micro and a few passives.  See https://hackaday.io/project/162372-xplained-yourself

N.B. Returning the Arduino to original functionality involves reFlashing the Arduino bootloader and reconnecting the Reset jumper.
 
The following users thanked this post: tmadness

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9888
  • Country: us
Re: Microcontrollers for beginners
« Reply #13 on: April 15, 2021, 02:42:39 pm »
I really don't understand why so many people seem to think buying and using an Arduino restricts you to using only the Arduino libraries. It simply doesn't.

I agree completely.  When I want to build something down and dirty, I reach for the Arduino.  It's about project completion, there are no style points awarded.

I don't like the Arduino IDE but I can use VSCode to do the same thing.  The problem with that elegant editor/IDE is that it can't print anything.  I can't even get a source listing without having to pull the file into Notepad++.  I can also use VisualStudio and the vsMicro add-in.  Yes, I'm old enough that I annotate source listings.  The only thing that has changed is that I don't have a full-width line printer and I'm stuck with Letter size and Landscape orientation.  Workable...

Think you already know Arduino?  Try this kit

https://www.amazon.com/ELEGOO-Project-Tutorial-Controller-Projects/dp/B01D8KOZF4

Now we're getting down to hardware.  The example code is excellent as are the tutorials.

Once all the peripheral hardware is understood, it doesn't make much difference which uC is used.  That new Teensy 4.1 is quite powerful and the libraries mirror much of what Arduino provides.  The source is given so writing to bare metal is easily learned.  For that matter, there is a lot to learn in the Arduino libraries and that code is given as well.

I wouldn't wish the PIC 16F series on my least favorite cousin.  Most C compilers emit horrendous code due to banking and paging issues of the hardware design.  A horrible suggestion!

As a next step, I might recommend the PSOC 6 BLE (Bluetooth Low Energy) and specifically starting with the PSOC 6 101 video series.  I can't convince myself that version 4.4 of the toolchain works with the tutorials so I recommend installing 4.2.

Once started on the ARM series, the sky is the limit.  I started with the LPC2106 and the LPC2148.  These are excellent but obsolete.  I moved to the mbed LPC1768 and I really like the 'stamp' form factor.  I use the ARM provided online tool chain.  It's really easy to drop in a TCP/IP stack and use Berkeley Sockets to connect between the LPC1768 and a LaserJet.

Any of the STM boards will be approachable through the toolchain and i have played with several variants.  The thing is, I don't really learn anything until I build something.  There simply must be an application worthy of the time required to get up to speed.

The ATmega328 of the Arduino can be programmed at the bare metal level while using the Arduino supplied tools and boot loader.  It is possible to avoid the Arduino libraries, omit the setup()/loop() structure and add a main() function.  Then you can write every line of code that runs on the chip.  Or study the avr-gcc libraries.  I wrote some robotics code for the ATmega128 and that is an elegant chip.  Lots of pins!

I have yet to see any Arduino code that uses the features of C++ and I'm pretty much convinced that C++ features are not required (and likely not desired) in embedded programming.  I object to having a heap that can grow without bound and crash into the stack without warning.  I like static allocation!  I think I'll stick with C.  Most of the Arduino code I see in the wild is actually C code.

If your Arduino board uses the DIP package, you can do all your development on the Arduino board and then insert the chip into your custom board and nobody will ever know it is based on the Arduino.
« Last Edit: April 15, 2021, 02:46:12 pm by rstofer »
 
The following users thanked this post: tmadness

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Microcontrollers for beginners
« Reply #14 on: April 15, 2021, 07:42:09 pm »
Hey everyone! I just completed my Arduino course and was planning to move onto something more professional like ATmega or PIC microcontrollers and processors. Can you guys please suggest which is the best place to start from? please let me know about different programming devices like Pickit and stuff im totally confused with them. Thanks in advance

Hi, this is my standard reply to this often asked question.

I personally don’t recommend The Arduino System because it was designed for people like artists with little technical knowledge so they could use libraries and ‘sketches’ to easily assemble (like Leggo) projects such as led lighting controllers for ice sculptures.

No embedded engineer would ever use Arduino, or recommend it to anyone wanting to learn about microprocessors. The only people recommending Arduino are Arduino users and Arduino kit and part sellers.

If you learn Arduino, you’re learning The Arduino System, you’re not learning microprocessors, even tho Arduino kits have a microprocessor in them.

Furthermore, the MEGA8 used in Arduino is ancient 8 bit technology, it was released way back in 1997!

This makes no sense at all, Arduino has not used the atmega8 in many years, the lowest you see anymore is the atmega328 but there are also numerous far more powerful chips available.

The rest is mostly nonsense too that sounds like somebody who never actually touched an Arduino and just has an idea in their imagination of what it is and who uses it. Yes it has warts, the "IDE" if you can call it that is pretty terrible, the language is not standard C++, although the C++ stuff is all there, it just has some crutches rolled into it that makes it easier for beginners. It's true that professional embedded engineers are not going to be using the Arduino environment to develop on, but a great many of them likely cut their teeth on it. Arduino is great for beginners, and I very much wish it had been around when I was a kid, it would have given me a huge head start. It lowers the initial hump in the learning curve considerably and makes it really easy to get going. A person who has become proficient with Arduino can easily transition to something more serious. Coding is coding, once you're familiar with the C/C++ syntax, and Arduino will get you there, making the jump to ANSI C on any other microcontroller is much easier than initially learning to code.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Microcontrollers for beginners
« Reply #15 on: April 15, 2021, 07:56:34 pm »
When I started in embedded in 1976 it was a task and a half to get a bare cpu up and running, the 6800 needed special clocks etc, the 6802 with only the requirement for a single clock was a revelation. I was a technician back then and we were expected to know. There were no courses on Microprocessors because few places had them. My first micro was a National PACE 16 bit development system with a teletype and paper tape.

Nowadays of course, assembly is so easy because there are so many free tools, real and virtual that for anyone serious about 'learning microprocessors' the task is much easier than back then.

That's why I recommended a virtual 8085, nothing to spend and the software is free. The url links a great book and would provide a decent start to a person wanting to learn the basics of *microprocessors*.

I don't care that it's old, its real, everything is there and everything we now have was birthed back in those days. I don't care if it's hard, lots of things are hard, either do them, or do them not.

Any idiot can 'make' something with Arduino, but they won't know anything worthwhile about microprocessors afterwards.



Ok well it's not 1976 anymore (or 1986, or 1996, or 2006, or even 2016) and the embedded world doesn't work the way it did back then. Very few embedded engineers program anything in assembly anymore, at least 95% of it is done in C. Nobody really cares about the basics of microprocessors, that's something you learn about in the process of earning a CS degree and then mostly shove into the back of your mind as something that's useful to know but not something you really have to think about on a daily basis. Anyone wanting to get into embedded development today, especially if they have any inkling of doing so professionally needs to learn C, period. Assembler can be handy in certain situations and someone who is interested in diving in a little deeper should play around with it but they'll probably go their whole career without ever actually needing it.

Now, that said, I personally find ancient microprocessors fascinating, my favorite so far is the 6502 but I also have 6800, 6809 and Z80 based systems, mostly implemented as soft microprocessors in FPGAs but I do also have a real vintage Heathkit ET-3400 trainer and have dabbled in assembly for all of these microprocessors. It's fascinating stuff, I love it, it would be great to see more younger folks interested in it, but would I recommend a beginner pick up any of those platforms and start learning assembly? Absolutely not, it's like learning to churn butter, blacksmith horseshoes by hand or draft calligraphy with a feather quill pen, once valuable these are no longer useful life skills in the world of today. They can be fascinating, absolutely, but it is not something anyone needs to learn unless they find it interesting.

 
The following users thanked this post: woofy

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5890
  • Country: es
Re: Microcontrollers for beginners
« Reply #16 on: April 15, 2021, 11:12:32 pm »
Huh, arduino and C++? That's not the best start from my point of view. I admit I do hate it.

C++ is way more complicated than C. Also not many MCUs can be programmed with that.
On top of that, Arduino C++ libraries are an absolute cryptic messy stuff, I never could understand a *** when trying to figure out something.
It happens like in Linux, it's all an uncontrolled mess, you make a project, it works, after 2 months it crashes on build spitting thousands of different errors because some library updated.
Of course, in that moment  you don't have a clue of what or why it's happening, get ready for the happy following days debugging and punching the table until you finally find the culprit.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline tmadness

  • Regular Contributor
  • *
  • Posts: 83
  • Country: us
Re: Microcontrollers for beginners
« Reply #17 on: April 16, 2021, 12:46:40 am »
My man OP you have rekindled the eternal flame war.  >:D
Stand back and let it grow.
Anyway, I strongly suggest that you keep using the parts that you have and just learn at a deeper level what is going on inside your microcontroller. Most of this learning will transfer, you can use whatever tools you want (c/c++/rust/ada/assembly, ARM/MIPS/RISCV, PIC/AVR/ATSAM/IMX ARduino/STHAL/CMSIS whatever) The key aspect is that you expand your knowledge beyond #include <SPI.h> adds SPI functionality. 
Start here: https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf  if you are using a Arduino uno this is the chip you are using. There are ~300 pages. You will understand little at first. Use google for every single word you dont understand. There are hundreds of quality tutorials:
https://www.arduino.cc/en/Reference/PortManipulation
https://hekilledmywire.wordpress.com/2011/02/23/direct-port-manipulation-using-the-digital-ports-tutorial-part-3/
Follow some of them. Re do your course using register manipulation.
Finally here's  a test of your research skills and knowledge: Do not use any arduino libraries and try and write your own printf. Its something nearly every beginner learns to do.
 
The following users thanked this post: M.Zohaib Usman

Offline M.Zohaib UsmanTopic starter

  • Supporter
  • ****
  • Posts: 26
  • Country: ca
Re: Microcontrollers for beginners
« Reply #18 on: April 16, 2021, 02:55:14 pm »
Im actually still a student and am trying to get into professional electronics field, not just a hobbyist
Student Electronics Engineer. Working on Several different projects ATM. Hit me up if interested
 

Offline M.Zohaib UsmanTopic starter

  • Supporter
  • ****
  • Posts: 26
  • Country: ca
Re: Microcontrollers for beginners
« Reply #19 on: April 16, 2021, 02:58:38 pm »
Depends in part what the OP is using micros for, just as part of his electronics hobby or as a path to employment ?

The advantage of the Arduino is that its so user friendly and well supported and wonder why folk knock it so much as it allows so many to venture into a new world of micros;   but as said. agree it does not give much insight as to the real working of the chip.

Nothing about Arduino prevents you getting insight into the real working of the chip!

You've got an editor. You've got a C compiler and assembler. You've got the headers with the register definitions. You've got a board with an AVR chip on it.

I really don't understand why so many people seem to think buying and using an Arduino restricts you to using only the Arduino libraries. It simply doesn't.


Exactly what i was thinking! everyone keeps on telling me that learning arduino is totally different from the actual method of using microprocessors and controllers
Student Electronics Engineer. Working on Several different projects ATM. Hit me up if interested
 

Offline M.Zohaib UsmanTopic starter

  • Supporter
  • ****
  • Posts: 26
  • Country: ca
Re: Microcontrollers for beginners
« Reply #20 on: April 16, 2021, 03:07:14 pm »
Huh, arduino and C++? That's not the best start from my point of view. I admit I do hate it.

C++ is way more complicated than C. Also not many MCUs can be programmed with that.
On top of that, Arduino C++ libraries are an absolute cryptic messy stuff, I never could understand a *** when trying to figure out something.
It happens like in Linux, it's all an uncontrolled mess, you make a project, it works, after 2 months it crashes on build spitting thousands of different errors because some library updated.
Of course, in that moment  you don't have a clue of what or why it's happening, get ready for the happy following days debugging and punching the table until you finally find the culprit.

How else should i start then? i need your opinion
Student Electronics Engineer. Working on Several different projects ATM. Hit me up if interested
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12851
Re: Microcontrollers for beginners
« Reply #21 on: April 16, 2021, 04:12:19 pm »
Quote from: M.Zohaib Usman
Exactly what i was thinking! everyone keeps on telling me that learning arduino is totally different from the actual method of using microprocessors and controllers
Not totally different just *VERY* different.  Arduino is some half-assed hardware*, a <expletively> crappy but novice friendly IDE, a build system that sucks, and a massively bloated hardware abstraction layer that tries to make every MCU Arduino have ever used look identical to the programmer.

Also there's a culture in 'Arduinoland' of (I estimate) 99% of users not reading MCU or peripheral chip datasheets.  If you want to see violations of electrical and timing specs galore, just look for an Instructable or Yotube video of how to hook up <whatever> to an Arduino!   

If you workaround the build system by *not* putting any code in the .ino file, and program whichever ATmega is on your board in pure 'vanilla'# ISO C99, AVR Libc, and  direct SFR access using the names and bit names in the datasheet, checked against the specific MCU's register definition header, you are effectively programming in 99.9% 'pure' AVR 'flavored' C, writing code that would directly port to Atmel Studio.   

* The Arduino hardware developers have had a history of making questionable design choices and mistakes.  The most widely known one is the 0.16" gap between the two digital headers on the Uno, which makes it excessively awkward to use 0.1" pitch protoboard for a shield, and has been inherited by every full sized successor Arduino. Others include the capacitively coupled Reset signal from the USB <=> serial chip to the AVR which prevents debugWIRE working while its connected and also forces a Reset every time the serial port control line driving it goes low, which makes it *VERY* difficult to open the COM port without resetting the Arduino - resulting in bodgery like adding 10uF capacitors on reset to suppress the reset pulse from the serial chip while still allowing the reset button to work, but in doing so violates the electrical specs of both the serial chip and the reset switch! - and the marginal copper area for the linear 5V regulator present on most boards, which forces the use of a low Vin to power the board to reduce dissipation if your load on the 5V rail (including loads on high output pins) is significant. There are others . . .

# The AVR-GCC C++ compiler toolchain provided with the Arduino ADE is backwards compatible with ANSI C and ISO C99. You can use 'vanilla' ANSI C, but you'd loose C99 single line // comments and the ability to declare variables at point of first use (e.g.
for(int i=0;  i<LIMIT; i++){ /*...*/ } ) rather than only immediately after the { at the beginning of a block.
« Last Edit: April 17, 2021, 06:03:39 am by Ian.M »
 
The following users thanked this post: techman-001, Tagli

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9888
  • Country: us
Re: Microcontrollers for beginners
« Reply #22 on: April 16, 2021, 04:52:30 pm »
* The Arduino hardwere developers have had a history of making questionable design choices and mistakes.  The most widely known one is the 0.16" gap between the two digital headers on the Uno, which makes it excessively awkward to use 0.1" pitch protoboard for a shield, and has been inherited by every full sized successor Arduino.

Maybe it is a very clever solution to the problem of shields being plugged in backwards.  Sounds like good engineering to me!

 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12851
Re: Microcontrollers for beginners
« Reply #23 on: April 16, 2021, 05:06:22 pm »
Maybe, but it would be interesting to see the rationale for that rather than keying headers by omitting male pins and using blocking inserts in the female side, all on a 0.1" pitch.   However I suspect that the history of that decision is either long lost, or at best vaguely remembered with no paper-trail . . .
 

Offline Lindley

  • Regular Contributor
  • *
  • Posts: 195
  • Country: gb
Re: Microcontrollers for beginners
« Reply #24 on: April 16, 2021, 05:07:14 pm »
Im actually still a student and am trying to get into professional electronics field, not just a hobbyist

You want to look at your regions employers job adverts and see what  they require for programmers/micro design etc, also ask around your college as they should know what the local firms want student to learn.
Nothing to stop you knocking on their doors and seeing if they have any trainee openings.

While Assembly code is very good at helping you understand the workings of the micro, few companies will expect their staff to use it.

You can run Assembly code direct from the Arduino, this link has a simple flashing led demo, which will give you some idea of how it works and how to use the datasheets, though it will initially seem totally different. Lots of other sites for AVR assembly.



https://www.instructables.com/Command-Line-Assembly-Language-Programming-for-Ard/


Sure other member will be able to give you more guidance....
 
The following users thanked this post: M.Zohaib Usman


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf