Unformatted text preview:

CS/EE 5780/6780 Handout #1Spring 2007MyersLAB #1: The CSM12C32 Module and PBMCUSLK Project BoardLab writeup is due to your TA at the beginning of your next scheduled lab. Don’t put this off tothe last minute! In future labs, there will also be pre-lab work to complete before the start of thenext lab. NO LATE LAB REPORTS WILL BE ACCEPTED.1 Objectives• Gain familiarity with lab to ols and development board prototyping.• Learn procedures for assembling and downloading programs to the CSM12C32 module usingCodeWarrior.• Learn how to interface with the CSM12C32 module standalone and with the PBMCUSLKproject board.2 Tasks1. Download sample C-code to the CSM12C32 module using the project board.2. Create and download a 4-bit counter to the CSM12C32.3. Download C-code to the CSM12C32 in the stand-alone configuration.3 Microcontroller KitEach partnership can check out one mi crocontroller kit which includes:• PBMCUSLK project board• CSM12C32 module• 9 VDC universal AC/DC adapter• USB cable• RS-232 serial cable• Jump er wires ki t• MCU project development board CD• 68HC12 development board CD• Technical training 8-bit, 16-bit, and 32-bit processors CD• Various documentationBoth parties must be present to checkout the kit and sign the loan agreement. The entire contentsof the kit must be CLEAN, COMPLETE, AND IN WORKING CONDITION before thelast day of class. You are responsible for up to $250 for loss or damage.4 Other Useful InformationThe following is available from the course website:• Lab1 example code (Lab1Example.c)• Serial monitor code (hcs12serialmon2r1.zip)• Reference materials for the MC9S12C microcontroller.• Reference materials for the CSM12C32 module.• Reference materials for the MCU project board.• Reference materials for CodeWarrior.If you would like to work at home, you can download the CodeWarrior Development Studio forHCS12X Microcontrollers V4.6 (Special Edition) from the Freescale website after registering. Thereis a link on the course website. Note that this version is limited to 32K, but it should be sufficientfor this course.5 Saving Your WorkStudents should also bring a diskette or USB memory drive for saving work completed during thelab. Internet is available on lab machines for e-mail. IMPORTANT: NO WORK SHOULDBE LEFT ON THE LAB MACHINES.6 Procedures1. Download over USB:(a) Create a new CodeWarrior project and replace the contents of main.c with the contentsof Lab1Example.c (see tutorial at the end of this handout on how to create a project inCodeWarrior). The main.c file can be found under Sources.(b) Review the code and make sure you understand e ach of the instructions. Refer to theMotorola Data Sheet document for more detailed information.(c) Mount your CSM12C32 module to the J5 MCU Port on the Project Board, making surethat pin1 on the module matches up with pin1 on J5.(d) Connect your Project Board to your computer using the USB cable provided.(e) Make sure USER jumpers on your module have not been removed.(f) Compile and download your newly compiled program (see tutorial a the end of thishandout on how to download over USB).(g) In the debugger, press the green run button, or click Run→Start.(h) Press SW1 and SW2 (on the module, not the dip switches on the Project Board) andnote how LED1 and LED2 of the module board turn on and off. Also note how theLEDS (1-4) on the Project Board light up as well.(i) Now press buttons PB1 and PB2 on the Project Board and note how they performthe same action as SW1 and SW2 on the module. The code in Lab1Example.c tiesSW1 and PB1, and SW2 and PB2, and electronically enables the four LEDs. Refer topages 18 and 19 of the “Prototyping Board with Microcontroller Interface” document(mcuproject board.pdf) for more information.2. Construct, download, and run a simple four-bit counter program:(a) Create a lab directory on your lab PC. Use your own name for this directory. To minimizethe risk of someone stealing your co de, be sure to clean this directory of all your personallab assignments and code at the end of the session. Remember to save your work onyour own USB drive or floppy disk.(b) Mo dify the Lab1Example.c code to create a 4-bit counter that increments when SW1,SW2, PB1 or PB2 is pressed. For this program, the module will be plugged into theProject Board and use the available four LEDs.(c) Remember to review “Prototyping Board with Microcontroller Interface” (pg16-17) and“Application Module Student Learning Kit” documents (pg9-10) for more detailed in-formation about the interconnectivity of the module and Project Board.3. Download using serial monitor:(a) Download over USB the serial monitor to your module (see the tutorial at the end ofthis handout).(b) Disconnect the CSM12C32 module from the Project Board.(c) Plug the barrel connector, from the power supply, into the module.(d) Plug the serial cable from the computer into your module.(e) Create a new CodeWarrior project and replace the contents of main.c with the contentsof Lab1Example.c.(f) Compile and download your newly compiled program (see tutorial at the end of thishandout on how to download a program using the Serial Monitor).(g) If the program is not running, make sure to press the green run button, or click Run→Start.(h) Press SW1 and SW2 and make sure that the LEDS of the module turn on and off.7 Writeup1. Include printouts of your (commented!) counter program.2. Describ e any problems you encountered.8 TutorialsInterfacing using the PB MCU Student Learning Kit (PBMCUSLK)• Creating a C-code project in CodeWarrior:1. Start up the CodeWarr ior IDE on one of the lab machines by clicking the ICON or byfinding the shortcut under Start→Program Files→Freescale Codewarrior.2. A new window will pop up, choose the HC(S)12 New Project Window option. Give theproject a name and click OK. (If this window does not popup automatically, you canopen it with File→New. . .3. On page 2, select the model number of your module, MC9S12C32.4. On the next page, select C and make sure the other options are deselected.5. Click no on page 4 and 5.6. Cho ose ANSI startup code on page 6.7. On page 7 and 8, choose none and small, respectively.8. On page 9, select Full Chip Simulation, P& E Multilink/Cyclone Pro, and HSC12 SerialMonitor. These options allow you to create different builds of your program to be usedfor different interfacing options.9. Finally, click finish and your project will be created.• Downloading over USB:1.


View Full Document

U of U CS 5780 - Lab 1

Documents in this Course
FIFOs

FIFOs

10 pages

FIFOs

FIFOs

5 pages

FIFO’s

FIFO’s

12 pages

MCU Ports

MCU Ports

12 pages

Serial IO

Serial IO

26 pages

Load more
Download Lab 1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lab 1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab 1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?