Assessment 3

5 points each, total 100

1 Write a C statement that sets up the PIC ADC so that only RA0 is used as an analog input. Deduce the resolution per bit for a 10-bit conversion, assuming a 5 V supply.

2 If a single 4.096V reference voltage is connected to Vref+ and 10-bit conversion completed, write a C statement (a) to declare suitable variables and (b) to convert the input value to the actual voltage for display.

3 List the statements required to set up an ADC interrupt and outline the related ISR initialization if it is called “isrADC.”

4 Explain the advantages of using an interrupt to read the data from an analog input conversion, compared with simply checking it on a regular basis (polling) within the program loop.

5 A 16-bit timer is preloaded ...

Get Programming 8-bit PIC Microcontrollers in C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.