Maker Pro
Maker Pro

Programming Languages

doteroargentino

Nov 17, 2017
3
Joined
Nov 17, 2017
Messages
3
Hello! I am currently studying electronic engineering and for some time I've been learning C++ on my own because I just like the language but I have a few questions.
1. Should I keep learning C++ or should I switch to C, Java, ASM or some other language?
2. What else can we program from the hardware point of view apart from microcontrollers?
3. What programming languages are used when making firmware for different modules (such as WiFi, Bluetooth, etc.)?
4. The only microcontroller I have is the embedded atmel my arduino uno has, should I get something else for better understanding of how things work and to practice?
 

kellys_eye

Jun 25, 2010
6,514
Joined
Jun 25, 2010
Messages
6,514
1. Yes - but no reason why you can't add to your knowledge by including others
2. EPROMs, EEPROMs etc i.e. any memory-capable device
3. All of the above
4. Get a selection of the most commonly used devices and learn their architecture. C++, being a 'transportable' programming language means you don't really need to know much about the hardware but an understanding of their capabilities will always increase your knowledge of what can be done with them - and which device might be preferable over another.
 

doteroargentino

Nov 17, 2017
3
Joined
Nov 17, 2017
Messages
3
1. Yes - but no reason why you can't add to your knowledge by including others
2. EPROMs, EEPROMs etc i.e. any memory-capable device
3. All of the above
4. Get a selection of the most commonly used devices and learn their architecture. C++, being a 'transportable' programming language means you don't really need to know much about the hardware but an understanding of their capabilities will always increase your knowledge of what can be done with them - and which device might be preferable over another.
Alright thank you very much for your reply!
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
By far the most common languages used for microcontrollers are C (not C++) and assembly language. Neither is instantly transportable from one type of micro to another because so much of the program involves tweaking hardware based modules like PWM, UARTS, SPI, and even GPIO. If you keep all hardware access to hardware specific functions, you can transport what remainder of the C code, if there is any.

Bob
 

doteroargentino

Nov 17, 2017
3
Joined
Nov 17, 2017
Messages
3
By far the most common languages used for microcontrollers are C (not C++) and assembly language. Neither is instantly transportable from one type of micro to another because so much of the program involves tweaking hardware based modules like PWM, UARTS, SPI, and even GPIO. If you keep all hardware access to hardware specific functions, you can transport what remainder of the C code, if there is any.

Bob
Thank you for taking your time to answer!
 

aamir_uetn

Nov 19, 2017
1
Joined
Nov 19, 2017
Messages
1
my recommendation is choose one language (C is good), its better to grasp one with full concenration rather than being jack of all, master of none.
Moreover, if you learn one programming language, others are not much different
 

camerart

Aug 18, 2010
135
Joined
Aug 18, 2010
Messages
135
Hi,
I only 'speak' BASIC and it's not popular, but I still make interesting projects. (I'm not suggesting it!)
As the last post says, choose one language and learn it well, and I bet later you will be able to translate into it, at least from other languages.
Camerart.
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
I think you need to understand basics logic of device. on which logic device work. for example you know how does led work. if you want to turn on led. you will give supply and if you ant turn of led. you will remove power. Now suppose one led is connected to pin of microcontroller. so you have to write program that will turn on/off led. Now you can write this program in any language but more important thing is that your program should be followed the logic's
 

fnelson

Nov 28, 2017
3
Joined
Nov 28, 2017
Messages
3
I'd also suggest first to deeply learn one programming language, and only after that you can consider to expand knowledge to some similar.

Regarding to choice of language, it fully depends on your situation. If you plan to do low - level stuff (like microcontrollers) the C would be a good starting point. For application software development, some high level language would be more suitable (for example Java, C#...)
 

Doug3004

Sep 5, 2014
119
Joined
Sep 5, 2014
Messages
119
Kinda late, but here's my opinion.
Note that this is assuming you are mainly interested in embedded programming (not PC or larger computers):

1. C and then C++ are good to begin with, because you can easily learn how to write spaghetti code (jumping around using conditional GOTO statements), then you can convert the smaller jump sections to functions to get rid of all the GOTO jumps, and finally you can rewrite the program using Objects. You can do this in the Arduino IDE.

2. If you are interested mainly in microcontrollers then it is good to read a bit about ASM since it is the most literal (low-level) programming language there is. It is used for a lot of smaller microcontroller programming in the real world, where small runtime size and maximum speed are important. ...I have read online that there is a way to program the Atmel chips in Atmel Studio using ASM, but I've never tried it. Most other embedded chips provide a higher-level language but they still allow using ASM somehow.

(ASM is used for desktop computers, but not many PC programs are written in 100% ASM anymore, because it is relatively slow to write in. What's common is a program will be written in a higher-level language like C++, and then test-run. The slowest parts of the program are identified, and then those parts are re-written in ASM to get the whole thing to run as fast as possible while not spending huge amounts of time on it.

So certain parts of video game rendering engines, database programs and web server programs are often written in ASM. Hardware device drivers are also written in at least partly in ASM as well, to optimize their speeds.)


3. Also read up about what CPLD and FPGA chips are, and how they are programmed. It is a completely different type of process than what the Atmel / Pic / BASIC stamp / PC processor chips do. There are cheap CPLD and FPGA dev boards from China, but the learning curve for CPLD/FPGA programming seems to be pretty steep.

Below is not specifically embedded-programming-related, but anyway...

4. If you want to play with Java, the most-fun way to do that is to get a Android device (a phone or tablet) and then use Android Studio (it is a free download from Google) to write Android apps. Most Android devices with a SD card slot will allow you to install apps from an apk file on the SD card, if you enable developer mode. There are free guides and videos online about how to use Android Studio and write normal windowed apps, as well as full-screen animated games. 3-D games are kind of a heavy load for most Android devices; most Android games are really 2D or 2.5-D even though they may appear to be 3D.
 

sherisengweiyi

Dec 28, 2017
2
Joined
Dec 28, 2017
Messages
2
all answers from @kellys_eye are good, Just a few additional answer for your number 4 question.

C is the most suitable programming language for microcontrollers but, if your hardware needs real-time processing you are better of with assembly and machine coding.
 

Gumby_Kevbo

Jan 25, 2018
11
Joined
Jan 25, 2018
Messages
11
It is good to be proficient in C.

Additionally, I recommend becoming proficient in some form of assembly language. Knowing what the processor has to do to implement your high-level language is invaluable.

I have spoken with high level programmers that think that strings, integers, reals, etc. are somehow different sorts of memory because they declare the variables as if that were the case....they never understood that the declaration only provides the compiler with a context for how to treat references to the declared variable. I have met other programmers that declare all integers as DINT "just in case" and then wonder why their code runs slow. They don't understand why 6 nested procedure calls within a loop slows things down. They don't understand why keeping a large data structure as a global rather than passing it around results in much faster code. They assume that that compact code runs faster than code with more lines....etc. etc. I've had programmers react with scorn when I tried to explain how inefficient their code was forcing the hardware to run.

You can right very efficient code in assembly.

You can right very maintainable code in C.

If you understand assembly and what the compiler is likely to generate, then you can write code in C that is both efficient and maintainable. To get to this point, you will need to have written a lot of assembly code.

Once you have become proficient in one high level language, and one assembly language, it is generally pretty easy to learn another one....excluding things like LISP. Becoming a good programmer is more about learning how to break problems into manageable pieces, staying organized, etc. The language you code in can change over time and jobs, but the problem solving core is what will earn you a living.
 
Top