PIC Projects for Non-Programmers
By John Iovine
3.5/5
()
About this ebook
John Iovine has created his next masterwork with PIC Projects for Non-Programmers. Engineers and hobbyists new to the PIC who want to create something today will find a valuable resource in this book. By working through the accessible projects in this book, readers will use a symbolic compiler that allows them to create ‘code’ via flowcharts immediately, getting their projects up and running quickly! The ability to create applications with the PIC from day one makes this a real page turner and a highly satisfying introduction to microcontrollers for both novices and readers who need to build their skills.
- Gets readers up and running fast with a quick review of basics and then onto ten tried-and-tested projects
- No languages to learn: Simply drag and drop the icons, plug in the settings and the PIC will respond to the commands
- Step by step guide to using Flowcode 4
John Iovine
Author of several successful PIC books including the PIC Microcontroller Project Book and PIC Robotics. He has written 25+ articles in such magazines as Make and Circuit Cellar. He owns Images Scientific Products which develops and sells kits for building electronic projects.
Read more from John Iovine
Scamdemic - The COVID-19 Agenda: The Liberal's Plot To Win The White House Rating: 3 out of 5 stars3/5Robots, Androids and Animatrons, Second Edition: 12 Incredible Projects You Can Build Rating: 3 out of 5 stars3/5Nuclear Experiments Using A Geiger Counter Rating: 0 out of 5 stars0 ratingsPIC Robotics: A Beginner's Guide to Robotics Projects Using the PIC Micro Rating: 4 out of 5 stars4/5
Related to PIC Projects for Non-Programmers
Related ebooks
Programming the BeagleBone Black: Getting Started with JavaScript and BoneScript Rating: 0 out of 5 stars0 ratingsAssembly Language Programming: ARM Cortex-M3 Rating: 0 out of 5 stars0 ratingsElectronics and Computer Acronyms Rating: 0 out of 5 stars0 ratingsArduino BLINK Blueprints Rating: 0 out of 5 stars0 ratingsNonlinear Electronics 2: Flip-Flops, ADC, DAC and PLL Rating: 0 out of 5 stars0 ratingsElectronics Projects with the ESP8266 and ESP32: Building Web Pages, Applications, and WiFi Enabled Devices Rating: 1 out of 5 stars1/5Running Small Motors with PIC Microcontrollers Rating: 0 out of 5 stars0 ratingsFearless Experiments With Microcomputers Rating: 0 out of 5 stars0 ratingsRaspberry Pi | 101 Rating: 0 out of 5 stars0 ratingsArduino for the Cloud:: Arduino Yun and Dragino Yun Shield Rating: 0 out of 5 stars0 ratingsPic® Micro Principles Teachers Pack V11 Rating: 0 out of 5 stars0 ratingsArduino: A Beginner's Guide to Arduino Programming Rating: 3 out of 5 stars3/5Programming Arduino with LabVIEW Rating: 3 out of 5 stars3/5PICAXE Microcontroller Projects For Makers Rating: 0 out of 5 stars0 ratingsPIC Basic Projects: 30 Projects using PIC BASIC and PIC BASIC PRO Rating: 1 out of 5 stars1/5Power Supplies for LED Driving Rating: 5 out of 5 stars5/5PIC Projects and Applications using C: A Project-based Approach Rating: 4 out of 5 stars4/5The Maplin Electronic Circuits Handbook Rating: 0 out of 5 stars0 ratingsMechatronics for the Evil Genius: 25 Build-it-Yourself Projects Rating: 0 out of 5 stars0 ratingsMake Your Own PCBs with EAGLE: From Schematic Designs to Finished Boards Rating: 5 out of 5 stars5/5Debugging Embedded Microprocessor Systems Rating: 0 out of 5 stars0 ratingsArduino Solutions Handbook: Design interesting DIY projects using Arduino Uno, C and C++ (English Edition) Rating: 0 out of 5 stars0 ratingsMicroPython A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsBanana Pi Cookbook Rating: 0 out of 5 stars0 ratingsMicrocontroller Projects in C for the 8051 Rating: 5 out of 5 stars5/5Electronics: A Course Book for Students Rating: 0 out of 5 stars0 ratingsPIC BASIC: Programming and Projects Rating: 3 out of 5 stars3/5Exploring Arduino: Tools and Techniques for Engineering Wizardry Rating: 4 out of 5 stars4/5Modern Electronic Test Equipment Rating: 4 out of 5 stars4/5Arduino: Complete Guide to Electronics for Beginners Rating: 0 out of 5 stars0 ratings
Electrical Engineering & Electronics For You
Electricity for Beginners Rating: 5 out of 5 stars5/5How to Diagnose and Fix Everything Electronic, Second Edition Rating: 4 out of 5 stars4/5Electrical Engineering 101: Everything You Should Have Learned in School...but Probably Didn't Rating: 5 out of 5 stars5/5Electrician's Pocket Manual Rating: 0 out of 5 stars0 ratingsThe Fast Track to Your Technician Class Ham Radio License: For Exams July 1, 2022 - June 30, 2026 Rating: 5 out of 5 stars5/5Programming Arduino: Getting Started with Sketches Rating: 4 out of 5 stars4/5Beginner's Guide to Reading Schematics, Fourth Edition Rating: 4 out of 5 stars4/5No Nonsense Technician Class License Study Guide: for Tests Given Between July 2018 and June 2022 Rating: 5 out of 5 stars5/5Ramblings of a Mad Scientist: 100 Ideas for a Stranger Tomorrow Rating: 0 out of 5 stars0 ratingsBasic Electricity Rating: 4 out of 5 stars4/5Electrical Engineering: Know It All Rating: 4 out of 5 stars4/5Beginner's Guide to Reading Schematics, Third Edition Rating: 0 out of 5 stars0 ratingsThe Homeowner's DIY Guide to Electrical Wiring Rating: 5 out of 5 stars5/5Electroculture - The Application of Electricity to Seeds in Vegetable Growing Rating: 0 out of 5 stars0 ratingsRaspberry Pi Projects for the Evil Genius Rating: 0 out of 5 stars0 ratingsUpcycled Technology: Clever Projects You Can Do With Your Discarded Tech (Tech gift) Rating: 5 out of 5 stars5/5Off-Grid Projects: Step-by-Step Guide to Building Your Own Off-Grid System Rating: 0 out of 5 stars0 ratingsThe Inventions, Researches, and Writings of Nikola Tesla Rating: 4 out of 5 stars4/5Very Truly Yours, Nikola Tesla Rating: 5 out of 5 stars5/5The Electrician's Trade Demystified Rating: 0 out of 5 stars0 ratingsElectronics Explained: Fundamentals for Engineers, Technicians, and Makers Rating: 5 out of 5 stars5/5Practical Electrical Wiring: Residential, Farm, Commercial, and Industrial Rating: 4 out of 5 stars4/5Solar & 12 Volt Power For Beginners Rating: 4 out of 5 stars4/5DIY Lithium Battery Rating: 3 out of 5 stars3/5Electronics Engineering Rating: 0 out of 5 stars0 ratingsProgramming the Raspberry Pi, Third Edition: Getting Started with Python Rating: 5 out of 5 stars5/5THE Amateur Radio Dictionary: The Most Complete Glossary of Ham Radio Terms Ever Compiled Rating: 4 out of 5 stars4/5
Reviews for PIC Projects for Non-Programmers
3 ratings0 reviews
Book preview
PIC Projects for Non-Programmers - John Iovine
Table of Contents
Cover image
Front-matter
Copyright
1. Flowcode Program Installation
2. Writing Our First Program Wink
3. Uploading Wink
into Microcontroller(s)
4. Binary Number System – Outputting Data
5. Reading Data on Input Lines
6. Language Reference Guide
7. Liquid Crystal Display (LCD)
8. RS232 Serial Communication
9. Analog-to-Digital Converters
10. Power Control from DC Motor to AC Appliances
Appendix A. Installing ECIO Drivers
Index
Front-matter
PIC Projects for Non-Programmers
This book comes with a free version of Flowcode 4.5, which is available on its companion site at www.elsevierdirect.com/companions. This free version of Flowcode 4.5 has a few restrictions, which are removed if you chose to purchase a full license for the software, though this is not necessary in order to use the book.
For further information on Flowcode and about the author, please visit John Iovine's website at http://www.imagesco.com
PIC Projects for Non-Programmers
John Iovine
Newnes Press is an imprint of Elsevier
Copyright
Newnes is an imprint of Elsevier
The Boulevard, Langford Lane, Kidlington, Oxford, OX5 1GB
225 Wyman Street, Waltham, MA 02451, USA
First published 2012
Copyright © 2012 Elsevier Inc. All rights reserved
No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or any information storage and retrieval system, without permission in writing from the publisher. Details on how to seek permission, further information about the Publisher’s permissions policies and our arrangement with organizations such as the Copyright Clearance Center and the Copyright Licensing Agency, can be found at our website: www.elsevier.com/permissions
This book and the individual contributions contained in it are protected under copyright by the Publisher (other than as may be noted herein).
Notices
Knowledge and best practice in this field are constantly changing. As new research and experience broaden our understanding, changes in research methods, professional practices, or medical treatment may become necessary.
Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using any information, methods, compounds, or experiments described herein. In using such information or methods they should be mindful of their own safety and the safety of others, including parties for whom they have a professional responsibility.
To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors, assume any liability for any injury and/or damage to persons or property as a matter of products liability, negligence or otherwise, or from any use or operation of any methods, products, instructions, or ideas contained in the material herein.
British Library Cataloguing-in-Publication Data
A catalogue record for this book is available from the British Library
Library of Congress Number: 2011933374
ISBN: 978-1-85617-603-3
For information on all Newnes publications visit our website at: www.elsevierdirect.com
Typeset by MPS Limited, a Macmillan Company, Chennai, India www.macmillansolutions.com
Printed and bound in the United States
12 13 14 15 10 9 8 7 6 5 4 3 2 1
1. Flowcode Program Installation
This chapter discusses step by step method for the installation of Flowcode 4.5. It also outlines the minimum system requirements for the installation. A free version of Flowcode 4.5 is available on the companion site (www.elsevierdirect.com/companion).
Keywords
Flowcode 4.5; Installation; www.elsevierdirect.com/companion
This book comes with a free version of Flowcode 4.5, which is available on the companion site (please visit www.elsevierdirect.com/companions and follow the instructions there). The free version of Flowcode 4.5 has a few restrictions, which are removed when one purchases a license. The free version has a 2 KB code limit in addition to limited icon components. The student version of Flowcode 4.5, which as of 2011 is under $100.00 USD, eliminates these restrictions.
Minimum System Requirements
• Personal Computer
• Pentium processor or greater
• Windows 98, XP, Vista and WIN7 compatible
• CD Rom drive
• 256 MB RAM
• 50 MB hard disk space.
Step 1
Open Windows Explorer, copy the URL into the address bar and select the Flowcode software. Start the installation by running the SETUP.EXE.
The start-up installation screen is shown in Figure 1.1.
Step 2
If the install program asks you if you want to install the PPP program (see Figure 1.2), the PPP program is specific to the use of Matrix Multimedia’s own PIC programmer hardware. If you elected not to use this programmer, you do not need this software. I chose to use the PPP programmer as well as microEngineering’s EPIC USB programmer. The Matrix Multimedia PIC programmer is a combination programmer/developer board that allows development. It has multiple DB9 connectors for connecting Matrix’s proprietary I/O boards. This programmer is discussed further in Chapter 3.
Step 3
The next screen asks you to input your name and affiliate organization (if any) (see Figure 1.3). Fill in the required information and select Next.
Step 4
The next screen is a standard license agreement form (see Figure 1.4). Select the acceptance radio box and hit Next.
Step 5
Unless you have a reason to change the destination folder for the installation, keep the folder at its default location (see Figure 1.5) and select Next.
Step 6
The following install screen asks you to confirm features installation, followed by the default programmer (see Figure 1.6 and Figure 1.7).
Step 7
The next screen asks you to confirm the installation, followed by the installation (see Figure 1.8 and Figure 1.9).
Step 8
The following screen asks for license key information (see Figure 1.10). If you are using the free version of Flowcode, select the Do not enter a key
radio option and leave the key information blank. Hit the Next
button.
Step 9
The following screen informs and confirms that you installed Flowcode sucessfully (see Figure 1.11).
The following screen is the start-up screen for Flowcode (see Figure 1.12).
With Flowcode installed, proceed to Chapter 2.
2. Writing Our First Program Wink
This chapter focuses on writing the Flowcode program titled Wink.
Writing this program involves a number of options to consider, each option has its own pros and cons. It provides instructions for each option mentioned. Coding and running the program is based on Flowcode's built-in simulator. The chapter provides information regarding the choice of PIC microcontroller. It also includes running the simulation to check the program function.
Keywords
Wink; Coding, program; Writing, program; PIC microcontroller; Flowcode
In Chapter 1 we installed Flowcode onto our computer. Now let’s jump in and use it. Usually one explains the syntax (language) of a particular compiler before jumping in to write a program. Since Flowcode is a flow-charting graphic language technically there is no syntax, so let’s see how easy it is to write a working program using its graphic interface. Being a graphic interface, there are screen images to guide you through.
Our first Flowcode program is titled Wink.
What Wink accomplishes is to alternately light two LEDs connected to two Input and Output (I/O) lines to a PIC microcontroller. While this is a simple program, we still have a number of options to consider before we start writing our flowchart program. Each option has its own pros and cons.
Option 1: Write the program and run the program within Flowcode’s built-in simulator.
Pros: Easy to do and immediate. Does not require PIC microcontroller, or any external components; no hardware is required. This is a great educational tool to get you up and running.
Cons: Program execution is a simulation. It’s not the real thing and things happen in the real world unaccounted for in simulations.
Option 2: Write the program; compile the program into Hex code. Upload the Hex code program (firmware¹) file into a PIC microcontroller using a PIC-compatible programmer. Take the programmed microcontroller and prototype (build) a simple electrical circuit to test the program.
¹Firmware is the programmable content of a hardware device, which in our case is the PIC microcontroller. Typically firmware is loaded into a hardware device and not updated. An example would be the various timing and wash cycles programmed into a washing machine or dishwasher’s microcontroller.
Pros: Real world implementation of software. This option provides experience building and testing of real world devices.
Cons: This option requires hardware and components, a PIC-compatible programmer and a spoonful of electronic components to build the test circuit.
Option 3: Write the program; compile the program into Hex code. Upload the program (firmware) directly into an ECIO28 or ECIO40 PIC microcontroller using the computer’s USB port.
Pros: Same as those listed for Option 2, plus this option saves you from purchasing a standalone programmer. Instead it requires you to purchase a more expensive ECIO28 or ECIO40 USB-compatible microcontroller. The ECIO is a PIC microcontroller on a small carrier board containing a USB interface. It is used just like a PIC microcontroller to build a simple circuit to test the program. This option also requires a spoonful of electronic components to build the test circuit.
Cons: As mentioned, the ECIO is a more expensive alternative than a standard PIC microcontroller. If you were going to produce a product it would be far less expensive to buy a PIC-compatible programmer and program the microcontroller directly.
Which Option to Take?
I can’t answer that question for you, so we will provide instructions for each option mentioned above. You decide your own path. The Flowcode program is the same for all the options, so the coding instructions will apply. However, there is an exception with option 3: when the Flowcode software (or new project file) is started you need to choose the ECIO28 or ECIO40 for the PIC microcontroller chip. In this chapter we will focus on the coding of our simple program and running the program in Flowcode’s built-in simulator. Real world options 2 and 3 will be covered in Chapter 3.
Our first question is Which PIC microcontroller should we choose to start writing code for?
There are a wide variety of PIC microcontrollers to choose from. I am inclined to use the PIC 16F88, and I will do so later on. To begin with, I want to start with the old 16F84. Why? I chose the 16F84 because this PIC chip has been around so long there are thousands of programs available on the Internet. The procedures you’ll learn using this chip are directly applicable to later and larger PIC microcontrollers, so no learning is lost using the 16F84. However, the 16F84 is obsolete at this point in time. So if you prefer to begin your work using the 16F88 chip immediately, feel free to do so.
Selecting a microcontroller to write