This is a set of excellent lessons from the following website: http://www.amqrp.org/elmer160/lessons/
PIC Elmer 160 Course Lessons
Course Instructor: John McDonough, WB8RCR firstname.lastname@example.org
(See the latest lesson at bottom of page)
Back to Elmer 160 Home Page
Back to AmQRP Home Page
- Lesson #1: Overview of the PIC microcontroller from a software perspective.
- Lesson #2: Download and installation of the MPLAB Integrated Development Environment.
- Lesson #3: First MPLAB project to validate that the installation is working correctly.
- Lesson #4: Here are some experiments using a few basic instructions in the PIC that manipulate the working register (W) and the file register (F).
- Lesson #5: In the previous lesson we saw some of the simpler instructions in the PIC. Many of the more interesting instructions affect a special register called the status register. In this lesson we explore those instructions. (Right-click to download Lesson5a.asm)
- Lesson #6: “Subroutines: — Often we have logic we wish to use several places in our programs. The subroutine provides a way to do this effectively. In this section, we will review subroutines, and look at delay timers, which is one example of where we may use subroutines. Right-click to download Lesson6b.asm or to download Lesson6c.asm code. Downloading these files will save you some time in typing the examples used in this lesson.
- Lesson #7: The PIC stores data as 8-bit bytes. Up until now, we have only used values of 8 bits or less. What if we have a greater range of values? In this section we examine addition and subtraction of larger numbers.
- Lesson #8: Up until now all of our programs have lived within the simulator. In this lesson we examine how the PIC can sense its environment and how it can influence the circuit where it lives.
- Lesson #9: In this lesson we cover assembler directives not covered elsewhere in the course: number formats (binary, octal, ascii, decimal, hex), radix, #define, ifdef-else-endif, erorlevel, mssg, listing interpretation, page, title, subtitle and list.
- Lesson #10: Here’s where we describe how to install software called “FPP” onto your PC that communicates with the PIC-EL board. FPP gives you the ability to burn new software into the onboard PIC.
- Lesson #11: In this lesson we use the FPP program to load our code into a PIC.
- Lesson #12: In this lesson we write a small program to exercise our hardware, and learn how using macros can simplify our code. Right-click to download:
- Lesson #13: Timer register, TMR0 is the focus of this lesson. TMR0 can, among other things, be used to manage performing multiple tasks simultaneously. Right-click to download:
- Lesson #14 Frequently, an application needs some sort of table. There are several ways of implementing tables depending on the application requirements. In this chapter we examine some of the more common approaches. Right-click to download:
- Lesson #15: Have you noticed how many of the microcontroller projects available these days use a rotary encoder to control functions, dial frequency, and more? In this lesson we will examine the types of encoders available and how to deal with them programmatically. Right-click to download:
- Lesson #16: Trying to use code from previous projects can be very tedious with the absolute code model discussed so far. Relocatable code helps with these issues. Right-click to download Lesson16code.zip.Once downloaded to a new folder on your computer, double-click on the file to unzip it and extract all files to that same folder. You’ll then have access to all the source assembler and library files for this lesson.
- Lesson #17: Most PIC projects seem to involve no more than some sort of input conditioning and a liquid crystal display. In this lesson, we examine how to control an LCD module. Right-click to download Lesson17code.zip. Once downloaded to a new folder on your computer, double-click on the file to unzip it and extract all files to that same folder. You’ll then have access to all the source assembler and library files for this lesson.
- Lesson #18: In the previous lesson we saw how to display ASCII text to the liquid crystal display. Frequently we want to display the result of a calculation or sensor. However, rarely is this data already in the ASCII format needed for the LCD. Some sort of conversion is frequently needed. In this lesson we will discuss methods of preparing data for display. Right-click to download Lesson18code.zip. Once downloaded to a new folder on your computer, double-click on the file to unzip it and extract all files to that same folder. You’ll then have access to all the source assembler and library files for this lesson.
- Lesson #19: When the designer makes a new circuit, there is often some time spent in developing the software for that circuit. Removing the PIC from the circuit and inserting it into a programmer, then reversing the process for each change soon gets tedious. Programming the PIC while still in the target circuit certainly speeds up debugging (and reduces wear and tear on the PIC’s pins.). However, allowance for in-circuit programming needs to be made when designing the target circuit. In this lesson, we will examine the requirements for designing circuits including PICs, and look at special considerations required if we wish to program the PIC in-circuit. We will use our demonstration circuit as an excuse to explore two peripherals lacking in the 16F84A, the analog input and the pulse width modulation output. Right-click to download Lesson19code.zip. Once downloaded to a new folder on your computer, double-click on the file to unzip it and extract all files to that same folder. You’ll then have access to all the source assembler and library files for this lesson.
- Lesson #20: In many applications we want the PIC to “walk and chew gum” at the same time. By periodically polling inputs or polling timers, the PIC can appear to carry out multiple tasks. However to be responsive to rapidly occurring events, the polling must be done very frequently. But more frequent polling means fewer compute cycles available for the “background” task. Using interrupts allows fast response to external events without wasting compute time on polling. Right-click to download Lesson20.zip. Once downloaded to a new folder on your computer, double-click on the file to unzip it and extract all files to that same folder. You’ll then have access to all the source assembler and library files for this lesson.
[NOTE: This lesson is a tad different in that the zip file not only contains the necessary sources and library, but also a library for those using newer versions of MPLAB, and a library and makefile for those using gputils.]
- Appendix “A”: “Other PICs” — This one is an appendix that students can read at any time. In it we examine the wide array of PIC microcontrollers and try to give the hobbyist some help in selecting a microcontroller for future projects.
- Appendix “B”: How to design a circuit to support In-circuit Serial Programming (ICSP™).
- Appendix “C”: In Lesson 16, we discussed relocatable code, and how to use a library. In this appendix, we review the mechanics of constructing a library.
- Appendix “D”: In Lesson 16, we mentioned that there were times when we might want to edit the linker script file. In this appendix we examine the linker script and discuss how we might want to change it.
- Library File for Latest MPLAB 7.21: Although we started the PIC Elmer series on MPLAB 6.30, and all lessons have been tested with 6.30, some students have downloaded more recent versions of MPLAB, either due to starting late, getting new PCs, or needing support for some new part. This has not been a problem until recently, as a new version of the linker around MPLAB 7.21 introduced a new library format.
The symptom shows up as an error of the form: “Error - Coff file format for xxxx.o is out of date”
Please download the new library file to resolve that issue. This is only for users of MPLAB >7.21, and for any lessons that require the LCD (17 and 19). Users of earlier versions of MPLAB should continue to to use the LCDlib distributed with the lesson. Future lessons will include both.