X hits on this document





2 / 4

PIC32 Software

These are the primary Microchip folders and files we are interested in. Remember these summaries of what's in each of them:

    • C:\Program Files\MPLAB C32\pic32-libs\include Contains the file and two folders below (among other things):

      • o

        plib.h: the header file which includes the header files for the peripherals.

        • o

          peripheral: a folder of the .h header files for peripheral library functions for all the peripherals: adc10.h, i2c.h, ports.h, etc.

        • o

          proc: a folder that contains one .h header file for each particular PIC32. These files make processor-dependent definitions. Ours is p32mx460f512l.h.

    • C:\Program Files\MPLAB C32\pic32-libs\peripheral Contains folders named adc10, i2c, ports, etc., with source code for each peripheral. Many of these are empty, because the .h files provide all we need to use the peripheral.

  • 10.

    When you first started programming your PIC, you put a "bootloader" on it. What is the purpose of the bootloader?

  • 11.

    The main.c file for the bootloader sets the behavior of the timing generation circuit that takes output of the 8 MHz crystal used on the NU32 board and creates an 80 MHz SYSCLK. Which of the #pragma commands in main.c defines this conversion from 8 MHz to 80 MHz? (You can refer to Register 6-1 of Section 6 of the Reference Manual.)

  • 12.

    Give one reason the linker file procdefs.ld for the bootloader project is different from the linker file procdefs.ld for your first simple program, "Hello World."

  • 13.

    In general, what is the purpose of a Special Function Register (SFR) for a peripheral?

  • 14.

    What is the purpose of the file HardwareProfile_NU32.h? It refers to LATE, TRISE, and PORTE. What are these, and how are they used in this file?

  • 15.

    What does the header file plib.h do?

  • 16.

    In what directory is adc10.h? What does the "10" in this file name signify?

  • 17.

    The file p32mx460f512l.h contains a number of definitions for our particular PIC32. In which directory is it?

  • 18.

    (There is a long buildup for these questions, so just answer the questions in bold, which are not only at the end.) We will learn about some of the SFRs defined for the ADC. In the file p32mx460f512l.h, search for the first instance of AD1CON1. (Should be about 10% into the file.) It is a variable defined as an "extern volatile unsigned int." This is just a variable, just like any other variable you might define, but it represents a "Special Function Register" (SFR) that helps to determine the function of the ADC. "extern" means that this variable is available to other files (its scope is not just limited to use in this file). "volatile" tells the CPU to reload the value from data memory into the CPU registers before doing any computing on it, in case some process the CPU doesn't control has changed AD1CON1. (You will rarely/never need to worry about this for variables you define.) "int" means that it is a 32-bit integer, the default integer size on the PIC32. "unsigned" means that the 32 bits should be interpreted as an integer from 0 to 231 - 1.

Directly below the definition of AD1CON1, you find a "typedef" command that creates a new data type called __AD1CON1bits_t. This is a data type in the same way that "float" and "int" are data types. This particular data type consists of the union of three "struct"s (structures) with "fields" called DONE, SAMP, ASAM, etc., up to ON, for the first struct; SSRC, FORM, etc. for the second; and "w" for the third. The numbers after the colons indicate how many bits long that particular field is. In the first struct, the field

Document info
Document views36
Page views36
Page last viewedWed Jan 18 02:35:53 UTC 2017