Welcome to JRHackett.net - a site dedicated to "spreading the word" about the PICAXE® line of microcontrollers.
I am pleased to announce the publication of my first PICAXE book:
PICAXE® Microcontroller Projects for the Evil Genius
The Evil Genius book contains 18 major projects, from Hello, World! to Hail, Octavius! All the projects in Part I can be implemented using either an M-class PICAXE processor, or one of the newer (and more powerful) M2-class processors. The first processor in the new M2 line (the PICAXE-18M2) has already been released by Revolution Education Ltd. However, the Evil Genius book includes a considerable amount of information on all of the yet-to-be released processors as well, so you'll be ready for them when they arrive!
Part II of the Evil Genius book focuses on the development of several intelligent stand-alone peripherals for use in various 20X2-based master processor projects, and Part III culminates in the creation of Octavius, a sophisticated robotics experimentation platform featuring a 40X2 master processor and eight breadboard stations which allow you to develop intelligent peripherals to augment Octavius' functioning.
To get an idea of the material that's covered in the book, you may want to browse through the complete Table of Contents:
PICAXE® Microcontroller Projects for the Evil Genius
Part I: PICAXE Basics
1 Introduction to PICAXE Programming and Projects
Choosing a PICAXE Processor
Interfacing a Project with Your Mac or PC
Using RevEd’s Free Programming Editor or AXEpad Software
Programming in PICAXE BASIC
Breadboards, Stripboards, and PC Boards
Project 1: “Hello World”
Debugging a PICAXE Project
2 Introduction to Stripboard Circuits
Designing Stripboard Circuits
Tools for Stripboard Circuit Construction
Project 2: The USBS-PA3 PICAXE Programming Adapter
3 Designing and Building a +5V Regulated Power Supply
Designing a +5V Regulated Power Supply for Breadboard Circuits
Project 3: More Power, Scotty!
4 Hardware Overview of the PICAXE M2-Class Processors
Project 4: Cylon Eye
5 The Ins and Outs of PICAXE Interfacing
PICAXE I/O Interfacing
Setting Up an Interrupt Routine
Project 5: Mary
6 Introduction to ADC Inputs on M2-Class Processors
Project 6: A Three-State Digital Logic Probe
Part II: PICAXE Peripheral Projects
7 Introduction to the PICAXE-20X2 Processor
Advanced Features of the 20X2 Processor
Project 7: Implementing the 20X2 Master Processor Circuit
8 Infrared Input from a TV Remote Control
Reception and Transmission of Standard TV IR Signals
IR-Based Serial Communications
Simple IR Object-Detection
Experiment 1: A Simple TV-IR Input Circuit
Experiment 2: Interfacing the IR Circuit with the Master Processor
Project 8: Constructing the TV-IR Input Module
9 Interfacing Parallel LCDs
Understanding the Basics of HD44780-based LCDs
Experiment 1: Interfacing an HD44780-based Parallel LCD
Project 9: Constructing an Eight-bit Parallel 16 x 2 LCD Board
10 Serializing a Parallel LCD
Receiving Serial Data in the Background
Project 10: Constructing a Serialized 16 x 2 LCD
11 Interfacing Keypads
Decoding Matrix Keypads
Project 11: Constructing a Serialized 4 by 4 Matrix Keypad
12 SPI Communication
The MAX7219 8-Digit LED Display Driver
Project 12: Constructing an SPI 4-Digit LED Display
Learning to Count
13 Background Timing on the 20X2 Processor
Using Timer1 on the 20X2 Processor
“Deconstructing” a Matrix Keypad
Testing the “New and Improved” Keypad
Project 13: Constructing a Countdown Timer
14 Constructing a Programmable Multifunction Peripheral Device
Project 14: The Evil Genius Multifunction Peripheral Device
15 Developing Software for the Evil Genius MPD
Understanding the 20X2’s Built-in Comparator Hardware
Testing Our Comparator 1 Configuration
“We Interrupt This Program to Bring You a Keypress!”
Project 15: A Simple MPD Operating System
Part III: Octavius - An Advanced Robotics Experimentation Platform
16 Birthing Octavius
Project 16: Building Octavius
17 Driving Octavius
H-Bridge Motor Control Circuits
The L298 Dual H-Bridge Driver
Project 17: Constructing an L298 Dual DC Motor Controller Board
18 Programming Octavius
The MaxBotix LV-MaxSonar Ultrasonic Range Finders
Who’s in Charge Here?
Project 18: Hail, Octavius!
Epilogue: What’s Next for Octavius?
When I received my first copies of the book, I was a little surprised to see how dark many of the photographs are; in fact, in some cases important details are obscured. I have since learned that this is a limitation of black-and-white printing on porous paper. In any case, if you purchase the book, I'm sure the details in most of the photos will be important to you, so I'm including the following links that you can use to download zipped files containing all the original, full-color photos in the book: Ch. 00-06, Ch. 07-10, Ch. 11-13, Ch. 14-15, Ch. 16-18. (The file for Ch. 00-06 also includes the two Microsoft Word templates that I used to create the stripboard layouts in the book.
The above files also include full-size versions of the stripboard layouts for the more complicated projects in the book. I think the larger layouts will facilitate the construction of these projects. Finally, as I mentioned in the book, you can also download all the programs that are included in the book. Don't forget that there are both "M" versions and "M2" versions for all the programs that are written for M-class or M2-class processors. In each case, be sure to install the appropriate program for the processor that you are using.
The Evil Genius book is now available at PICAXE Microcontroller Projects for the Evil Genius.
If you decide to purchase the Evil Genius book, please use the above link. If you do, I'll get a small commission from Amazon, so I'll be able to spend even more time playing with (and writing about) PICAXE microcontrollers!
I feel very fortunate that Wayne Geary, a senior member of the PICAXE Forum, was willing to take the time to provide an extremely thorough editorial and technical review of PICAXE Microcontroller Projects for the Evil Genius. His detailed feedback, which I have divided into "Errata" and "Technical Clarifications," will be extremely helpful to all readers. If you discover additional errors as you read the book, or if something isn't written clearly, please email me at Ron@JRHackett.net with the details. I will periodically update the following lists of Errata and Technical Clarifications so that the book will be as clear and error-free as possible.
page 6, column 2, last paragraph
In this paragraph, and at various places throughout the book, I used roman numerals and the word "part" to refer to the three sections of the PICAXE Manual. However, my idiosyncratic terminology is at variance with the terminology that Revolution Education uses in its documentation. In order to clarify any possible confusion, the following are the "official" names of the three portions of the PICAXE Manual:
- PICAXE Manual 1: Getting Started
- PICAXE Manual 2: BASIC Commands
- PICAXE Manual 3: Microcontroller Interfacing Circuits
All three sections are available for downloading at the PICAXE website, and are invaluable reference materials for working with PICAXE processors.
page 30, column 1, first paragraph
The specifications for the template grid are incorrect. They should be listed as: snap = 0.1"; display = 0.4" (multiples of 4). Also, the downloadable file for the figures in Ch. 0-6 also includes the two Microsoft Word templates that I used to create the stripboard layouts in the book. (See Ch. 00-06. This is the same file that is listed above.)
page 34, Figure 3-6
I have no idea how this error ended up in the book; the caption for Figure 3-6 is entirely unrelated and incorrect! It should read "Bottom jumper being held in place by a spring clamp."
page 36, Caution
This sentence should read as follows: "If you plan to move the adapter from project to project, don't forget to include the 100k resistor that ties the serin pin to Ground"
page 61, Listing 5-3 (Mary.bas)
The following two lines should be added to the code at the beginning of the "Begin Main Program" section:
dirsB = %11111111 'portB is all outputs
dirsC = %10111111 'pin C.6 is fixed as an input
page 103, step 3
This instruction should refer to Figure 8-6, (not Figure 8-7, as incorrectly stated in the book).
page 104, column 2, first full paragraph, sentence 4
The reference to the "20X4" processor is a typo; it should read "20X2".
page 128, LCDhserinDriver.bas Program Listing
The first time the program is run, the #no_data directive should be removed or commented out, so that the custom characters will load into EEPROM. Once they have been installed, you can put the directive back in the program if you want to save some time in subsequent downloads.
page 139, column 1, paragraph 2, sentence 2
This sentence should read as follows: "As you can see, each possible key-press connects one, two, or three resistors in series…"
page 144, Listing 11-2
The program line that reads "case < 587 : char = 65" contains a typo; it should be "case < 587 : char = 55"
page 182, Listing 13-2
In the "select case key" structure, the comment for the second "case" statement (case < 385) is missing the letter "R."
page 191, Parts Bin
The third part up from the bottom of the Parts Bin should read "Two IDC Connectors, 5 X 2 female"
page 209, column 2, bullet 2
This line should read as follows: “Approximately 70% of 20X2 memory remains available…" (I modified the code somewhat after I calculated the 80% figure, and forgot to recalculate.)
First, a General Note
All the schematic diagrams in the book adhere to a standard convention: Whenever two lines cross, a small dot indicates that the lines are electrically connected; the absence of a dot signifies that the lines are not electrically connected. For example, if you look at the schematic presented in Figure 17-5 (page 230), you will see that the vertical line running down to the 1k resistor in the middle of the diagram has a small dot at the intersection with "Enable A" line, and another small dot at the intersection with "Enable B" line. Therefore, the horizontal and vertical lines are electrically connected at those two points, but the other lines that cross the vertical line (Inputs 2, 3, and 4; and "Sense B") are not electrically connected to the vertical line. Unfortunately, the dots do not appear as large in the book as they did on my computer monitor, so be sure to look carefully at each schematic as you work with it. Also, if you find a mistake in any of the schematics (a dot where it shouldn't be, or vice versa), please let me know.
page 5, Figure 1-2
The DB-9 connector shown in Figure 1-2 is for use with a classic serial connection to a Mac or PC. However, the vast majority of modern computers no longer have serial ports. If your computer only has USB ports, you will need a USB programming cable (see text for options). In that case, the "enhanced" parts (the 180 ohm resistor and the BAT85 diode) are not required, but if they are already installed in a circuit, a USB cable will still work properly.
page 41, column 1, paragraph 1, sentence 2 ("If you declare a word variable…")
"If you declare a word variable (e.g., symbol myWord = w0), make sure you don't also define a byte variable using either one of the two associated bytes (e.g., myGoof = b1)." As discussed later in the book, there are exceptions to the "rule." However, if you're just starting out, it's safer to follow this guideline.
page 65, column 2, paragraph 1, first sentence ("PICAXE processors…")
I meant to say: "All M-class and M2-class processors…" However, I should have said: "By default, all M-class and M2-class processors…," because it turns out that the M2-class processors do have additional ADC capabilities that weren't included in the preliminary documentation that I used while writing the book. Specifically, M2 processors can also base their ADC readings on an internal fixed voltage reference, and/or a voltage applied to a specific I/O pin. (For details, see the documentation for the "adcconfig" and the "fvrsetup" commands in Section 2 of the PICAXE Manual.)
page 83, column 2, last paragraph, first sentence ("Unlike the other X2-class processors…")
The 20X2 processor cannot be used with an external resonator, as can the 28X2 and the 40X2 processors. (See the clarification for page 174, below.)
page 85, column 2, last paragraph, sentence 3 ("If serial data is received…")
Although it wasn't included in the preliminary documentation that I used while writing the book, the M2-class processors do have a limited version of the X2-class "hserin" command. (They are capable of receiving a maximum of two bytes in the background - see the documentation for the "hserin" command in Section 2 of the PICAXE Manual.)
page 108, column 1, paragraph 1, sentence 2 ("An excellent two-part tutorial…")
The given links are currently broken for some reason. I am awaiting permission from EPE magazine in order to make the files available for downloading on this site. In the meantime, they are also available (as of 9/29/10) at the following links:
page 108, Table 9-1 and page 110, column 1, descriptions of LCD pin functions
Clarification 1 (Important!): Occasionally, you may find an LCD that has the two power pins (pins 1 & 2) reversed. Be sure to consult the datasheet for the LCD that you are using and, if necessary, reverse the connections for the two power pins.
Clarification 2: The terminology I used for the various LCD pins is in common usage. However, there are a few LCD manufacturers that use different designations for some of the pins. Again, be sure to consult the datasheet for the LCD that you are using.
Clarification 3: The majority of backlit LCDs draw less than 20 mA with the backlight on. If this is the case for the LCD that you are using, you can also power the backlight (pin 15) directly from a PICAXE output pin. This arrangement can enable your program to control the backlighting as needed, which can be especially helpful in reducing power consumption in battery-powered projects.
page 133, listing 10-3
If you decide to use the SeroutToLCD.bas program with a commercially-available serial LCD, you may need to modify it somewhat because many serial displays require a special "flag" byte before each command byte. For example, RevEd's AXE033 Serial LCD requires that the value 254 be sent before each command. (Of course, I prefer my approach, which eliminates this requirement! :-)
page 163, column 1, instruction 9 ("Insert all the remaining jumpers except…")
I forgot to mention that the exceptions also include the jumper that is placed on the bottom of the board, between R14 and T14 (see instruction 21).
page 174, column 1, paragraph 2, last sentence ("One reason is…")
For the 28X2 and the 40X2 processors, an external resonator is optional; these processors can also run from an internal resonator if you prefer to not include an external resonator in the circuit.
page 181 et al, listing 13-2, "Directives" section
The "#no_data" directive is not actually necessary, because the "#no_table" directive prevents the downloading of both the EEPROM and "table" data. However, I usually include it in my programs to clarify what's happening.
page 188, Figure 14-2
If you examine the schematic, you will see that I/O pins C.0 and C.6 are unused. Therefore, they could also be brought out to a (larger) breadboard connector if desired. (For my purposes, three I/O lines on the breadboard connector were sufficient.)
page 210, column 1, description of the four arrow keys
As the MPDOS.bas program is currently written, all the scrolling occurs on line two of the LCD; the data presented on line 1 does not scroll. Of course, you can modify the software to suit your needs.