7:46 AM

PIC Microcontrollers

Posted by Bharath Raj A

A controller operates according to a program. This is stored digitally in the controller’s
memory in the form of a code, called machine code. This code is very difficult to
write by hand but, fortunately, a computer can help. Using special software,
the program is typed in as a sequence of understandable instructions (or mnemonics)
for the controller to execute. The software assembles the machine code from
these instructions.

Using a programming deck (photo opposite) the assembled machine code is copied
from the PC into the memory of the controller. The deck usually has several
light-emitting diodes, and push-buttons for testing the output and input channels
of the PIC while it is running the program on the deck. The PIC recommended for
the projects in this book have flash memory. Digital cameras use the same sort of
memory for storing images. The advantage of flash memory is that it
can be programmed and re-programmed over and over again, at least 100 times.So it
is ideal for developing the software for a robot.Key in the program a section at a
time,and test it as each section is completed. Later, parts of the program can be
amended or deleted if something is wrong. Or even completely replaced with
something entirely different.

As explained above, there is no need to write a program in the machine code in
which it is eventually stored. Instead, the programmer writes in assembler. All
PICs have the same assembler language, which has only 35 different instructions
in it. This makes it quick to learn. Assembler is a one-action-per-instruction
language. Step-by-step, the programmer tells the controller precisely what to do.
Programs are easy to follow and understand.

Some people find assembler difficult because assembler instructs the controller in very
small steps. They are not used to thinking in this way and prefer to program in bigger
steps.They use one of a number of high-level languages.These include several
dialects of BASIC, as well as C and C+. Instructions written in these languages
are more like ordinary English. This makes programming easier, though it is still
essential to pay strict attention to the syntax if the computer is to understand the
program. The machine code produced by the high-level language software
(called a compiler) is usually appreciably longer than the code of an equivalent
program written in assembler. It requires more memory to store it and the program
does not perform as fast as an assembler program. This is not a problem for the
robots described in this book, for the programs are short and high speed is not
required. If you wish to avoid any kind of programming, the machine code files
are available on the Companion Site (opposite p. 1). Download them into a PC,
then use a programming deck to copy them to the PIC.

0 comments:

Post a Comment