Intermediate C Programming for the PIC Microcontroller: Simplifying Embedded Programming

Intermediate C Programming for the PIC Microcontroller: Simplifying Embedded Programming
Другая компьютерная литература, Компьютерное железо
Год: 2020
Добавил: Admin 5 Май 21
Проверил: Admin 5 Май 21
Формат:  PDF (6957 Kb)
  • Currently 0/5

Рейтинг: 0/5 (Всего голосов: 0)

Аннотация

This book looks at some useful aspects of the PIC microcontroller. It
explains how to write programs in C so that you can use the PIC micro to
control a variety of electronics and DC motors. After reading this book, you
will be well on your way to becoming an embedded programmer using the
C programming language.
The Aims and Objectives of This Book
The main aim of this book is to introduce you to some useful applications
of programming PIC micros such as
• Creating header files
• Controlling seven-segment displays
• Using an LCD display with two lines of 16 characters
• Pulse width modulation
• Using driver ICs such as the ULN2004A
• Controlling DC motors, including stepper motors and
servo motors
• Using every aspect of the Capture, Compare and PWM,
CCP module in the PIC
• Using interrupts
• Writing to the EEPROM

Another useful piece of software is a suitable ECAD (electronic
computer-aided design) software program that supports 8-bit micros.
The ECAD software I use is PROTEUS. However, it is not free, so as well as
showing you how to simulate the programs in PROTEUS, I will show you
how to use a suitable prototype board to run the programs in a practical
situation.
If you want to go down the practical route, you will need to purchase a
programming tool and a prototype board.
The tools I use are either the ICD3 can (Microchip has now moved
onto the ICD4 can) or the PICkit3 programmer to download the programs
from MPLABX to the PIC.
The prototype board I use is the picdem2 plus DEMO BOARD and
a prototype board from Matrix Multimedia (although Matrix no longer
produces the more versatile board that I use).
This book was written based around using MPLABX V5.25.
However, the principles of how to create projects and write programs
are transferable to earlier and later versions of MPLABX. There may be
some slight differences in the details, but they shouldn't cause too many
problems.
The PIC that this book is based around is the PIC18F4525. This is a
very versatile 8-bit micro that comes in a 40-pin dual-inline package. As
long as the PIC you want to use has the same firmware modules, then the
programs in the book can easily be used on other PIC micros with some
minor modifications. However, you should always refer to the data sheet
for the particular PIC you use because some of the SFRs (special function
registers) may differ. For example, the PIC18F4525 uses the ADCON0,
ADCON1, and ADCON2 SRFs to control the ADC module but the 16F88
uses the ANSEL, ADCON0, and ADCON1 registers.
Throughout the book, I include program listings and I go through an
analysis of any new instructions that the listings introduce. With respect to
the first listing, I will assume that all of the instructions are new to you, the
reader.
Before we move into the book for real, I think it will be useful to you if
I explained a bit about what MPLABX is. It is an industrial IDE created by
Microchip. The term IDE stands for integrated development environment.
It is actually a lot of programs collected together to create a programming
environment:
• There is an editor, which is slightly more than a simple
text editor. However, in my early days, I used to write
my programs in Notepad.
• There is also a compiler program that converts your
program instructions from C to the machine code that
all microprocessor-based systems use. In the very early
days of programming, the programmers used to write
in this machine code. This was a bit before my time,
although in my early days, I wrote all my programs
in assembler. Assembler is the closet language to the
actual machine code that all micros use.
• There is also a linker program that will bring together
any include files that we wish to use in our projects.
• As well as these programs, there are a range of
programs that we can use to help debug our programs
or simply simulate them.
So this IDE is a very large collection of programs that make our job of
writing code much more efficient. Yet it’s free; well, I use the free version,
which is not as efficient as the paid version but it is more than good
enough for us.
I therefore hope that you not only learn how to program the PIC micro
but you also enjoy going through my book and that you produce some
useful projects along the way.

Комментарии к книге "Intermediate C Programming for the PIC Microcontroller: Simplifying Embedded Programming"

Комментарий не найдено. Будьте первыми!
Чтобы оставить комментарий или поставить оценку книге Вам нужно зайти на сайт или зарегистрироваться