Document Sample
CS490 Powered By Docstoc
					                                  CSIT 411: Programming for Embedded Microcontrollers
                                                     Spring, 2011

Dr. John Hansen
225 Fenton Hall
email:                                                                     Office Hours: MW 10:00 – 12:00
Phone: X3869                                                                                                  W 1:30 – 2: 30

Note: it is recommended that you NOT leave me voice mail at the above number. The Fredonia phone system has no mechanism for automatically
informing me when there is voice mail in my voice mailbox. As a result, you can contact me much more quickly via email than via voicemail.


         This course is an introduction to programming embedded microcontrollers. Microcontrollers are extremely widely
used in everything from industrial controls to automobiles to toys. Microcontrollers differ from microprocessors in that they
are almost “computers on chip”. That is, they contain almost everything that is needed to make them a functional computer
right on a single chip. For example, it is generally not necessary to add external memory or BIOS chips. Thus they are
especially useful in creating extremely small, simple devices that perform specific functions. While microcontrollers are pretty
much self-contained, it is important to recognize their limitations. Program and memory space is much smaller than you are
used to on more traditional computers, and input/output is not generally performed with a keyboard and monitor.

         Microcontrollers are incredibly cheap (some as low as 50 cents each, in quantity). As a result, they are generally
devoted to a single application or group of applications. Software for microcontrollers (called firmware) is generally written on
a PC and then uploaded to the microcontroller with a device called a programmer. The firmware program runs as soon as the
chip is powered up.

        This course will focus on Microchip’s PIC brand of microcontrollers. Many other companies make microcontrollers as
well and any of those products could just as easily been the focus of the course. I’ve selected the PIC in part because it is the
one I am most familiar with, but also because a useful development system is well within the “textbook” budget for a typical
course. Microchip is now the world’s leading vendor of 8 bit microcontrollers (It displaced Motorola in this position two years

         At the end of this course you should have a good grasp of the architecture of PIC microcontrollers and should know
how to develop your own projects using these parts. You will be familiar with the software used to develop programs and the
mechanism for programming chips. You will also have some understanding of how to interface microcontrollers with other
chips to expand their functionality.


          The main prerequisite of this course is the willingness to learn a number of new things, all at once. For most (probably
all) of the students in this course, this will be your first exposure to embedded programming and electronic design. There is a
lot of truly new material here and you must be prepared for the fact that this course does not simply build upon your knowledge
in previous courses.

         The course assumes a good knowledge of some programming language. The programming in this course will be done
partly in assembly language and partly in C (note: not C++). The programming involved in this course is not particularly
complex, and I don’t expect it will be a major hurdle for most people. Rather, the difficult part is becoming familiar with
creating software for an entirely new type of platform. PIC microcontrollers are reduced instruction set computers (RISC). If
you have taken a course in assembly language programming for Pentium processors, you will find this to be much simpler in
comparison, in that you will only need to learn a couple of dozen assembly language instructions.

        The course does not assume any background in electronics, but you should be prepared to learn some electronic theory
and practice in order to be successful in this course. Even though the focus of the course is on designing firmware,
microcontrollers are only useful if contained in real live circuits. Thus learning to work with electronic components will be an
essential part of the course.

Materials Needed

         There is no textbook for this course. However I will assign occasional readings that you can download from the
Internet. You will need a number of things for this course, and they must be mail ordered from a couple of different
companies. Assuming you decide to stay in the course you should get the following items immediately:


        1. A PicKit 2 programmer. Part number PG164120. $35 (less 25% for educational purchases). Note: there is another
             version of the PicKit 2 that costs $50. You need not spend the extra money on it. Also, there is an older PicKit version 1 and
             a newer PicKit 3. Do not buy these The price of this will appear to be $34.95, but you can get a 25% discount if you order
             from your .edu email address.

        2. A PIC16F690-I/P PIC Microcontroller. $1.91


        1.   A breadboard. Part Number PB-840
             If you like, you can buy a larger more expensive one, but this one will be adequate for the course.

        2. A set of jumper wires. Part Number JW-140

        3. An LCD display. $6.00 Part number LCD-1610 (if not available, get an LCD-117).

        4. A cheap multimeter (for measuring voltages, resistance, etc.). If you have or can borrow one of these, any
           multitester will do… you do not need to have the one specified here. However, if you don’t already have one, you
           can pick up one of these from Allelectronics.

        Part Number DVM-810 $7.95
         In addition, you should go to the microchip website and download MPLAB 8.63 if you are planning to work on
projects on your own PC. This software has already been installed on the computers in the CS computer lab, so you can work
there if you like. (see the
link on the bottom of the page).

         As the semester goes on, additional parts will be needed for projects. They will all be provided by the instructor at
cost, but budget $5- $10 for additional parts for the semester.

        You’ll note that there is no traditional textbook for this course. In part that is because you are being asked to buy a
number of other things in order to complete the course. In part it is because no one has yet written a really good text in this
area. As a result, it is absolutely critical that you attend every single class, since most of the information you need will come
from in class presentations.

Class Organization

         The class will meet once a week for a 150 minute session. Most weeks a new project will be assigned. The class will
consist of three kinds of activities. Most nights a significant amount of time will be devoted to lecturing about the theory that
lies behind that week’s project. Another part of the class will be devoted to a hardware construction example or programming
example that is designed to get you moving on that week’s project. Any time remaining will be available for you to get started
on the project in class. I will wander around and help out as needed. Do not assume that you will be able to complete each
project in class. You will need to have access to a programming environment outside of class. Fortunately, all of the software
needed to do this work is in the public domain, so you may download it for free. The software used in this course will require a
computer that runs Microsoft Windows. I have arranged for the software to be loaded on the computers that are located in the
Computer Science Department Lab (Fenton 115), so that you can work there as well.


        There will be two types of grading opportunities in this course. There will be a both a midterm and final exam which
will each account for 20% of your grade. These exams will cover theory that is taught in class and in the textbooks. There will
also be a series of assignments where you will build projects on your breadboards, and program the embedded microcontroller.
Evaluation will consist primarily of demonstrating that the hardware that you’ve built actually runs, though I will ask you to
submit your source code as well. Note: Your project will not be considered completed and handed in until you have
submitted the source code! These projects will account for 60 percent of your grade. In general, there will be one project
assigned each week. Try not to fall too far behind. My experience is that those students who do not do well in this course are
mainly those who do not devote enough time to their programming assignments and fall behind.

         I expect you to work independently in writing the programs for this course. I have no problem with your discussing
the assignments (or different approaches to the assignments) among yourselves, but I have found that often when two students
sit down together to jointly work on a program, or when one students sits down at a computer to “help” another student with a
program, they often come away with only one of the students understanding the code that was written. Let me be clear about
this: You must do your own programming in this course. It is not acceptable for students to work together on assignments,
even if they turn in separate and distinct programs.

Boilerplate Section

       Catalog Description: Programming and development for embedded microcontrollers. Embedded architecture,
programming considerations related to embedded systems development. Memory utilization, I/O, synchronous and
asynchronous serial communication. Utilization of timers, and interrupts. Development considerations for comparators, A/D
converters, USARTs and other on-board peripheral devices. Debugging, and utilization of test equipment such as multimeters
and oscilloscopes. Students will build a series of embedded projects of increasing complexity. Some very basic electronic
design principles are also included.

        Credits: 3.

        Frequency: Every other year.

        Prerequisite: CSIT 221.

       Learning Goals: this course meets the following learning goals of the Computer and Information Science Department:
2. Be familiar with the computer organization and system software.

         Opportunities to achieve the Learning Goals: There will be a series of programming/ circuit construction projects
that will facilitate student exploration of a range of microcontroller capabilities and programming environment features.

        CCC: None.

        Academic Honesty: University policies for academic honesty will be applied.

        Academic Calendar: See

Shared By: