Assembler
Assembler is the most unavoidable language that you'll consider using as you probably won't need to buy any other tools to use it. More than likely the builder will contribute an collector for the chip and you won't need any books as all the instructions are in the datasheet and you just start coding.
This route to programming is very easy but you may be setting yourself up for problems later on as:
- It is trivial to write short programs.
- It becomes progressively more difficult to write large programs.
- It seems to be the best option as it gives the fastest code.
- It seems to be the best option as it gives the smallest code.
Assembler: Fast & small code
There is no doubt that collector gives the fastest and most optimized code (your brain is great at optimization than any compiler!) but collector is difficult - typically you'll spend ten times as long writing collector as you would writing in a high level language.
Assembler / Compiler Trade off
This is the trade off; to write the fastest most optimized code or to get the task solved more quickly.
Another qoute with collector is that to do even the most trivial task you have to think about every aspect of the code and all implications on registers and register flags.
Even making a microcontroller perform the most trivial task is difficult e.g. For making a loop in collector you need to think about which register to use and which instructions all the while thinking about how those registers should not interact with the loop register/other registers etc.
Assembler: qoute - changing the target
Another mystery is when you change from one microcontroller to another (even in the same expedient family) the collector instructions may be changed e.g. More instructions to heighten microcontroller performance. So you will have to learn an entirely dissimilar education set when inviting either to a new target microcontroller or inviting to a dissimilar expedient within the same house i.e. Code re-use is not potential unless you stay with one microcontroller (or devices with a similar internal architecture).
High level languages
Hll: Retarget
Retargeting code to another microcontroller is easier since the Hll will know the details of the new target i.e. education set, fuses etc. All you need to worry about is the exact differences in the middle of the dissimilar microcontrollers (in the same house this will be setting up the internal peripherals).
The foremost point is that the Hll takes care of the collector code needed to do the job.
Hll: Easy to understand.
The most useful aspect of a high level language (Hll) is that the language is written in a form you can de facto understand - there are no cryptic collector commands that you have to remember and most commands are made up of any engine code instructions - rescue you coding endeavor (often there are built in libraries of code e.g. Lcd driver, Serial port driver, I2C driver etc
So the Hll makes it easy to write code as it generates the definite collector for the target microcontroller.
Hll : Whitespace
You can also make use of white space (areas of no code) to separate out the discrete operations within the program - typically collector code is just one great big list that is de facto very difficult to read - I know there are comments but you need to annotation almost every line so that man else can
understand the code.
Hll: Task splitting
One of the best features of a Hll is that you can split tasks into separate functions that you can consolidate on them individually (as the Hll takes care of local variables etc.). For collector even when using a call education you have to take care of preserving the register state - in the Hll it's all done
for you.
Hll: Code re-use
Once you learn the Hll you will find it easy to read code written by other habitancy and you will be able to re-use code that you have already written whereas with collector you will permanently need to analyze the code to see if it fits in with your new functions.
The only decision then is which high level language? There are de facto three contenders Basic, C and Pascal - these are the most beloved languages and for beloved microcontrollers there will be an Hll compiler for each one. I'll just list the advantages and disadvantages of each
Basic Advantages
- Very easy to learn and use.
- A Basic compiler will yield code that runs fast as a C compiler.
- Many in built functions (depending on compiler).
- Very beloved - large user base with many example programs.
Basic Disadvantages
- Non approved language.
- If using an interpreted Hll will run very slowly.
Note: Because the language is not standardized it will be difficult to move code to a new processor target type.
Pascal Advantages
- Easy to learn and use.
- A Pascal compiler will yield code that runs fast as a C compiler.
- Many in built functions (depending on compiler).
Pascal Disadvantages
- Not as beloved as C - so not as many compilers.
- A bit wordy - it was originally intended as a teaching language.
- Not as flexible as C.
C Advantages
- Compiled language - all the time runs fast.
- Standardized language (Ansi)- easier to port to dissimilar compilers / target devices.
- Many compilers available.
- Many in built functions (depending on compiler).
- Very beloved - large user base with many example programs.
- Used in many dissimilar industries.
- Usable at the hardware level as well as higher abstraction levels (although C++ is great for very abstracted programming models).
C Disadvantages
- Hard to learn at first.
- Strong type checking means you spend time pleasing the compiler (although this protects you from making errors).
You can find more data from the website here and how to build a website like it here.
selecting a Programming Language for Your Microcontroller