Cargando…

C programming for the PIC microcontroller : demystify coding with embedded programming /

Go beyond the jigsaw approach of just using blocks of code you don't understand and become a programmer who really understands how your code works. Starting with the fundamentals on C programming, this book walks you through where the C language fits with microcontrollers. Next, you'll see...

Descripción completa

Detalles Bibliográficos
Clasificación:Libro Electrónico
Autor principal: Ward, Hubert Henry
Formato: Electrónico eBook
Idioma:Inglés
Publicado: Berkeley, CA : Apress L.P., ©2020.
Temas:
Acceso en línea:Texto completo
Tabla de Contenidos:
  • Intro
  • Table of Contents
  • About the Author
  • About the Technical Reviewer
  • Introduction
  • Chapter 1: Introduction
  • Programmable Industrial Controllers
  • Programming Languages
  • Machine Code
  • Assembler Language
  • C Programming Language
  • Different Programming Languages
  • The IDE
  • Summary
  • Chapter 2: Our First Program
  • The PORTS of the PIC
  • Good Programming Practice
  • The Algorithm
  • The Flowchart
  • The Program Listing
  • Using MPLABX IDE
  • Creating the Project in MPLABX
  • The First Program Turning On and Off an Output
  • The Main Aspects of a 'C' Program
  • The Comments and PIC Configuration
  • The TRISA and TRISB
  • A TRIS Example
  • Exercise 2-1
  • Setting the PORTS
  • The ADC (Analogue to Digital Converter)
  • Setting Up the Oscillator
  • Exercise 2-2
  • Waiting for an Input
  • Waiting to Turn the LED Off
  • Exercise 2-3
  • Comments
  • Testing the Program
  • Compiling and Running the Program
  • Testing the Program Practically
  • Summary
  • Exercise Answers
  • Chapter 3: Updating the Program
  • If This Then Do That
  • Saving the Old Program
  • Labels and the Goto Instruction
  • Exercise 3-1
  • While vs. If Then
  • Slowing the Micro Down
  • T0CON Register
  • Adding a One-Second Delay
  • Exercise 3-2
  • Delaying the Turn Off
  • Using Subroutines
  • Defining and Calling a Subroutine
  • The delay Subroutine
  • Calling the Subroutine from Within the Main Program
  • The Variable Delay and the For Do Loop
  • Local and Global Variables and Data Types
  • Type Char
  • Type Unsigned char
  • Type int
  • Local Variables
  • Global Variables
  • Exercise 3-3
  • Summary
  • Exercise Answers
  • Chapter 4: Applying What We've Learned
  • Controlling a Single Set of Traffic Lights
  • The Algorithm
  • The Configuration Words
  • The Analysis of the Program
  • Downloading the Program to a Prototype Board
  • Extending the Program to the Crossroads Traffic Lights
  • The Algorithm
  • The Program Analysis
  • Summary
  • Chapter 5: Real-World Inputs
  • Using Analogue Inputs
  • The ADCON0 Control Register
  • The ADCON1 Register
  • The ADCON2 Register
  • Creating the Required Acquisition Time
  • Example 1
  • Example 2
  • Changing the ADC Input Channels
  • A Basic Setup for the ADC
  • A Basic Program for the ADC
  • The Algorithm
  • Analysis of the Program
  • Summary
  • Chapter 6: Using the LCD
  • The LCD Controller
  • Instruction or Command Mode
  • Data Mode
  • Initializing the LCD
  • The Subroutine lcdOut ()
  • The Subroutine sendInfo ()
  • The New Aspects to PIC Programming in This LCD Program
  • Arrays
  • Using Pointers
  • Connecting the LCD in 8-Bit Mode
  • The Volt Meter Program
  • The Algorithm
  • The New Aspects of the Program
  • The gohome Subroutine
  • The sysVoltage Subroutine
  • The displayVoltage Subroutine
  • Changing the Main Part of the Program
  • Creating Special Characters on the LCD
  • Summary
  • Chapter 7: Creating a Header File
  • Header Files
  • Creating a Header File