Question: Question 3 As a junior engineer joining a new company, you have been tasked to analyse an unfinished legacy code left by your predecessor. The

 Question 3 As a junior engineer joining a new company, you

Question 3 As a junior engineer joining a new company, you have been tasked to analyse an unfinished legacy code left by your predecessor. The code is part of an ongoing project. The project includes converting an analogue signal to digital. The analogue input is 3 Vp-p varying between 1 V and 4 V at a frequency less than 100 Hz. The signal source is directly connect connected to pin (ANO) of a 20 MHz PIC18F252 Microcontroller. You have been told by your project manager that the code is not working as expected". The following is the code used achieving that task: #include // // 2 // 3 void main (void) { TRISC = Ox00; while (1) { ADCONO=0x00 ADCON1=0x85 ADCONObits.GO DONE = 1; while (ADCONObits.GO DONE); PORTB=ADRESH; / 5 17 // } You need to answer the following questions: a. Based on the description given above, is the code functioning properly? If not, what do you need to change? State these changes and provide your analysis for the reasons behind them including any further improvements, you need to include the new modified C command lines if any. b. Add comments to the code to improve readability for future improvements. Question 3 As a junior engineer joining a new company, you have been tasked to analyse an unfinished legacy code left by your predecessor. The code is part of an ongoing project. The project includes converting an analogue signal to digital. The analogue input is 3 Vp-p varying between 1 V and 4 V at a frequency less than 100 Hz. The signal source is directly connect connected to pin (ANO) of a 20 MHz PIC18F252 Microcontroller. You have been told by your project manager that the code is not working as expected". The following is the code used achieving that task: #include // // 2 // 3 void main (void) { TRISC = Ox00; while (1) { ADCONO=0x00 ADCON1=0x85 ADCONObits.GO DONE = 1; while (ADCONObits.GO DONE); PORTB=ADRESH; / 5 17 // } You need to answer the following questions: a. Based on the description given above, is the code functioning properly? If not, what do you need to change? State these changes and provide your analysis for the reasons behind them including any further improvements, you need to include the new modified C command lines if any. b. Add comments to the code to improve readability for future improvements

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!