O'Reilly logo

Microcontroller Based Applied Digital Control by Dogan Ibrahim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4

Programming PIC Microcontrollers in C

Microcontrollers have traditionally been programmed using the assembly language. This language consists of various mnemonics which describe the instructions of the target microcontroller. An assembly language is unique to a microcontroller and cannot be used for any other type of microcontroller. Although the assembly language is very fast, it has some major disadvantages. Perhaps the most important of these is that the assembly language can become very complex and difficult to maintain. It is usually a very time-consuming task to develop large projects using the assembly language. Program debugging and testing are also considerably more complex, requiring more effort and more time.

Microcontrollers can also be programmed using the high-level languages. For example, it is possible to use BASIC, PASCAL, FORTRAN and C compilers to program the PIC family of microcontrollers. Most of these compilers generate native machine code which can be directly loaded into the program memory of the target microcontroller.

In this chapter we shall look at the principles of programming PIC microcontrollers using the C language. C is one of the most popular programming languages used today and there are several C compilers available for the PIC microcontrollers. We shall look at how to program the PIC microcontrollers using one of the popular C compilers known as the PICC Lite C compiler, developed by the Hi-Tech Software.

PICC Lite is an efficient compiler ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required