Electronic – Does each microcontroller line have its own programming language/syntax

microcontrollerprogramming

I've programmed the Arduino and have started programming the Teensy. They are similar to C but there are slight nuances in the programming language.

For instance, in Arduino's C you call a function pinMode(pin#, Output/Input) to designate a digital pin to either output signals or receive signals. In Teensy's C, you set the "DDR" register associated with one of four ports (each of which represents a collection of pins) which you collectively designate as either input or output (Teensy IO syntax).

I would like to know if it is the case that when you use a microcontroller that is new to you, you need to effectively learn a new "language". I put the word "language" in quotes because despite the nuances in syntax, the components and how they are set up in software are fundamentally equivalent e.g., the notion of ports and pins still refer to a terminal from which you can output/input digital signals.

In the same vain of discourse: are there microcontrollers that aren't programmed in software or will there always be a software layer used to program the uController? If the latter, who writes/provides documentation for them?

Best Answer

Microprocessors and Microcontrollers will typically use a shared architecture between different product and manufacturer lines. These architectures typically define a low level command set (instruction set) common to all implementations. A C or C++ compiler will be able to generate bytecode executable on all e.g. ARM processors.

However, the architecture is only half the picture. Since there are lots of specific memory addresses, on board peripherals, memory management and other implementation details that the architecture doesn't address

A manufacturer or third party will typically provide a collection of source files (an HDK) that will provide definitions, port mappings, and example code. Typically the HDK is for C and C++. Typically the HDK will have a demonstration board associated with it (think $500 arduino). A lot of detailed configuration work is often necessary to adjust the development/sample platform to the device you are designing

The Arduino is based on the AVR architecture and is primarily supported by Atmel. Arduino has created a platform bootloader and a library of simplified C++ functions and objects for you to use the platform with minimal effort. The Arduino platform and IDE is designed for hobbyists with minimal equipment. Before the arduino, the PIC fulfilled a similar role with an easy to use and cheap BASIC environment.

In a professional environment typically this support is provided by the vendor/manufacturer or is contracted out to a third party. They provide the low level code and headers and you write your application with that HDK, in larger organizations this could be done in house. There is a recent trend for manufacturers to build an open API/Software ecosystem around their platform that makes them as easy to use right out of the box as the arduino. There are still countless chips with very little programming support, and most platform knowledge locked away in the corporate world.

Related Topic