CS224 Lab 7-Programming PIC32 Microcontroller Solved

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

Rate this product

The C programming language to develop simple applications for the PIC32 microcontroller. The mikroC IDE (integrated development environment) will be used as the software environment, and the Beti PIC32 Trainer Pack will be used as the hardware environment in this lab. This lab will be implemented as a team (groups of 2).

Summary

Part 1  Preliminary Report/Preliminary Design Report: PIC32 programming with mikroC IDE for special tasks given.

Part 2 Implement and test the given problem in Beti PIC32 Trainer Pack.

DUE DATE OF PART 1: SAME FOR ALL SECTIONS Dear students please bring and drop your preliminary work into the box provided in front of the lab before 10:40 AM on Wednesday.. No late submission!

LAB WORK SUBMISSION TIMING: You have to show your lab work to your TA by 12:15 in the morning lab and by 17:15 in the afternoon lab. Note that you cannot wait for the last moment to do this. If you wait for the last moment and show your work after the deadline time 20 points will be taken off.

Part 1. Preliminary Work / Preliminary Design Report (40 points)

 

  1. Cover page, with university name, department name, and course name and number at the top, “Preliminary Design Report”, Lab # (e.g. 4), Section #, and your names and ID# in the middle, and the date of your lab at the bottom (one submission per team).
  2. Research and read about SFRs. Explain the differences between TRISx, PORTx, LATx and ODCx ports. Specify the special function registers (SFRs) for the I/O device(s) involved in Part2.a and Part2. b.
  3. Give the C code for Part2.a, with lots of comments, an explanatory header, well-chosen identifiers and good use of spacing and layout to make your program self-documenting.
  4. Give the C code for Part2.b, with lots of comments, an explanatory header, well-chosen identifiers and good use of spacing and layout to make your program self-documenting.

 

You can read Chapter 8.6 Embedded I/O Systems in the textbook  and learn about SFRs at http://ww1.microchip.com/downloads/en/DeviceDoc/61120D.pdf .

About the Beti PIC32 Trainer Pack

You only need to connect USB cable to the small PIC32 daughter board for both power supply and programming. Please check schematic files of the Beti board posted on Unilica if you need more information. The part number of the microcontroller we use is PIC32MX795F512L. You can refer to its datasheet (posted in Unilica) if you need more information. Note that you borrow a Lab-board containing the development board, connectors, etc. in the beginning. You are responsible for the lab board and you have to return all of them to the lab supervisor when you are done, otherwise you will lose points.

Part 2. Implementation using C and mikroC IDE

Part 2.a 

In this part, using 2 pushbutton switches for EN and DIR inputs, send an 8-bit pattern of 10001000 to the 8 LEDs, rotating its position by 1 each 1.0 seconds. When DIR=0 it rotates to the right, DIR=1 makes it rotate to the left. When EN=1, the pattern is displayed and rotates.  When EN=0, it is not displayed and its position is “frozen”, so that it continues from the last position when EN=1 again.

Part 2.b

In this part, you need to implement a function f(x)=x3 given below by using the seven-segment display (SSD) on the Beti board.

 

x= 1 2 3 4 5 6 7 8 9 10 11 12 ……. 18 19 20 21
f(x)=x3 1 8 27 64 125 216 343 512 729 1000 1331 1728 5832 6859 8000 9261

 

You should display f(x) values one by one on the 7-segment display with a delay of a few seconds. Since the 7-segment display has 4 digits, you can display only the first 21 numbers of the f(x).  When the 21st number of the series is displayed (it is 9261), the sequence should continue, starting again from the first number of the series.

 

  • lab7-h1a5co.zip