Total Flashcards

1
Q

What is the instruction sequence to decrement R22 and loop until zero in AVR assembly?

A

LDI R22, 120; DEC R22; BRNE HERE

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

What C data type would you use to store the age of an elephant?

A

Unsigned char

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

What operation is performed by the AVR instruction ‘NOP’?

A

No operation

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

How would you calculate the time delay created by the subroutine if the AVR’s clock frequency is 9 MHz?

A

Calculate the total number of cycles and divide by 9 MHz.

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

Which data type is suitable for storing a string that welcomes people to a building?

A

char[] (character array)

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

What is the addressing mode for the instruction ‘LDR R16, NO’ in AVR assembly?

A

Immediate addressing mode

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

In C programming, what data type would you use for a counter tracking the number of people attending lectures?

A

Unsigned int

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

What is the result of the contents of ATmega2560 SRAM address 0x300 after the first execution of the line labeled ‘End’?

A

It is the value stored at SRAM address 0x300 after the execution.

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

What are the appropriate machine codes for the instruction ‘BRNE Enter’?

A

The corresponding hexadecimal machine code.

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

What is the expected total elapsed time when the AVR assembly program labeled ‘End’ completes its first execution?

A

Calculate the number of cycles multiplied by the reciprocal of the clock frequency.

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

Which C data type is optimal for storing an address of 32K RAM space?

A

unsigned int or a pointer type for addresses.

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

Name a suitable application for a 1 KB SRAM in an embedded system.

A

Storing temporary data or buffers during program execution.

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

What is a 74HC139 decoder used for in memory address decoding?

A

To decode address signals to select one of several output lines in embedded systems.

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

What adjustments are necessary for controlling a valve based on a temperature input in a range of 20 – 30 °C?

A

Utilize a PID controller for precise adjustments.

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

How would you convert analog temperature readings to digital control signals?

A

Use an A/D converter with appropriate signal conditioning.

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

Describe a potential issue when testing a push-button controlled LED light system

A

The LED may light up longer than expected due to button debounce issues.

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

What is the role of the machine instruction ‘MUL R0, R16’ in AVR?

A

Multiplies the contents of R0 and R16, storing the result in a register pair.

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

Which AVR register holds the result of a multiplication operation?

A

R1:R0 (register pair for 16-bit results).

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

Explain how to use a 16-bit A/D converter to measure temperature with a range of -2 V to +4 V.

A

Set up the A/D converter with appropriate voltage reference and scaling to cover the -2 V to +4 V range.

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

What function does the DEC R16 instruction perform in AVR assembly?

A

Decrements the value in register R16 by one.

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

What type of loop would you use in C to continually check for input until a certain condition is met?

A

A while loop.

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

How would you describe the purpose of the STS ADDR, R0 AVR assembly instruction?

A

Stores the contents of register R0 into the address specified by ADDR.

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

Which C data type is appropriate for storing temperature values that can have decimal precision?

A

float or double

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

What is meant by “addressing mode” in the context of AVR assembly language?

A

The method used to determine the operand’s value or the operand itself in an instruction

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

How do you calculate the hex machine code for the AVR JMP instruction?

A

Identify the opcode and address, then convert to hexadecimal format.

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

What AVR instruction is used to jump to a specific code label when a condition is met?

A

BRNE (Branch if Not Equal).

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

What type of data storage is an EEPROM in embedded systems

A

Non-volatile memory used to store code and data that must persist during power loss.

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

What should the electrical resistance value of a temperature sensor be at 30 °C if it is 108.5 Ω at 20 °C and increases by 0.39 Ω per °C?

A

Calculate based on linear resistance increase: 108.5Ω+(0.39Ω×10)108.5Ω+(0.39Ω×10).

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

How is the MUL instruction in AVR assembly used in practical applications?

A

For multiplying two register values, commonly used in scaling operations.

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

Which data type in C is used to handle large fixed decimal numbers safely?

A

Long double

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

What technique is used to ensure data consistency in EEPROM writing?

A

Use of write-verify cycles and ensuring no power interruption during the write process.

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

Define the term “machine code” in the context of programming microcontrollers.

A

The set of binary instructions that a microcontroller directly executes.

33
Q

How would you describe the role of SRAM in a microcontroller-based system?

A

Volatile memory used for temporary data storage during program execution.

34
Q

What is the purpose of a CLR instruction in microcontroller programming?

A

Clears (sets to zero) the contents of the specified register.

35
Q

In what situation would you use an unsigned char data type in C?

A

When needing to store small non-negative values or raw data bytes.

36
Q

Describe how to calculate the average power dissipation of a microcontroller during operation.

A

Multiply the average operating current by the supply voltage. V*I = P

37
Q

What is the significance of the NOP (No Operation) instruction in timing-sensitive code?

A

It is used to introduce delay or align code execution without affecting the processor state.

38
Q

How does the BRNE instruction affect program flow in an AVR microcontroller?

A

It causes the program to branch to a specified address if the zero flag is not set.

39
Q

Explain the importance of configuring I/O pins correctly in an embedded system

A

Incorrect configuration can lead to wrong data readings, inefficient power usage, or hardware damage.

40
Q

What is PWM (Pulse Width Modulation)?

A

PWM is a technique used to control the amount of power delivered to an electronic device by breaking up the power into discrete on/off periods. It’s widely used in DC motor control to manage the speed and torque of the motors

41
Q

How would you generate a 245 Hz PWM signal with an 82% duty cycle on an ATmega2560?

A

Set up a timer in inverted phase correct PWM mode, calculate and set the appropriate prescaler, and configure the OCR register for 82% duty cycle.

Clock Frequency / (Prescaler×(Top Value+1))

42
Q

What does the AVR instruction ‘OUT DDRB, R16’ do?

A

It configures the data direction register of port B to set the data directions (input/output) as specified in register R16.

43
Q

Estimate the MCU clock frequency based on an oscilloscope reading where the horizontal scale is 2.54 μs per division.

A

If one complete cycle appears over four divisions and each division is 2.54 μs, then the period is 10.16 μs, indicating a frequency of about 98.43 kHz.

44
Q

What addressing mode is used in the instruction at the line labeled “BACK” in the AVR assembly program?

A

Direct addressing mode.

45
Q

How would you calculate the contents of the PC and stack pointer after executing ‘CALL DUMP’?

A

The PC would contain the address of the next instruction post ‘CALL DUMP’, and the stack pointer would be decremented by the size of the address (usually two bytes on AVR) to store the return address.

46
Q

Describe how to set up the TCCR2B register for generating a PWM signal on an ATmega2560.

A

Set the waveform generation bits to the appropriate mode for PWM and configure the prescaler bits to match the desired frequency.

47
Q

What machine code corresponds to the ‘RJMP DONE’ instruction in AVR assembly?

A

Calculate the relative jump offset from the current location to the label ‘DONE’ and convert this value to hexadecimal.

48
Q

Explain the purpose of the ‘MOV R16, R17’ instruction in AVR.

A

Copies the contents of register R17 into register R16.

49
Q

How does using an inverter affect the PWM signal in AVR microcontrollers?

A

It reverses the output, so the signal is low when it would typically be high, and vice versa, during the active part of the cycle.

50
Q

What is the function of the ‘INC XL’ instruction in an AVR assembly program?

A

Increments the contents of the register XL by one.

51
Q

Describe the steps to calculate the average I/O pin power dissipation in a system with multiple interfaces.

A

Multiply the typical pin switching rate by the typical pin capacitance and voltage squared, then add the static leakage dissipation.

52
Q

How would you modify a high-gain proportional control system to reduce oscillations around the set point?

A

Introduce derivative (D) and/or integral (I) control to the system to stabilize the response.

53
Q

What storage in a PLC module would you recommend for long-term calibration parameters?

A

Use non-volatile memory in the PLC to ensure parameters are retained through power cycles.

54
Q

Compare the use of inductive and photoelectric sensors in proximity sensing.

A

Inductive sensors are good for detecting metallic objects, while photoelectric sensors are better for detecting presence, color, and distance of objects, including non-metals.

55
Q

What actions would you take to ensure a temperature sensor is accurately reading within a narrow range?

A

Regularly calibrate the sensor, possibly implement a fine-tuning algorithm in the controller software to adjust readings based on known deviations.

56
Q

Why might electronic components operating at lower supply voltages be cooler?

A

Lower voltages reduce power dissipation as power is proportional to the square of the voltage (P=V^2/R).

57
Q

How would you program a stepper motor to rotate at 1200 RPM using an AVR microcontroller?

A

Calculate the delay needed between steps based on the motor’s specifications and set up a timer to trigger the stepping sequence at the calculated interval.

58
Q

Write a pseudocode to generate a 490 Hz PWM signal with an ATmega2560.

A

Initialize timer in fast PWM mode, set prescaler, calculate and set OCR value for 490 Hz frequency

59
Q

What is the purpose of the PUSH R16 instruction in AVR assembly language?

A

Saves the current value in register R16 onto the stack.

60
Q

Describe how to use the AVR assembly instruction ST X, R17.

A

Stores the content of register R17 into the address pointed by the register pair X.

61
Q

What does the LDI R17, 0x50 instruction do in an AVR program?

A

Loads the immediate value 0x50 into register R17.

62
Q

How would you determine the MCU clock frequency if an oscilloscope shows a signal period captured over several microseconds?

A

Calculate the frequency by taking the inverse of the period (Total time/number of cycles).

63
Q

Explain the role of the .EQU directive in AVR assembly.

A

It defines constants. For example, .EQU ZERO=0x00 sets ZERO as a constant with a value of 0x00.

64
Q

How is the CALL instruction used in microcontroller programming?

A

It calls a subroutine at the specified address, saving the return address onto the stack.

65
Q

What does setting a pin as output in DDRB involve in AVR microcontrollers?

A

Configuring the corresponding bit in the Data Direction Register B (DDRB) to 1 (output).

66
Q

What is the significance of setting an 82% duty cycle in a PWM application?

A

It means the signal is ‘high’ 82% of the time during each PWM cycle, controlling the output power proportionally.

67
Q

How would you use the RET instruction in an assembly program

A

Ends a subroutine and returns control to the calling function, using the address on the stack.

68
Q

What does the OUT PORTB, R18 instruction accomplish?

A

Outputs the contents of register R18 to the PORTB I/O port.

69
Q

What is the effect of the POP R16 instruction in an assembly language program?

A

Retrieves the last value pushed onto the stack into register R16.

70
Q

How do you achieve multi-tasking on microcontrollers like the ATmega2560?

A

By using interrupts and timers to handle different tasks at predefined intervals or external events.

71
Q

Describe how an external SRAM is interfaced with a microcontroller like the ATmega2560.

A

It involves connecting data lines, address lines, and control signals (like read/write commands) between the SRAM and microcontroller.

72
Q

What is the purpose of a 256-byte external SRAM in an embedded system?

A

Provides additional memory for data storage that exceeds the microcontroller’s internal capacities.

73
Q

How do you calculate power dissipation for I/O pins in an embedded system?

A

Multiply the average current by the voltage at each pin and sum it across all I/O pins used.

74
Q

What challenges are involved in generating precise PWM signals in embedded systems?

A

Ensuring the timing accuracy and stability of the clock source, and managing interrupt service routines effectively.

75
Q

Explain the use of the SPI (Serial Peripheral Interface) in microcontroller applications.

A

SPI is used for moving data quickly between the microcontroller and peripherals like sensors or other microcontrollers.

76
Q

How would you initiate SPI communication in C for the ATmega2560?

A

Configure the control registers for SPI, including setting the master mode and defining the clock rate.

77
Q

What steps are involved in sending data over an SPI bus?

A

Set the slave select low, transmit data through the data register, wait for transmission to complete, then set slave select high.

78
Q

Describe the impact of electronic component operating temperature on system reliability.

A

Higher temperatures can accelerate aging and failure rates of electronic components, reducing system reliability.

79
Q

What would you configure in a timer to toggle a pin at regular intervals for a square wave generation?

A

Set the timer mode, period, and compare match value to toggle the pin at desired intervals.