How can i learn c for embedded system

Thread Starter

chris92

Joined Nov 13, 2013
7
Hi everyone i am a beginner in embedded system but quite experienced in high level programming languages. Am looking for the past 2 months how to get started with programming PICs with C language using mikroC. I have downladed a lot of their manual but it seems not to be helping. Thanks a lot
 

John P

Joined Oct 14, 2008
2,026
What exactly are you having trouble doing? Is it simply getting the MikroC programs to run, or is it starting a project, or writing code that the compiler will accept?
 

t06afre

Joined May 11, 2009
5,934
You can not learn how to swim without getting wet. And the same goes for embedded C. You have to use it in order to learn and like evrything some learning curve must be anticipated . A way to learn may be to create projects that you find interesting and at the same time fits your learning curve. Start simple like lighting and blinking LEDs. Then move to reading buttons. After that maybe learn to use ASCII LCD displays. At this moment making a clock could be a cool project. Along the way you must learn to use all the diferent debugging methods at your disposal.
 

ErnieM

Joined Apr 24, 2011
8,377
I don't know of anything for the Mikro compilers but here's something:

Check into the PICkit 3 Starter Kit. Here's some features:

The PICkit 3 Low Pin Count Demo Board is an update to the PICkit™ 2 Demo Board. Modifications to the previous LPC board (DM164120-1) were made so that the full functionality of the code can be debugged without the need of a debug header. The software has also been rewritten to accommodate new technologies.

The following is a list of new features:
1. Software is in both the ‘C’ and assembler language
2. Extension of the number of lessons and modules covered
3. MPLAB® X support as well as the older MPLAB® 8
4. New PIC16 enhanced mid-range and PIC18 routines
5. Uses the universal XC8 compiler

The board package contains one assembled board with area for prototyping circuits. The assembled board is populated with the PIC16F1829-I/P. It also ships with a sample of PIC18F14K22-I/P (20-pin) MCU.

The board schematic is available in the PICkit™ 3 User’s Guide (DS41628), Appendix A.

Even if you don't buy the kit you can follow the program lessons and run the code inside the simulator.
 

Thread Starter

chris92

Joined Nov 13, 2013
7
You can not learn how to swim without getting wet. And the same goes for embedded C. You have to use it in order to learn and like evrything some learning curve must be anticipated . A way to learn may be to create projects that you find interesting and at the same time fits your learning curve. Start simple like lighting and blinking LEDs. Then move to reading buttons. After that maybe learn to use ASCII LCD displays. At this moment making a clock could be a cool project. Along the way you must learn to use all the diferent debugging methods at your disposal.
Thats what i actually want to start with but what would help me do that at least. I just need a guide and i will be good to go. is there a text book than can at least explain to me the codes involved in blinking a led or reading buttons. Thanks a lot to everyone contributing to help me "walk"!
 

djsfantasi

Joined Apr 11, 2010
9,163
What other high-level languages have you programmed in? Most recently, I was programming in FreeBasic. Then, last weekend, I had written my first program in C in a couple of hours, with one piece of assistance from a forum.

I was programming on the Arduino. First, I started with their "blink" example, which taught me the basic template of a C program.

Then, on their home page, is a quick reference link to the keywords it supports, each one being a link to a more complete description of the syntax.

That was almost all I needed. My error was misconstruing/confusing the syntax between assignment operators and comparison operators.

So it isn't a daunting task. Get that first demo program running, and start writing your code. Now, bad coding practices will make any language difficult. Start with a flowchart, other diagram or pseudo-code of what you want your program to do before actually coding it in the language of choice. A couple of other pieces of advice:
  • Note whether the language requires all variable or functions to be defined before use.
  • Note if the language requires strong typing (an integer is not a character is strong typing).
  • Note syntax requirements (use of semi-colons at the ends of statements, use of braces to signify blocks of code, use of parentheses to identify calculations and sequences...)
  • Note what libraries are available for any complex tasks you wish to do. I used a servo control library.
 
Top