Actions for C programming for the PIC microcontroller : demystify coding with embedded programming
C programming for the PIC microcontroller : demystify coding with embedded programming / Hubert Henry Ward
- Author
- Ward, Hubert Henry
- Published
- Berkeley, CA : Apress L.P., [2020]
- Copyright Date
- ©2020
- Physical Description
- 1 online resource (282 pages)
Access Online
- Contents
- 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, and 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
- Summary
- 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 how to use the industrial IDE, create and simulate a project, and download your program to an actual PIC microcontroller. You'll then advance into the main process of a C program and explore in depth the most common commands applied to a PIC microcontroller and see how to use the range of control registers inside the PIC. With C Programming for the PIC Microcontroller as your guide, you'll become a better programmer who can truly say they have written and understand the code they use. You will: Use the freely available MPLAX software Build a project and write a program using inputs from switches Create a variable delay with the oscillator source Measure real-world signals using pressure, temperature, and speed inputs Incorporate LCD screens into your projects Apply what you've learned into a simple embedded program.
- Subject(s)
- ISBN
- 9781484255254 (electronic bk.)
1484255259 (electronic bk.)
9781484255261 (print)
1484255267
9781484255247 (print)
1484255240 - Digital File Characteristics
- text file
PDF - Note
- Includes the Header File into Your Program
Includes index.
View MARC record | catkey: 41052075