Program flow Flashcards

1
Q

What happens to the Program Counter (PC) during normal execution

A

The PC is incremented after each instruction enabling pipelining by overlapping instruction fetch and execution

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

What is pipelining in microprocessors

A

Pipelining overlaps the fetch and execute stages of instructions improving processing speed

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

What is an unconditional branch

A

A branch instruction that always changes the PC such as GOTO in PIC16F84A

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

How does a conditional branch work

A

It checks status bits and branches only if specific conditions are met allowing loops like for or while

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

What is an example of data-dependent branching

A

An if/else structure such as turning off a kettle if the temperature exceeds 100°C

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

What is absolute addressing

A

The destination address is directly specified in the instruction but may be limited by instruction size

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

How does relative addressing benefit program flow

A

It uses small offsets making code relocatable and more memory-efficient

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

What are skip instructions

A

They skip the next instruction if a condition is met without changing the PC directly

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

How does a subroutine call work

A

The current address is saved and the PC jumps to the subroutine address After execution the saved address is restored

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

What instructions manage subroutine calls in PIC16F84A

A

CALL saves return address and RETURN restores return address

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

What is the purpose of the stack in subroutine calls

A

To store return addresses registers and function arguments

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

What is an interrupt

A

An external or internal event that stops the main program triggering an interrupt service routine ISR

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

How does interrupt-driven I/O differ from program-controlled I/O

A

Interrupt-driven I/O responds immediately while program-controlled I/O continuously checks for events

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

What must be saved during an interrupt

A

The PC and register contents must be saved to the stack to ensure the main program resumes correctly

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

What is an exception in a microprocessor

A

An unexpected error that triggers an exception handler such as division by zero or memory access failures

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

How is an exception different from an interrupt

A

An interrupt is triggered by external events while an exception is caused by internal errors during execution

17
Q

How can a timer interrupt be used in the PIC16F84A

A

To toggle an output pin driving a buzzer allowing multitasking while the main program runs

18
Q

What happens if an exception is not properly handled

A

The system may crash causing events like the Blue Screen of Death