ECE 3724 Microprocessors Lab Home page



Lab Manual
Lab Pairing
Lab Schedule, Supplementary Files used by Lab Exercises, Formal Lab Assignments
Lab Report Grading
ECE Logins, Accessing Files from Leto
Lab Policy, Lab Report format, Report Submission
Lab Practicum Groundrules
Editor for C programs, Programmers Notepad
Lab TAs, Grading
Course Software
USB-to-Serial
Serial Port Problem
Debug Checklist
Bootloader
PICSTART, ICD2, PICKIT2 Programmers
Data Sheets
Part Kits, Part Replacement, FUSES!!
Breadboards
yavin.ece Login for C compilation, Unix Primer
HI-TECH Compiler and compiler for later-version PIC18 micros (like the PIC18F4620) , HI-TECH Compiler Manual
Using different 'config.h' options for PIC18 processors other than the PIC18F242
Common Compiler Option Errors
Floating Point with the HI-TECH Compiler and the MCC18 Compiler
Short Oscilloscope Usage Guide

Lab Manual

Here is the Fall 2006 Lab Manual . Previous versions of the lab manual are not valid as updates to the experiments are made each semester.

The manual is in PDF format, and lab manuals for previous semesters are not valid. You are encouraged to save a tree and only print the experiments that have data recording requirements (not all of them do). Put the PDF on your laptop, and bring it to lab with you. Also, if you print out the lab manual on ECE printer resources, you will do significant damage to your print quota.


Lab Pairing

Beginning Spring 2006, we will begin using lab pairs when working on the lab experiment during lab time. You will be assigned your lab partner, and you can share all of the coding/hardware work of the lab. However, each lab partner has responsibility for submitting a seperate lab report (you cannot just copy your partner's lab report), and each partner must do the pre-lab before coming to lab. For hardware labs, you can help each other to perform the lab, but each partner is expected to have a working demo of the hardware on their breadboard. Lab partners will be reassigned for Lab #5, and for Lab #9. In the case of an odd number of students in the lab, the TA will ask for volunteers for people who would prefer to work by themselves on the lab. During the lab, please confine your help and conversations to your lab partner - the lab is not to be performed as a group project of multiple lab pairings. In your lab report, you must identify the person that was your lab partner. Your lab partner is intended to be a helpful resource during the regularly scheduled lab period. If you work outside of the regular lab period, you can either work by yourself, or with your lab partner, it is up to you. If you have issues with your lab partner, please talk to the TA first, and the TA will refer you to the faculty member who is the lab coordinator if necessary. Many labs use the last digit of the MSU Net ID to personalize the lab. If both lab partners have even numbers as the last digit, then use the lower of the two digits. If both lab partners have odd numbers as the last digit, then use the higher of the two digits. If one partner has an odd digit, and the other has an even digit, then use the higher of the two digits.


Lab Schedule, Current Semester

Supplementary files for lab exercises and FAQs for each lab that students have asked in the past.

Follow the above link to find the supplementary files referenced in the experiment writeups.


Lab Report Grading

TAs are supposed to have lab reports graded a week after they are submitted. If this does not occur, please contact the course instructor or the TA coordinator (Mr. Bill Chapman, chapman@ece.msstate.edu).


ECE Login Accounts

You must know your ECE login to access the lab manual or to submit lab reports. ALL students, regardless of major, who take an ECE course (even one that is cross listed as a CS course like ECE 3724) receives an ECE login account. You must know this account name in order to electronically submit your lab reports or check your graded lab reports. If this is the FIRST time that you have taken an ECE course, the student worker in the front desk in the ECE main office (Simrall 216) will have an account slip that has the username/password. If the student worker does not have your slip, or you have forgotten your username/password, then you will need to see Mr. Michael Lane (1st floor, office in Computer Lab, Rm 139). It usually takes a week for new accounts to be added after the 1st class day of the semester.

If you have forgotten your password or you are having trouble logging in, there is a 'password reset' station in Room 216. It is also possible for you to get your Linux password out of sync with the Windows password (can log in via SSH but not via a Window's machine); use the 'password reset' station to reset your password.

Please consult the ECE HELP DESK for instructions on how to log into ECE Unix machines and how to access files stored there; you will need to be able to do this for the hardware labs in order to run the C compiler.


ECE Department Lab Report Policy Document

You are expected to follow the ECE Department lab report policy document for lab report formatting.

Electronic Lab Submission, Due Date/Late Lab Report Policy

60% Pass/Fail Policy

You must earn at least a 60% average on your lab grade or you will fail the course regardless of your lecture grade. This policy is non-negotiable and is independent of the course instructor teaching your lecture session.


Lab Attendance

You are expected to attend every lab and stay until you have completed the lab or the time expires. This is to force you to make some progress on the lab during the lab period while you have TA access. If you do not complete the lab during the lab period, then it must be completed before the next lab meeting.

If you are late more than 15 minutes to lab then you forfeit the prelab points. If your prelab is not ready to be checked off when you walk in the lab door, you forfeit the prelab points.


Lab Practicum Ground rules

The last lab of the semester is a practicum. Ground rules are:

The lab practicum counts as one regular lab grade. The only grades that are assigned on the practicum are 100%, 70%, 30%, or 0%. Grades of 100% or 70% are considered as 'passing' and also give you 10 extra pts or 7 extra pts, respectively, added to your test pool.


Editor for C programs, use Programmers Notepad

When you begin writing C programs, one choice for file editor is the editor that is built into MPLAB® IDE. However, a better choice is Programmers Notepad , which is a general purpose editor. The best thing about Programmers Notepad is that it shows matching braces {} and allows you to expand/collapse code sections between matching braces. This will save you some syntax error headaches down the road; it also allows toggling of line numbers and many other features.


TA Assignments Fall 2006

TBD


James R. Sakalaukus (jrs229@msstate.edu)
Lee A. Hathcock (lah1@ece.msstate.edu)
RoobanVenkatesh KGT (rk219@msstate.edu)

Lab Grading Policy

Non-Formal Reports are worth 100 pts divided as: Prelab (20 pts), Lab performance (60 pts), Lab report (format, grammar) 20 pts

Formal Reports are worth 150 pts divided as Prelab: 20 (pts), Lab performance (60 pts), Lab report (format, grammar) 20 pts, Extra questions for formal report (50 pts)

Part of the 'Lab Performance' component is oral quizzing by the TA during lab check offs - if your circuit functions but you cannot answer the TA's questions about the circuit, do not expect to get much credit.


Course Software


Portable PC, and USB to Serial Port adapter

You are strongly encouraged to bring your portable PC to lab and use that instead of the laboratory PC. The hardware labs require the use of a serial port, and some portables only have USB ports. The following is a list of usb-to-serial adapters that have been verified to work with our requirements (this list is not inclusive!!!!)

Don't use the following USB adapters

Serial Port Problem

In lab #6, you implement a serial port interface on your PIC18 board and use the serial port of your portable PC to download programs into the PIC18. The correct output voltage on the transmit pin of the serial port is supposed to be negative, usually in the range -8 to -12V. This is the 'idle' condition. On a few laptops, I have seen this reversed, as a positive voltage (+8 to +12). The port still functions, but the idle condition is reversed. This will cause a problem later when you try to execute programs that have been downloaded into your board, as the bootloader program will never detect an idle condition and never jump to your program. When connecting the serial port in Lab #6, check for this problem. If your serial port exhibits this problem, you will need to use a USB-to-Serial port adapter that has the correct idle condition.

Debugging Checklists

PIC18F242 Programming, Bootloader Instructions

Beginning Summer 2004, we will be using a PIC18F242 serial bootloader as the primary means of programming your PIC18F242. The lab experiments have been re-arranged so that the serial port required to support the serial bootloader is connected in the first hardware lab. After the first hardware lab (Lab #6), you will be able to program your PIC18F242 at home via the RS232 port.

Complete instruction for using the serial bootloader are found HERE .

Previously, we used the ICD2 (in-circuit programmers, blue-hockey puck container) for PIC18F242 programming -- you can still use them, but the on-board wiring required to support them is now optional. If you try to use an ICD2 programmer, please ensure that power is applied to the ICD2 programmer via the USB connector BEFORE applying power to your board. Applying power to your board first can damage the ICD2 programmer.

Boot Loader under Linux

Here is a document that describes how to get the Jolt bootloader to run under Linux.

PICSTART PLUS, ICD2, PICKIT2 Programmers

To get a bootloader to work, you must first program the PICmicro with the bootloader code - this requires using an external programmer. A few PICSTART PLUS programmers are available in the micro lab and senior design lab - this has a zero-force-insertion socket on the front and accepts DIP packages. This requires you to remove the PICmicro from the board and place it in the programmer. You select the PICSTART programmer from within MPLAB by using the 'Programmer->Select Programmer' menu choice. These programmers cost approximately $200 from Microchip, and has a serial port interface.

If you have a surface mount PICmicro, then you must use an in-circuit programmer that allows you program the PICmicro as it sits on the board. The ICD2 programmer can do this; it looks like a blue hockey puck and several are floating around the department. This programmer also supports limited in-circuit debugging. These programmers cost approximately $150 from Microchip, has both a USB and serial port interface. The programming interface is a 6-pin RJ-11 (phone jack) connector, only five pins are actually used for programming. To use the ICD2, select this programmer from the list of available programmers within MPLAB.

In Summer 2005, Microchip introduced a new in-circuit programmer called the PICKIT2. The advantage of this programmer is that it is very inexpensive ($35). However, it has limited device support at this time (Spring 2006); for example, it does not support the 18F242, but does support the later version of this chip, the 18F2420. The PICKIT2 uses the same 6-pin programming interface as the ICD2, but it does not use a RJ-11 connecter. The connector on the PICKIT2 is a a flat 6-pin connector, and it does not ship with a programming cable, so you have to make a cable yourself. Also, the PICKIT2 programming software is seperate from MPLAB - you generate a hex file using MPLAB, then use the PICKIT2 GUI to import this file and program your device. The PICKIT2 has a USB interface for connecting to a PC.


Data Sheets

You will find these data sheets useful during these semester. These are used in either labs or homeworks.


Parts Kit , Parts Kit Replacement, FUSES!!

During this lab, you will build up a single board microprocessor system based on the PIC18LF242. The first hardware experiment is #6, and you will need to purchase the part kit ($55) from the TA at least one week before then, and preferably two weeks. Starting Spring 2006, You will also need the protoboard that you used in Digital Devices (ECE 3714). This protoboard will be needed on a continuing basis starting with Experiment #6, with the circuit remaining on the protoboard between experiments. If you are taking another lab course that requires a protoboard, then you will need to purchase a second protoboard. Spring

Starting in Spring 2005, the parts kit now includes a wirewrap tool. You may or not need an RS232 cable (DB9 male to DB9 female); if your labtop does not have a serial port and you purchase a USB-to-R232 adapter, then you do not need a RS232 cable. If your labtop has a serial port, then you will need to purchase a RS232 cable from Radio Shack or from some online store such as from Electronix Express, DB9 Male to DB9 Female, part number 045VM4.

You may purchase a used part kit from a previous semester from a student, but it is your responsibility to ensure that it is complete and the parts functioning. However, you may not use a pre-assembled protoboard. If you show up for the first hardware lab with more connections than needed for that lab, you will be asked by the TA to remove those connections. Part of the learning experience of this lab is to bring a microprocessor system to life from scratch, and using a pre-assembled protoboad from a previous semester defeats this purpose.

FUSES!!! -- by far the most common part that needs replacing are fuses. The fuses in your parts kit are PCB fuses that cost $0.50, and are purchased from Digi-key. You are given two fuses, and many of you will blow those in the first lab. You can buy them from me as I try to keep a many spares on hand, but I may not be around if you need a replacement fuse. The PCB fuses are not sold in any local stores around town. If you want a local source of fuses, go to Radio Shack and buy a 5x20mm fuse holder (about $2.50, part #270-0362, this is not the only type that will work) along with a pack of 5x20 mm (GMA type) fast acting glass fuses, 0.315 Amps (pack of 4, part #270-1046). Make sure your fuses are FAST ACTING, and the 0.315 Amp fuses are about the maximum amperage that you can use and still protect your circuit. By doing this, you do not have to wait until I am available to replace your fuse. This can be a life-saver when you are trying to finish a lab. Many of you may decide to operate without a fuse if you blow the ones that you have. This is risky, as you may blow your voltage regulator and wall transformer, and end up costing you far more money than what a replacement fuse would have cost.


Breadboards

The parts kit does not contain a breadboard; you will need need an unpowered breadboard that is at least the size of the one shown in the Lab Manual Appendix A (the typical breadboards sold by RadioShack are too small). One breadboard source is our student IEEE chapter - see Dr. Younan in the ECE main office to purchase one (contains a wiring kit as well). Many online stores carry breadboards also - Electronix Express carries some breadboards and wiring kits that are appropriate.


HI-TECH Compiler and compiling for later-version PIC18 micros (like the PIC18F4620) , HI-TECH Compiler Manual


When compiling for later-version PIC18 microcontrollers using the HI-TECH compiler, be VERY careful of the configuration bit settings. You should import the hex file produced the compiler into the MPLAB IDE and examine all of the configuration bit settings and ensure that you understand what each one means as the default settings are often not what you want.

Some pitfalls are:


Using different 'config.h' options for PIC18 processors other than the PIC18F242

If you are using a processor other than PIC18F242, then you will probably need to change the configuration options in the 'config.h' file used in the code examples within these lab exercises. First, look in the PICC18 Compiler Manual (see the previous section), and read the section titled 'Configuration Attributes' to determine the configuration attributes needed for your particular PIC18 processor. Here is an example 'config.h' file that has been modified to work with different PIC18 processors; you can do something similar for your own processor. The most important thing is to understand what each configuration option does and what its correct setting should be for your usage. You will have to read the datasheet for your PIC18 processor to determine this (look in the PIC18 datasheet section titled 'Special Features of the CPU'). After you produce a hex file for your processor with the new CONFIG bit options, import the hex file into MPLAB and see if the configuration bit options that are inherited from the hex file are what you expect them to be (use the 'Configure->Configuration Bits' menu selection in MPLAB after you import the hex file).


yavin.ece Login

You will need to use 'putty' or 'ssh' (secure shell) to login into 'yavin.ece.msstate.edu' for C-compilation. You also need to mount your unixhome directory via Samba so that you edit files on your PC have them accessible from yavin and vice-versa. If don't do this, you will find yourself constantly FTP'ing files back and forth.

A Unix Primer may be useful if you have never used a Unix/Linux machine before. All you really need to know are various directory related commands like 'ls' (list directory contents), 'cd' (change directory), 'pwd' (print working directory.


Common Compiler Option Errors

The correct command line to use with the compiler when compiling code for the bootloader is "picc18 -O -a200 -18F242 myfile.c". You leave off the "-a200" if you are compiling code to be programmed via the PICSTART® programmer or with the ICD2 programmers (blue hockey-pucks).

The following mistakes on the compiler command line can give you headaches:

The above problems are hard to detect as no errors are generated, your program simply will not work.

If you are compiling code that uses floating point numbers or "printfs" with longs and floats, the add the "-lf" switch.


Floating Point with the HI-TECH Compiler and the MCC18 Compiler


For the HI-TECH (picc18) compiler on Yavin (V9.50PL1 or later), if you require floating point float or double types, then use the compiler option '--double=32' and use all double types. This will use a 32-bit format that is essentially equivalent to the IEEE-754 single precision format. The float type for the PICC18 compiler always uses a non-standard 24-bit format, and 24-bits is very low precision (if you are using floating point in the first place, then I assume that you need both wide range and good precision, and the 24-bit format only gives you a wide range). If you decide to use the default 24-bit format, then be careful of the roundoff errors that are produced. If you do not use the '--double=32' option, the double data type also uses this 24-bit format.

The MCC18 compiler uses a 32-bit format equivalent to IEEE-754 single precision format for both float and double types, there are no other choices available.


Information for ECE 3724 Lab TAs

Hints on converting student .doc to .PDF for grading

To convert a .doc file to PDF from within MS Word, print to the 'Acrobat Distiller' printer. Occassionally, you might have MS Word crash during this process - One cause of this is the use of 'Arial Unicode MS' font in the document, which can happen if a cut and paste from a web page was placed into the .doc file. You can use the Find/Replace option in MS Word to find and replace 'fonts' of some type with another. When the find/replace menu comes up, look at the bottom, and chose the 'format' option, then chose the 'font' option. Replace 'Arial Unicode MS' with 'Times New Roman' and you should no longer have the problem.