48622 Mechatronics 1 – PIC18 C – Find the BugsInitial Task: You are trying to determine the period (in µs) of a PWM Signal connected to pin RG3 by using the ECCP2 Module and outputting it using printf(). Timer3 is currently being used as heartbeat signal generator by code in an invisible library. The code is not working ?. Find what’s wrong and fix it. Assumptions: Fosc = 48MHz Minimum PWM capture period = 100µs (10KHz) Maximum PWM capture period = 10,000µs (100Hz) printf() is instant and requires no setup. Also ALL required libraries are included automagically. This is not the MXK (i.e. all information needed is in the datasheet). THERE ARE 7 BUGS IN THIS EXAMPLE Symptoms: It does nothing except print the lines: o Raw Register = 0 o PWM Period = 0 us o PWM Frequency = 0 KHzCode is on the Next Page. Extra Task: This code could be written better. It repeats itself in a few sections and could use some refactoring all around (cleaning it up). Try understanding what it is trying to do and refactor it using conditionals/functions/variable/return types/parameters/etc. To make it easier to read and understand and possibly shorter.Attachment 1Attachment 2Attachment 3
Freebies just for you
We are available 24/7
We help you complete college assignments in under 24 hours.
Get help with essays, research papers, PowerPoint Presentations, reports, reviews, and projects at incredibly low prices.
We will write a custom paper for you at $15.50 $11/page
Free title page
Free reference page
EssayTab is hands down the best essay writing service for college students. I was initially skeptical about the quality of a product that has such a low price point but I can tell you that it’s worth every penny! I’ve been using EssayTab for my essays in college as well as in grad school, and they always deliver excellent content.