Bachelor of Applied Technology ETEC: 6416 Microcontrollers Laboratory 2: GPS in Hi-tech C Task: set up a project using MPLab and undertake USART communication with a GPS unit. Pay attention to the way the code ‘looks’ are all the brackets lined up? Do you have a header? Are the comments easy to follow and do they make sense? Introduction There are a number of implementations for extracting GPS data from a GPS using a microcontroller however when using a different microcontroller the code needs to be ported from the original microcontroller to the target microcontroller. Performing the port requires knowledge of the structure of how the original code works and knowledge of the changes that need to be made to the special function registers in order to get the code to run on the target MCU. Additionally the code will not always work first time as expected so debugging skills using a USART are required. For the laboratory, using the echo program as a base shell (secure code that can read a USART signal and send a USART signal to a terminal) undertake a port of some GPS code to a PIC16f877a MCU and have the longitudinal and latitudinal data displayed on the terminal. The GPS data will come from a GPS log file (a simulated GPS data set). -some of the code is taken from the Hi-Tech C samples and requires specific Special Function Registers to be set for the PIC16f877a running a 20MHz oscillator. The challenge of this laboratory is to correct the special function registers to provide the correct communication speeds for the PIC16f877a and a GPS operating at 9600baud. 1. Open MPLAB>project>project wizard. 2. Save the project to a folder on your desktop called ‘proj2’ that you can later move to your student directory. 3. Port the code from the handout on to a PIC16f877a MCU. 4. Correct the Special function register settings to provide a 9600 SPI communication using xxxx. Test the code using the MPLab simulator. 5. Run a test communicating with a microcontrollers using one of the GPS log files to obtain GPS latitude/longitude data and display the GPS data on the terminal package. The file to port across is adapted from the website http://tutorial.cytron.com.my/2012/08/16/skm53-gps-module-starter-kit-skgps-53/ In this code the port must replace the LCD display with a display using the Terminal Package (terminal or realterm). Structurally the code would be better if the goto command system used by the original code was replaced by functions (goto is unreliable in C and can cause the microcontroller to perform an exception). This laboratory is a major undertaking and will comprise 6% of your final mark. Submission guidelines, submit your .c files and .h and a word document containing screen print of the code working (as demonstrated by the terminal program). Deposit all files in the moodle laboratory 2 dropbox F:\ETEC 6417-Embedded Software\tutorials Page 1 Lab Supervisor Comments Signature of Lab Supervisor on completion of laboratory exercise F:\ETEC 6417-Embedded Software\tutorials Page 2