If you really want to learn the fundamental concepts, I'd suggest looking at the block diagrams and assembly programming language of a simple PIC microcontroller, eg.How can i understand the concepts of programming microcontroller.
ThanksIf you really want to learn the fundamental concepts, I'd suggest looking at the block diagrams and assembly programming language of a simple PIC microcontroller, eg.
Assembly language is in effect a human-readable version of the machine code (the binary instructions the CPU reads and executes) using mnemonic names rather than the binary values.
Something like a PIC has a small instruction set, so fairly easy to understand - that one only has just over 50.
In comparison, something like a current PC CPU has thousands!
Or, if you just want to be able to program a device to make it do things, then an Arduino is the simplest route.
Those are normally programmed in C language (or C++), a high level language which is converted (compiled) to suit the instruction set of the target device by the Arduino programming package.
There are also thousands of existing projects you can just download, compile and run, with an appropriate arduino board connected to your PC via USB.
C is the most versatile language overall as it can be used with an appropriate compiler to create programs for anything ranging from a tiny 8 pin MCU, through the range of devices & systems up to supercomputers - but that also means the "mechanics" of the CPU instructions are hidden away from the programmer.
ThanksKids, and now adults for some specific quick turn projects, are using a
visual approach called block language programming. This is where you
drag and drop function blocks, like
View attachment 139482
The above is a very simple application, read a voltage and set a PWM duty cycle, its pulse width,
proportional to that voltage. Here its trivial to do, the blocks are dragged out of the 2'ond window
from left, and placed in 3'rd window, and configured, like pin number to read, pin number to output
PWM signal on. As you do this mBlock, this particular program, converts the block configuration into
Arduino code (C like code) and programs it. Thats the code you see in right hand window. Kids are using
this in 6'th grades to program robots and their movement. I use it to do fast turn around of simple stuff,
like below link. More complex stuff I do in C.
Often users, developers, hobbyists need timed and qualified event generators, many resorting to 555 timers and the like. The venerable 555 has had a long run but its limited in accuracy and capability. This approach uses block language to create...www.electro-tech-online.com
Here is what would have been fairly involved project, to do wireless application, done in Tuniot -
Had a problem where I need low cost Network, internet access, at a remote site. Choose to work with Verizon 8800L as it got good reviews for normal attended usage. Motivation was Cell internet only added < $ 20 to the monthly bill. Problems ...www.electro-tech-online.com
If you learn one block language there are quite a few variants, and its easy to do the other variants
because all the principals pretty much the same. mBlock, Snap4Arduino, Scratch, Visuino, Ardublock,
Then there are visual ones that do it like flow charts, Nodered, flowcode, in a flow chart format.
C code is called, rightfully so, a "strongly typed language". It means its not forgiving in the way
you type the instructions and code, how you use variables, etc.. So learning curve if you have never
programmed a tad steep, as is Assembler, appropriately called machine language, where you are
deep in the processor logic and its hardware.
But all people who have used a 4 function calculator have been programming most of their lives.
But the programming done in ones head, eg. the sequence of math operations, the type of operations,
all done typically in our Gerbil brain pans.
If you start with mBlock or Snap4Arduino, software is free, a low end but capable board ~ $3, Arduino
Nano, and a USB cable will get you started.
View attachment 139483
Ok but what programming language is good for microcontroller?I am surprised no-one has said this yet: Start a project.
By the time you have it working, you will have learned a lot.
For example, say you have a lot of houseplants, make an automatic watering controller.
Do you free-lance? Make a time-keeping gadget. Your other hobby is cooking? Make your own sous vide controller.
It doesn't matter what the project is.
Get an Arduino to play with, a Uno is a good choice - cheap and easy, using C++ (a superset of C), with millions of examples and tutorials available on-line. Don't mess with silly kids 'block' programming - unless you are a young kid of course.Ok but what programming language is good for microcontroller?
I have never programed one before
I used to be of this opinion too. However, I find C to be very close to Assembler.In my opinion, if you want to learn what is going on "under the hood" is to get a grasp of Assembly programming, at least at first.
BANKSEL ADCON1 movlw b'11000000' ; right justify, FOSC/4 vdd and vss vref movwf ADCON1
ADCON1=b'11000000'; // right justify, FOSC/4 vdd and vss vref
I as well did PDP8 and 4004 assembler in first job.In my opinion, if you want to learn what is going on "under the hood" is to get a grasp of Assembly programming, at least at first.
I'm sort of biased, because I have done it this way since My first, which was a PDP8 back in the late '70's.
PS:: In fact Nigel's tutorials are still up there!