MAKING PIC MICROCONTROLLER INSTRUMENTS AND CONTROLLERS

Similar documents
PROGRAMMING AND CUSTOMIZING

Programming 8-bit PIC Microcontrollers in С

MSP430 Microcontroller Basics

THE AVR MICROCONTROLLER AND EMBEDDED SYSTEMS. Using Assembly and С

EasyPIC5 Development System

LabVIEW Graphical Programming

Laboratory 10. Programming a PIC Microcontroller - Part II

Microcontrollers. Principles and Applications. Ajit Pal +5 V 2K 8. 8 bit dip switch. P2 8 Reset switch Microcontroller AT89S52 100E +5 V. 2.

MECHATRONICS. William Bolton. Sixth Edition ELECTRONIC CONTROL SYSTEMS ENGINEERING IN MECHANICAL AND ELECTRICAL PEARSON

Embedded Systems Lab Lab 1 Introduction to Microcontrollers Eng. Dalia A. Awad

Input/Output Ports and Interfacing

EasyAVR6 Development System

Claus Kuhnel BASCOM. Programming of Microcontrollers with Ease. An Introduction by Program Examples

MT2 Introduction Embedded Systems. MT2.1 Mechatronic systems

ELCT708 MicroLab Session #1 Introduction to Embedded Systems and Microcontrollers. Eng. Salma Hesham

CONTENTS. dspicpro4 KEY FEATURES 4 CONNECTING THE SYSTEM 5 INTRODUCTION 6

Laboratory 9. Programming a PIC Microcontroller - Part I

melabs Serial LCD Firmware Version 1.0 2/7/07

VHDL. Douglas L. Perry. Third Edition

Fredrick M. Cady. Assembly and С Programming forthefreescalehcs12 Microcontroller. шт.

Department of Electronics and Instrumentation Engineering Question Bank

Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester

SECOND EDITION. Arduino Cookbook. Michael Margolis O'REILLY- Tokyo. Farnham Koln Sebastopol. Cambridge. Beijing

Display Real Time Clock (RTC) On LCD. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

Embedded Systems Architecture

Arduino Internals. Dale Wheat. Apress

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application...

USING LEDs, LCDs. AND GLCDs IN MICROCONTROLLER PROJECTS. Dogan Ibrahim. Near East University, Cyprus WILEY. A John Wiley & Sons, Ltd.

PVK40. User's manual. Feature Rich Development and Educational Kit for 40-pin Microchip PIC microcontrollers

MICROCONTROLLER BASED SMART FAN SYSTEM

Microcontroller basics

Arduino Cookbook O'REILLY* Michael Margolis. Tokyo. Cambridge. Beijing. Farnham Koln Sebastopol

MicroProcessor. MicroProcessor. MicroProcessor. MicroProcessor

Lesson 14. Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27)

ECE3120: Computer Systems Hardware & Software Development Tools

PIC16F87X. 28/40-pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features:

PIC Microcontroller Introduction

DATABASE SYSTEM CONCEPTS

TEVATRON TECHNOLOGIES PVT. LTD Embedded! Robotics! IoT! VLSI Design! Projects! Technical Consultancy! Education! STEM! Software!

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4

BIGdsPIC6. Development System. User manual

EE 390 Lab Manual, EE Department, KFUPM. Experiment #7. Introduction to Flight86 Microprocessor Trainer and Application Board

SH69P48A EVB. Application Notes for SH69P48A EVB SH69V48A JP2 J4(ICE_J4) S1 IDD TEST JP1 74HC273 JP4 JP3 74HC273 JP6 STKOVE JP7 SW1 J5(ICE_J5)

LABORATORY UNIT ON MICROCONTROLLERS ** AND FEEDBACK: AN INTRODUCTION

1. About this document General information Board layout Testing this product Circuit description...

ITT Technical Institute. ET2640 Microprocessors and Microcontrollers Onsite and Online Course SYLLABUS

The Atmel ATmega328P Microcontroller

An Introduction to Designing Ham Radio Projects with PIC Microcontrollers. George Zafiropoulos KJ6VU

Figure 1.1: Some embedded device. In this course we shall learn microcontroller and FPGA based embedded system.

melabs Serial LCD Firmware Version 1.1 3/5/07

Pre-Lab: Part 1 Using The Development Environment. Purpose: Minimum Parts Required: References: Handouts:

Table of Contents COMPANY PROFILE 1-1 SECTION 1. INTRODUCTION 1-1

MTRX3700 Mechatronics

DEV-1 HamStack Development Board

WIZTECH AUTOMATION SOLUTIONS (P) LTD., An ISO 9001:2000 and IAO certified company

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)

MICROPROCESSORS A (17.383) Fall Lecture Outline

Quick Start Guide for the Turbo upsd DK3300-ELCD Development Kit- RIDE

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.

Microsoft Visual Studio 2010

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

ELEN 226 Embedded Systems Electronic Engineering Technology

Lab Course Microcontroller Programming

Microcontrollers for Ham Radio

SKP16C26 Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

C for Electronic Engineering

BASIC INTERFACING CONCEPTS

A Sequence of courses using 8, 16, and 32 bit Microcontroller/DSP Boards

Manual of Board ET-PIC STAMP 18F8722-K22 ET-PIC STAMP 18F8722-K22

Diploma in Embedded Systems

ET-PIC 24 WEB-V1. o Central Processing Unit (CPU) o System. o nanowatt Power Managed Modes. o Analog Features

EMBEDDED SYSTEMS: Jonathan W. Valvano INTRODUCTION TO THE MSP432 MICROCONTROLLER. Volume 1 First Edition June 2015

CS-3410 Systems Programming Spring 2013

ATHENA32 PIC32 Evaluation Board ATHENA32. Product Datasheet. Francesco Ficili Date 13/01/2019. Pag. 1

Embedded Systems and Software. Serial Interconnect Buses I 2 C (SMB) and SPI

HCS12 Microcontroller and Embedded Systems: Using Assembly and C with CodeWarrior 1 st Edition

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6

MPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine

CONTENTS BIGAVR2 KEY FEATURES 4 CONNECTING THE SYSTEM 5 INTRODUCTION 6

Microcontroller Overview

The Unified Modeling Language User Guide

CHIPS Newsletter Vol 5 - Yahoo! Mail. Official Newsletter of

Laboratory Exercise 7 - Extended I/O & Parallel Processing

ME 515 Mechatronics. A microprocessor

M16C/62P QSK QSK62P Plus Tutorial 1. Software Development Process using HEW4

CMS-8GP32. A Motorola MC68HC908GP32 Microcontroller Board. xiom anufacturing

Computer Hardware Requirements for ERTSs: Microprocessors & Microcontrollers

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

A PIC-based LCD Display for Stand-Alone Instrumentation

Architecture of Computers and Parallel Systems Part 6: Microcomputers

THE LAB WORKSHOP MODELS ON MICROCHIP s PIC MICROCONTROLLERS IN EET PROGRAM

Goal: We want to build an autonomous vehicle (robot)

CTS. Specialist. Certified Technology. Sven Laurik EXAM GUIDE. Mc Graw Hill. Chicago San Francisco Lisbon. New York. London Madrid Mexico City Milan

Reprinted by permission of T&L Publications Inc. Copyright 2001 USB MICROCONTROLLERS FOR THE MASSES

MicroBolt. Microcomputer/Controller Featuring the Philips LPC2106 FEATURES

Introduction to 8051 microcontrollers

SH69P55A EVB. Application Note for SH69P55A EVB SH69P55A EVB SH69V55A

The Atmel ATmega168A Microcontroller

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Transcription:

MAKING PIC MICROCONTROLLER INSTRUMENTS AND CONTROLLERS HARPRIT SINGH SANDHU New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto

CONTENTS Preface xiu PART I The PIC 16F877A Chapter 1 An Introduction to the PIC 16F877A Microcontroller Unit The Microcontroller 7 Special Precautions and Notes of Interest 9 Data Sheets 9 Some Useable PICS 11 Chapter 2 Getting Started: The Hardware and Software Setup The Programmers 14 Loading the Software 15 Using the Software in the Windows Environment 15 Software Notes from MicroEngineering Labs 18 Chapter 3 Understanding Microchip Technology's PIC 16F877A: A Description of the MCU 16F877A Microcontroller's Core Features 22 Peripheral Features 23 Configuring and Controlling the Properties of the Ports 29 PORTA 29 PORTB 30 PORTC 31 PORTD 32 PORTE 33 TIMERS 33 Chapter 4 The Software, the Compilers, and the Editor The Basic Compiler Instruction Set 35 The PICBASIC PRO Compiler Instruction Set 37 PICBASIC PRO Compiler 42 Chapter 5 Controlling the Output and Reading the Input General 47 Programs That Create Output 48 Programs That Read the Inputs and Then Provide Output 48 Creating Outputs 48 13 21 35 47

viii CONTENTS Blink One LED 50 Blink Eight LEDs in Sequence 51 Dim and Brighten One LED 52 LCD Display 53 Controlling the Digital and Analog Settings 56 Writing Binary, Hex, and Decimal Values to the LCD 56 Reading a Potentiometer and Displaying the Results on the LED Bargraph 57 A Simple Beep 60 Advanced Exercise: Controlling an RC Servo from the Keyboard 63 Reading the Inputs 67 Read Keyboard and Display Key Number on the LCD 73 Read One Potentiometer and Display Its 8-Bit Value on LCD in Binary, Hex, and Decimal Notation, Also Impress the Binary Value on the Bargraph 74 Read All Three Potentiometers and Display Their Values on the LCD 76 Adding the Kind of Flexibility That Defines Computer Interfaces and Demonstrates the Ability to Make Sophisticated Real-Time Adjustments 78 Exercises 79 Chapter 6 Timers and Counters 83 General 83 Timers 84 TimerO 85 Timerl: The Second Timer 93 Timer2: The Third Timer 102 Counters 104 Exercises for Timers 112 Exercises for Counters 112 Chapter 7 Clocks, Memory, and Sockets 113 Sockets U3, U4, and U5: For Serial One-Wire Memory Devices 113 Which EEPROM Type Should You Use? 115 Socket U3 I2C SEEPROM 115 Socket U4 SPI SEEPROM 117 Socket U5 Microwire Devices 118 Socket U6 Real-Time Clocks 120 The LTC1298 12-Bit A-to-D Converter (Also Used in Socket U6) 124 Sockets U7 (and U8) 126 Chapter 8 Serial Communications: Sockets U9 and UIO 131 When and How Will I Know if It Is Working? 134 Using the RS485 Communications 137 Chapter 9 Using Liquid Crystal Displays: An Extended Information Resource 139 General 139 Using LCDs in Your Projects 142 Understanding the Hardware and Software Interaction 143 Talking to the LCD 144

CONTENTS ix The Hardware 144 Setting Out Our Design Intent 146 Liquid-Crystal Display Exercises 154 PART II The Projects 157 Chapter 10 Using Sensors (Transducers) 159 General 159 The Most Basic Question We Must Answer Is... 161 Types of Sensors 163 Two Interesting Resources You Will Want to Investigate 164 Chapter 11 Conditioning the Input Signal 165 General 165 Alternating Current Outline 166 Direct Current Outline 166 Simple Switches and Other Contacts 167 Circuitry for Conditioning dc Signals 169 Chapter 12 Conditioning the Output Signal 173 General 173 Chapter 13 An Introduction to the Eight Projects 177 The Web Site 177 The Eight Techniques 177 Notes 182 Chapter 14 The Universal Instrument: A Background Discussion 183 The Properties and Capabilities of a Universal Instrument 183 A Basic Temperature-Controlling Device 184 Notes 186 Chapter 15 Counting Pulses: A Programmable Tachometer 187 Project 1 187 Notes on Using Seven-Segment Displays 199 Chapter 16 Creating Accurate Intervals with Timers: The Metronomes 209 Project 2 209 TimerO 214 Timerl 224 Timer2 226 The Timer2 Program 229 The Watchdog Timer 230

Chapter 17 Understanding the Counters: Counting Marbles 233 Project 3 233 < Counting with an Escapement 240 Some Real-World Notes 243 Counting to a Register Using an Interrupt 244 Counting Directly into an Internal Counter 246 Using TimeM in Counter Mode 248 Special Notes for Timerl Usage 256 Chapter 18 A Dual Thermometer Instrument 259 Project 4 259 Chapter 19 An Artificial Horizon: A Table Surface That Stays Level 269 Project 5 269 Discussion 270 Setting Up the Hardware Connections 271 Building the Artificial Horizon Table 275 Gravity Sensor Exercises 277 Chapter 20 Building a Simple Eight-Button Touch Panel 279 Project 6 279 Chapter 21 Single Set Point Controller with Remote Inhibit Capability 293 Project 7 293 Chapter 22 Logging Data from a Solar Collector 301 Project 8 301 Microcontroller Hardware 304 Software 306 Chapter 23 Debugging 315 General 315 Debugging and Troubleshooting 315 First Problem That Must Be Fixed: The Microcontroller Crystal Must Oscillate 316 If the Chip Refuses to Run 318 Using the PBP Compiler Commands to Help Debug a Program 319 Commands That Can Provide Debug Output to a Serial Port 319 Dumb Terminal Programs 319 Solderless Breadboards 320 Debugging at the Practical Level 320 Configuring the 16F877A and Related Notes 324 Settings 326 Configuration 326 Options 327 Simple Checks 327

CONTENTS xi Some Programmer-Related Error Messages 328 Things I Have Noticed but Have Not Figured Out (and Other Mysteries) 328 Setting the Ports 329 Chapter 24 Some Real-World Projects You Can Build 331 Conclusion 335 Appendixes 337 Appendix A Setting Up a Compiler for One-Keystroke Operation 339 Appendix В Abbreviations Used in this Book and in the Datasheets 341 Appendix С Listings of PICBASIC PRO Programs on the Internet at melabs.com 345 Appendix D Notes on Designing a Simple Battery Monitor Instrument: Thinking about a Simple Problem Out Loud 347 Appendix E Using the Support Web Site to Help Make Instruments and Controllers 349 Index 351