a) 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.
b) 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.
c) 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.
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 (30 points):
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.
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.