Learn C for Embedded Systems Design with PIC Microcontroller

In summary: What other languages have you used, or is C the first one you are learning? Are you using the K&R book to self-study? Or do you have some other C learning resources?Have you used Assembly Langauge before? I think it might be more intuitive to learn PIC assembly first, and write some simple programs with assembly. Then look at how you can make them more readable and maintainable by writing them in C.Just going front-to-back in K&R is not a bad way to learn C, as long as you are comfortable with self-study.In summary, the individual is currently learning C as their first programming language in order to design a project using a PIC microcontroller. They are seeking advice
  • #1
AK2
39
0
I am currently learning C so that I can design a project using a pic microcontroller. I want to learn C first before studying the microcontroller. I want to ask, what topics should I learn, so that I will be using what I need to know to program the chip. Thanks
 
Engineering news on Phys.org
  • #2
AK2 said:
I am currently learning C so that I can design a project using a pic microcontroller. I want to learn C first before studying the microcontroller. I want to ask, what topics should I learn, so that I will be using what I need to know to program the chip. Thanks

What other languages have you used, or is C the first one you are learning? Are you using the K&R book to self-study? Or do you have some other C learning resources?

Have you used Assembly Langauge before? I think it might be more intuitive to learn PIC assembly first, and write some simple programs with assembly. Then look at how you can make them more readable and maintainable by writing them in C.

Just going front-to-back in K&R is not a bad way to learn C, as long as you are comfortable with self-study.
 
  • #3
Having a lot of experience with PICs, I would recommend the book Programming 16-Bit PIC Microcontrollers in C: Learning to Fly the PIC 24 by Lucio Di Jasio. This way, you can learn C and PIC programming simultaneously. I personally found this book quite helpful. You will need to purchase Microchip's 16-bit development system, and one of the projects requires a PC serial port which is not on some of the latest PCs, but serial port plug-in cards are cheap.
 
  • #4
berkeman said:
What other languages have you used, or is C the first one you are learning? Are you using the K&R book to self-study? Or do you have some other C learning resources?

Have you used Assembly Langauge before? I think it might be more intuitive to learn PIC assembly first, and write some simple programs with assembly. Then look at how you can make them more readable and maintainable by writing them in C.

Just going front-to-back in K&R is not a bad way to learn C, as long as you are comfortable with self-study.

I am a beginner in programming and C is the first language I am learning. I am/was using Sams Teach Yourself C in 21 days. I think I'm going to drop it because its voluminous. I was reading K&R for a while but I didnt really get it. I think I will go back to it since the book I'm using is making me feel C is impossible to learn. I just started reading K&R today and I'm understanding it. I can't explain it but I guess it because I like straightforward books more than books that kind of go around in circles. I have no experience in assembly. Is it a good idea to learn MATLAB and C at the same time. I just used MATLAB like a calculator.
 
  • #5
The book and development system recommended by Otto sound good. Be sure to check them out.
 
  • #6
Some topics that may be useful would be anything that shows how to deal with Registers. You will need a strong understanding of boolean algebra and the boolean numbering system. As for the C language, the basics are all you need: For-Loops, Do-Loops, If-Statements, etc. Generally, PIC Microcontrollers will have a particular library of commands that you can use. There are plenty of articles online to learn this.

I've done a few projects with microcontrollers (stationary solar tracker, serial communication, etc) and all have been with PICs. If you're trying to do something in particular, just email me and I'll write an article on my blog. Hope this helps.

P.S. Be sure to learn how to use Microchip's MPLAB. This is the hardest part about programming a pic. That and interfacing with the chip itself. Good luck


-----------------
Justin Coulston
<< e-mail address deleted by berkeman >>
TheModernEngineer.blogspot.com
 
Last edited by a moderator:
  • #7
I need like a comprehensive list of topics in C I need to learn in C, so that I can be atleast be comfortable in them before I start studying microcontrollers. After having a good understanding of microcontrollers I can think of a good idea for a project using microcontrollers for now. I have the book ''Programming and Customizing The Pic Microcontroller'' by Mike Predko. Thanks for the responses. I don't to learn a feature of C that I don't need to program the chip.
 
  • #8
AK, I was a C pro before I saw my first microcontroller (miC for short). It didn't look like anything I had ever done before. Beyond languages, there are a multitude of programming paradigms. You can't just write a program for a miC like you would see in the C books. For a micC, you have to ensure that volatile memory is placed in RAM and not FLASH, you have ensure that the startup code is placed at the zeroth address, there is no operating system in a miC to provide dynamic memory allocation so you must define all memory at compile time, and you have to write your own interrupts.

I really think you should just plunge straight into a C book designed for miC's. The only thing you need to know about the actual language of C is the bare basics: math operators and relational operators, bit-wise operators, include files and source files, functions, structures, pointers, branches, and loops. That's it. You don't even need to know much about the print() function even though you'll see it over and over in tutorials. Printing is provided by the OS and, like I said, the OS doesn't typically exist in a miC unless you put one there.

Bit-wise operations are the most important thing for miC's that you won't see much of in the C books . A typical operation in a miC is to get a flag register from memory and mask it to see if some operation is completed (an analog to digital conversion perhaps). You'll be doing that over and over.
 
Last edited:
  • #9
Or, if you can get your hands on BASIC Stamp Editor, you can plop that sucker down on top of an IC or and program in BASIC. It's really cool :P
 
  • #10
Okefenokee said:
AK, I was a C pro before I saw my first microcontroller (miC for short). It didn't look like anything I had ever done before. Beyond languages, there are a multitude of programming paradigms. You can't just write a program for a miC like you would see in the C books. For a micC, you have to ensure that volatile memory is placed in RAM and not FLASH, you have ensure that the startup code is placed at the zeroth address, there is no operating system in a miC to provide dynamic memory allocation so you must define all memory at compile time, and you have to write your own interrupts.

I really think you should just plunge straight into a C book designed for miC's. The only thing you need to know about the actual language of C is the bare basics: math operators and relational operators, bit-wise operators, include files and source files, functions, structures, pointers, branches, and loops. That's it. You don't even need to know much about the print() function even though you'll see it over and over in tutorials. Printing is provided by the OS and, like I said, the OS doesn't typically exist in a miC unless you put one there.

Bit-wise operations are the most important thing for miC's that you won't see much of in the C books . A typical operation in a miC is to get a flag register from memory and mask it to see if some operation is completed (an analog to digital conversion perhaps). You'll be doing that over and over.

thanks for the tips. I have covered some of the topics you mentioned. Guess I will have to work on the remaining and start studying the microcontroller. I will start with Bitwise operations.
 

1. What is C programming and why is it important for embedded systems design?

C programming is a high-level programming language used to develop software and applications for various platforms, including embedded systems. It is important for embedded systems design because it allows for efficient and precise control over hardware components, such as microcontrollers, and enables developers to optimize code for specific hardware requirements.

2. What is a PIC microcontroller and how does it relate to C programming?

A PIC (Peripheral Interface Controller) microcontroller is a small computer on a single integrated circuit that is used to control electronic devices. C programming is commonly used to write code for PIC microcontrollers, as it provides low-level access to hardware components and allows for efficient and compact code.

3. What are the advantages of learning C for embedded systems design with PIC microcontroller?

Learning C for embedded systems design with PIC microcontroller has several advantages, including the ability to write efficient and optimized code for specific hardware requirements, access to low-level hardware components for precise control, and compatibility with various platforms and devices.

4. Are there any prerequisites for learning C for embedded systems design with PIC microcontroller?

While prior knowledge of programming and electronics can be helpful, it is not necessary to have any specific prerequisites for learning C for embedded systems design with PIC microcontroller. This course is designed for beginners and covers all the necessary concepts and skills to get started with C programming for embedded systems.

5. How can I apply the skills learned in this course to real-world projects?

Throughout this course, you will work on hands-on projects that simulate real-world scenarios, such as controlling LED lights or reading sensor data. These projects will help you apply the skills learned in a practical manner and gain experience in using C for embedded systems design. Additionally, the concepts and techniques taught in this course can be applied to a wide range of embedded systems projects, making it a valuable skill for any aspiring embedded systems developer.

Similar threads

  • Electrical Engineering
Replies
10
Views
2K
  • Electrical Engineering
Replies
13
Views
1K
  • Electrical Engineering
Replies
8
Views
915
  • Electrical Engineering
Replies
2
Views
1K
Replies
9
Views
1K
  • Electrical Engineering
Replies
1
Views
556
Replies
2
Views
1K
  • Electrical Engineering
Replies
4
Views
758
  • Electrical Engineering
Replies
5
Views
2K
  • Electrical Engineering
Replies
4
Views
5K
Back
Top