Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ACLK Clock Source TIMER A CLOCKSOURCE ACLK TIMER A CLOCKSOURCE DIVIDER 1, ACLK/1

ID: 3705504 • Letter: A

Question

ACLK Clock Source TIMER A CLOCKSOURCE ACLK TIMER A CLOCKSOURCE DIVIDER 1, ACLK/1 32Khz 49152, TIMER_A_TAIE-INTERRUPT-DISABLE· //Disable Timer ISR TIMER ACCIE CCRO INTERRUPT DISABLE, Disable CCRO TIMER A DO CLEAR // Clear Counter Timer-A Compare Configuration Parameter const Timer A CompareModeConfig compareConfig- TIMER A CAPTURECOMPARE REGISTER 1. lUse CCR1 TIMER_A_CAPTURECOMPARE INTERRUPT DISABLE, I/ Disable CCR interrupt TIMER A OUTPUTMODE SET RESET, 49152 Il Toggle output but 16000 Period ?Statics? static volatile uint16t current ADC result; volatile float tempC; volatile float tempF: int main(void) /"Halting WDT */ MAP _WDT A holdTimer0: MAP Interrupt_enableSleepOnlsrExit0: Setting up clocks MCLK-MCLK-3MHz * ACLK = REFO : 32Khz */ MAP CS initClockSignal(CS ACLK, CS.REFOCLK SELECT, CS_CLOCK_DIVIDER_1) Enabling the FPU for floating point operation "

Explanation / Answer

The given program is about the configuaration of timers and enabling those interrupts, This is a PIC microcontroller based program.

Initially Timer A is configured. It is set at 1KHz. Then the ISR( interrupt Service Routine). When the interrupts are disabled the timers are initialized. The register 0 is also disabled. Then the timer is cleared.

The timer A is setup . Then the register 1 is used while the interrupt is cleared. The output of timer A is toggled between set and reset.

Now the main program starts. initially static variable is declared as analog to digital converter result, and 2 float variables are declared temp c and temp f.

In the main function, the watchdog timer is kept in holding state, and the interrupt timer process is made to sleep or exit. The watchdog timer is mainly used to reset the program automatically.

Now the clocks are set at 32KHZ and 32MHz frequency and the clock signals are initialized. As the varibles declared are float variables. The calculation must be carried out in floating point method. For this the floating point modulus is enabled to carry out the opeeration.

The variables represent the temperature which are fed into A/D converter as analog inputs and outputs are obtained in digital form. ADC module is enabled in the next stage and ADC divider is initialized.

In order to store the ADC input and its convertor values, memory is required. The ADC memory is initialized for configuaration as single sample mode.

In order to start the conversion process the timer is set at continous mode of operation and initially 1 was initialized , is now triggered to 16000 .

In channel 1, when A/D conversion is over the other interupts are enabled and the next conversion is started. To end the interupts the master is enabled, followed by slave configuaration. For processing of interupts again timer A is started.

In general, it is a PIC microcontroller program where temp c and temp f are taken as analog input temperature . The converter process the digital output. For this purpose , timer A is initialized and 1 is used. In order to save the values ADC memory is also initialized.

And all the counters available are disabled.

After the conversion of first temperature, interrupt is enabled. Again the conversion process is started by again setting timer A and allocating register 1.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote