Next step C coding for electrical engineer Stuff

In summary, the conversation revolves around a student's interest in learning coding for hardware, specifically microcontrollers. They have a background in C programming and are looking for resources and advice on how to get started. Some suggestions include familiarizing themselves with programmable logic devices, learning about hardware ports and interrupts, and possibly using a development board. The conversation also touches on the use of libraries and the potential impact on program size.
  • #1
Weightofananvil
34
1
hi,
I'm an electrical engineering student and have studied c programming. Everything I was doing however was just to familiarize myself with c and the language, therefore just executable programs that could create a database, or make an array or data to programs that aided me like a resistor color band program or math performing applications. you know, new guy stuff.

I know the next step in my education is learning microcontrollers and eventually a pic controller or similar based platform. I want to get a head start on programming for hardware. I've been playing with arduino for a few year and have coded small projects (not easily at all) and I can understand most code I've used for larger scale projects. However I know I could not have processed the code myself.

Where can I find specific information/tutorials on coding for hardware?

I know obviously practicing is the way to learn but I just don't know where to look to get the basics.

in elec engineering is c++ used ? Would a better idea be to start learning c++?

any books, webpages, videos. Etc much appreciated...

Thanks
 
Technology news on Phys.org
  • #2
...Where can I find specific information/tutorials on coding for hardware?...
I would definitely start to learn about programmable logic devices if I were you.
You can read any books about micro-controllers you want but be sure that you need only to extract the concepts not really the particular know-hows or the libraries written to target specific platform the books offer. Manufacturing industrial robots in known companies requires more disciplines and constraints. Either C or C++ or any others e.g python, scala etc is fine to get you a heads up on building things you prefer. Programming languages to me are only useful means either to control the programmed or already configured devices or to evaluate the models of the automated systems under development.
This link offers something about your likes also.
 
  • #3
Weightofananvil said:
in elec engineering is c++ used ? Would a better idea be to start learning c++?
No. C++ assumes a (huge) library is present. Inside a microcontroller you do not have anything (except if the manufacturer provides something).

Remember: You have no screen and no keyboard. You might possibly have a serial interface you can use. Your best bet is to familiarize yourself with the JTAG interface. If it is present, you will be able to load the code and debug it using a PC.
 
  • #4
It's amazing how much the libraries increase the size of the program.
In second year we had to write a program to run on an ATMega 64.
My program was taking up ~12% of the available EEPROM. When I needed a few math functions and included math.h it shot up to 90%.

Look into getting a development board from some chip, lots of new stuff to learn around interupts, and timers, and controlling I/O pins and so forth
 
  • #5
Okay, I have taken a digital logic class and we used altera quartus and the cyclone FPGA. Is there any cheap ones you recommend? any specific programs? We did mostly block diagram style programs ending with the architecture of a basic computer/cpu. I've heard libraries are a killer and that its tough because you can't just steal the bit of the library you are using.

In my schooling we made a robot project using an atmega328 and next year we will be programming that to sensors and other functions. I'm just trying to get a bit of a head start.
Thanks for the replies guys!
 
  • #6
Pepper Mint said:
I would definitely start to learn about programmable logic devices if I were you.
You can read any books about micro-controllers you want but be sure that you need only to extract the concepts not really the particular know-hows or the libraries written to target specific platform the books offer. Manufacturing industrial robots in known companies requires more disciplines and constraints. Either C or C++ or any others e.g python, scala etc is fine to get you a heads up on building things you prefer. Programming languages to me are only useful means either to control the programmed or already configured devices or to evaluate the models of the automated systems under development.
This link offers something about your likes also.
Thank you for the link! I am going to start reading ASAP.
 
  • #7
Hey Weightofananvil.

I'd suggest you getting the programming specification for the platform you are using and look at things like hardware ports, interrupts (as mentioned by a poster above), memory locations for certain functions and the instruction set it uses.

Different platforms do things differently and if you are using the embedded, logic controller stuff, then you will probably end up having to do some assembly coding.

As far as procedural languages go, C is the closest to this sort of thing next to using mnemonic assembly code. There are versions of C that are designed for embedded devices and you should look those up.
 
  • #8
Embedded Linux is becoming more important as the computer on a chip systems like Raspberry Pi and C.H.I.P. evolve. A good overview of the concepts is contained in "Linux for Embedded and Real-Time Applications" by Doug Abbott. I also highly recommend the Raspberry Pi kit with one of the many tutorials. One of the problems with C++ OOP for small embedded programs is the way Object Oriented code includes large libraries ("You wanted a banana but you got a gorilla holding a banana").
 
Last edited:
  • Like
Likes QuantumQuest
  • #9
cpscdave said:
It's amazing how much the libraries increase the size of the program.
In second year we had to write a program to run on an ATMega 64.
My program was taking up ~12% of the available EEPROM. When I needed a few math functions and included math.h it shot up to 90%.

Look into getting a development board from some chip, lots of new stuff to learn around interupts, and timers, and controlling I/O pins and so forth

Tell the compiler to remove the dead code. Add the -fdce (GCC) flag to your compile line, it's not on by default.
 
  • #10
Svein said:
you do not have anything (except if the manufacturer provides something).

Or the tool provider or some other 3rd or nth party provides it. C++ is perfectly viable on many modern-ish cpus. Nothing in an intel cpu or general purpose desktop system provides anything C++.

cpscdave said:
It's amazing how much the libraries increase the size of the program.
I use several processors that don't have any multiply at all. Floating point takes almost 10k just to do 2.0 + 2.0. Most compilers will eliminate unused parts of the libraries however sprint and varients uses lots of floating point so if your CPU is not FP native then you will take a hit.

BoB
 
  • #11
FactChecker said:
"You wanted a banana but you got a gorilla holding a banana"

You can get it down to a monkey of you are careful of the features you use.

BoB
 
  • Like
Likes FactChecker
  • #12
rbelli1 said:
You can get it down to a monkey of you are careful of the features you use.

BoB
I agree if you have control of it and can keep it simple. I highly recommend keeping things as simple as possible. It seems like everyone who writes a class thinks he has to develop a whole new language, overload every operator, and turn it into a MATLAB competitor.
 
  • Like
Likes rbelli1

What is the purpose of learning C coding for an electrical engineer?

C coding is a widely used programming language in the field of electrical engineering. It allows engineers to write efficient and portable code for embedded systems, microcontrollers, and other hardware devices. Learning C coding enables engineers to design and develop complex and high-performance electrical systems.

Do I need any prior experience in programming to learn C coding?

While prior programming experience can be helpful, it is not a requirement for learning C coding. However, a strong understanding of fundamental programming concepts like variables, data types, loops, and functions can make the learning process easier.

What are the key concepts that I need to understand in C coding for electrical engineering?

Some of the key concepts that you need to understand in C coding for electrical engineering include data types, variables, arrays, functions, pointers, structures, and file handling. These concepts are essential for writing efficient and reliable code for electrical systems.

Are there any specific tools or software that I need to learn for C coding for electrical engineering?

There are many tools and software available for C coding, but the most commonly used one for electrical engineering is Integrated Development Environment (IDE). IDEs like Code::Blocks, Keil, and MPLAB provide a user-friendly interface for writing, compiling, and debugging C code for electrical systems.

What are some useful resources for learning C coding for electrical engineering?

There are many online tutorials, books, and courses available for learning C coding for electrical engineering. Some popular resources include "C Programming for Embedded Systems" by Kirk Zurell, "Programming in C" by Stephen G. Kochan, and "Embedded C Programming" course on Udemy. Additionally, there are many online forums and communities where you can ask for help and guidance while learning C coding.

Similar threads

  • Programming and Computer Science
Replies
2
Views
316
  • Programming and Computer Science
Replies
8
Views
880
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
2
Replies
58
Views
3K
  • Programming and Computer Science
Replies
22
Views
2K
  • Programming and Computer Science
Replies
30
Views
2K
  • Programming and Computer Science
Replies
15
Views
5K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
4
Replies
118
Views
6K
Back
Top