Microcontrollers exam Flashcards

1
Q

Characteristics of a PC computer

A

Fixed location
Linked to mains power
Extendable buses
Add memory
Add devices

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

Examples of distributed control systems

A

Protection systems
Data housing
R&D
Education

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

What is telemetry

A

Taking data from a distance and feeding it into a computer system

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

Components in a microprocessor

A

CPU - brains of the operation, will be executing the code you have loaded on to it
ALU - optimised to carry out AND/OR/NOT operations
FPCP - optimised to carry out mathematical operations
ROM
RAM
BIOS - low level code (firmware)
ADC
DAC

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

What is RISC and CISC

A

Reduced instruction set computer (microprocessor uses this) - 50/60 instructions
Complex instruction set computer - 500+ instructions

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

Characteristics of microcontroller

A

Small, mobile, standalone, battery powered, fixed, can be embedded

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

Differences between Harvard and Von Neumann

A

VN: Uses one memory unit for both instructions and data
H: Has separate memory units for instructions and data

VN: Uses one set of buses for both instructions and data
H: Has separate buses for instructions and data

VN: Commonly used in general purpose computers
H: Commonly used in embedded systems (e.g. digital signal processing)

VN: Enables a more flexible use of main memory, enabling the processor to run a variety of programs that aren’t necessarily known in advance
H: For systems with a predetermined use, instruction memory can be implemented as ROM which protects the programs from hacking

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

4 advantages of Harvard

A

⏰️ Instruction and data can be accessed simultaneously
📝 Instruction and data memory can have different word lengths
🤖 Different technologies can be used to implement instruction and data memory
🧑‍💻️ For systems with a predetermined use, instruction memory can be implemented as ROM which protects the programs from hacking

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

Name some microcontrollers

A

Arduino
Raspberry Pi

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

Where is power indicator (1)

A

(2)

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

Where is USB in (1)

A

(3)

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

Board rate =

A

Bits per second

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

Where is DC power in (power supply) (1)

A

(4)

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

draw the diode bridge

A

(5)

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

voltage drop of a diode

A

0.7V

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

(6)

A

Time period = 0.1s
so t = 0.1
r*C = 0.01
7.6e^0.01/0.1

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

Where does the battery go (Vin) (1)

A

(9)

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

draw a zener diode

A

(10) doesn’t have line through the middle

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

draw a circuit for a regulated voltage supply to a microcontroller

A

(12)

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

Draw IV for zener diode

A

(11)

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

(13)

A

Vr = Vin - Vz
Vr = 7-5.1 = 1.9
I = 1.9/100 = 19mA

Power in r = Iz^2 * r
=0.019^2 * 100 = 0.0361W

Pz = Vz * Ir
= 5.1 * 0.019 = 0.0969W

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

identify which is harvard and which is von neumann

A

insert pic

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

Draw SBD for the schematic

A

(13)

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

What is pin 1 used for

A

It is a serial pin for if you did not want to use a USB cable

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

(14)
write psuedo code using an active low

A

logic is reversed, 0 means LED on and 1 means lED off

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

draw arduino circuit with a tilt switch

A

(15)

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

draw LED symbol

A

(16)

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

what is the forward voltage of bright red and what current does it need to work (17)

A

2-2.5
20mA

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

Draw an arduino schematic with a mechanical push switch and a capacitor in parallel with the 10k resistor. Calculate the size of the capacitor

A

(19)
C = 0*10^-6

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

Draw schematic with BCD chip integrating a 7 seg display

A

(22)

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

3

write code to read a byte from digital input 0
and then output 0x79 to channel 0

A

diginByte0 = digitalRead(DI0)
digoutByte0 = 0x79
digitalWrite(0, digoutByte0)

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

convert 0x79 to 7 seg display

A

letter E
convert to binary and then apply to 7 seg display

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

what is a masking operation

A

bitwise AND the byte with a 1 where you are looking at and if the answer is the masking operation = true

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

how do you set a bit in a byte to 1

A

OR it with a 1 where the bit is and the rest of the byte is 0s

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

how to set a bit in a byte to 0

A

AND the byte with another byte which has all 1’s except a 0 for the bit you want to change to 0 (its complement)

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

draw arduino schematic with a default on three leds with switch

A

(23)

37
Q

code for a debouncing a push button

A

digin2 = read_digin(2)
If digin2 ! = to old_digin2 then
Wait 50 //wait 50 ms for signal to settle to avoid multiple triggers
End if
old_digin2 = digin2

38
Q

draw a schematic using a relay output

A

(24)

39
Q

draw a schematic with a 7 seg display

A

(25) with a matched resistor (need to calculate) and ground it

40
Q

draw a schematic with a 7 seg display and a bcd

A

(21)

41
Q

if ABCD on the BCD chip is allocated pins 2,3,4,5 then write the code to display the number 2 on the 7 seg display

A

digitalWrite(2,Low)
digitalWrite(3,High)
digitalWrite(4,Low)
digitalWrite(5,Low)

as a byte:
Digout && 11110010

42
Q

what does this mean (26)

A

there are 4 wires in this cable

43
Q

(27)

A

(28)
Pseudocode:
(29)

44
Q

If something is called a swittch it is

A

digital

45
Q

sensors and transducer’s are

A

analogue

46
Q

what is a transducer

A

takes one signal and converts it into another
e.g. converts 0-100 degrees to 0-5V

47
Q

draw an arduino schematic with an analogue input (potentiometer)

A

(30)

48
Q

current vs voltage signals sensors

A

current signals:
wires can be as long as possible
much more expensive

49
Q

draw a variable resistor
draw a light dependent resistor

A

(31)

50
Q

pseudocode for reading analogue signal

A

int sensorVal = analogRead(A0)

51
Q

write pseudocode if you have a temperature sensor which is 0-5 V = 0 - 100 °C,

A

rawTemp = readAnin(0) // reads in a bit value from the analogue input A0
realTemp = rawTemp * (100/255) // scale the bit value to a temperature in deg C

52
Q

resolution for analogue to digital scaling =

A

range/255

53
Q

write pseudocode using a deadband for a window opener

A

If realTemp > 24 then // if its too hot open a window
openWindow
Else if realTemp < 22 then // put a 2 deg C deadband around the switching
closeWindow
End if

54
Q

analogue vs digital

A

analogue represents the real world better
digital will always suffer from sample and hold quantisation errors

55
Q

why are there no analogue outputs on an arduino

A

driving AO takes a lot of power
It makes the board more expensive and complicated

56
Q

scaling from digital to analogue if drive = 20%

A

*Reverse calc for inputs
*If the drive to a motor is 0-5V for 0-100% drive
*If the DAC is an 8 bit device
*Then if the code wants to output 20% (=1V)
*SpeedOut = 20
AnalogOut = (20/100) (2^8 -1) = 51

57
Q

symbol for a motor

A

(32)

58
Q

(33)

A

5V = 255 bits
3V = 253 * 0.5 = 153 bits
motorspeed = 0
void loop()
{
delay(1000) /1s
motorspeed = motorspeed + 1
anoutWrite(0) = (motorSpeed/100)*153

59
Q

What is pulse width modulation

A

Modulating the width of a pulse to give quasi analogue control

60
Q

what is a pulse

A

when something goes
high
low
high
low…

61
Q

what happens when you increase the width of the pulse. include diagram

A

letting the motor see a higher analogue input because it is integrating between the pulses as the speed of the pulses is faster than the reaction time of the motor (33)

62
Q

PWM has a

A

fixed frequency

63
Q

speed when mark:space ratio is 100:0

A

100%

64
Q

speed when mark:space ratio is 30:70

A

30%

65
Q

what % duty cycle is analogWrite(255) on an arduino

A

100%

66
Q

what % duty cycle is analogWrite(127) on an arduino

A

50%

67
Q

what % duty cycle is analogWrite(0) on an arduino

A

0%

68
Q

duty cycle =

A

mark:space ratio

69
Q

duty cycle is 70% =

A

70:30 M:S

70
Q

resolution of a shaft encoder

A

360 / 2^(number of layers)

71
Q

write gray code for 3 bits

A

000
001
011
010
110
111

72
Q

draw a 3 bit grey code shaft encoder

A

(34)

73
Q

draw a H-bridge circuit

A

(35)

74
Q

draw a control system diagram for a heater (negative feedback)

A

(36)

75
Q

what is hunting

A

when there is a time delay, it can cause the system to be constantly turning on and off

76
Q

define hysteresis

A

the dependence of the state of a system on its history. For example, a magnet may have more than one possible magnetic moment in a given magnetic field

77
Q

draw the mechanical hysteresis graph

A

(37)

78
Q

how to fix hunting

A

using a deadband

79
Q

what is an open loop

A

does not have any feedback and therefore cannot correct any changes (unplugging a heater, turning off a tap)

80
Q

what is a closed loop

A

does have any feedback and therefore can correct any changes

81
Q

(38)

A

(39)

82
Q

Yorkshire water scenario:
explain d1,d2,d3

A

A radar sensor, set at a fixed height measures the reservoir water level, this is then converted to water depth by knowing the distance to the reservoir bottom

83
Q

draw harvard and von neumann

A

last photo

84
Q

always on - resitor is … the switch
always off - resitor is … the switch

A

up
down

85
Q

why would you use a pull up or a pull down resistor

A

A pull up resistor is used to hold the signal high (+5V) as its default state, a pull down resistor
holds the signal low (0V) as its default state

86
Q

What is debounce and why does it happen?

A

Debounce happens as mechanical switches are imperfect, the ability of the contact to make a
perfect connection instantly and hold that connection is not possible due to the surface finish
and internal reactive spring mechanism

87
Q

Draw a debounce circuit, including component values for a 100ms time constant

A

2nd last photo

88
Q

Draw a circuit for a simple analogue input such as a temperature sensor

A

last photo

89
Q

Suitable resistor values for
Switch
PTC (thermistor)
Led

A

10k ohms
5k ohms
220 ohms