Interrupts Flashcards

1
Q

What is the defintion of a task?

A

A distinct activity that is required to be performed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an event triggered task?

A

This is a task that can occur at unpredictable times

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is polling?

A

This is when you repeatedly check the status of an input to see if it changes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the issue with polling?

A

It wastefully consumes power

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an edge triggered interrupt?

A

The interrupt is configured to detect a changing input (from HIGH to LOW or from LOW to HIGH).
Main execution is halted and only when the interrupt is triggered, a side execution is started and then when that is done the microcontroller halts and sleeps again.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a hybrid aproach to get button input whilst sleeping the microcontroller?

A

> Combining interrupts and polling
The microcontroller halts and sleeps and the interrupt is triggered which changes a flag variable
After the flag variable is triggered the microcontroller wakes and resumes and then sees that the flag has changed and execute the required code before sleeping again

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a time triggered task?

A

This is when a timer triggers the interrupt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the two types of time triggered interrupts?

A
Ticker = Triggers periodically
Timeout = To trigger once
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the two sleep modes? What is the difference?

A

sleep()
> System clock is stopped
> Saves dynamic power
> Peripherals continue on working and can generate interrupts
> Woken with timers, serial or external pin interrupt
deepsleep()
> System clock is stopped
> Peripherals and clocks power down
> Only woken using external pin interrupt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you declare an event triggered interrupt in c++?

A

InterruptIn buttonA(PTC7);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you structure an event triggered interrupt function and variable?

A
volitile int g_buttonA_flag = 0;
void buttonA_isr();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you set a falling edge interrupt?

A

buttonA.fall(&buttonA_isr);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the event triggered interrupt function?

A
void buttonA_isr()
{
    g_buttonA_flag = 1;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you declare a ticker?

A

Ticker ticker;

just like an object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you structure a ticker interrupt function and variable?

A
volitile int g_timer_flag = 0;
void timer_isr();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you start a ticker?

A

ticker.attach(&timer_isr, 0.5);

17
Q

What is part of the ticker function?

A
void timer_isr()
{
    g_timer_flag = 1;
}
18
Q

How do you stop the ticker?

A

ticker.detach();