Digital Electronics Term 2 Flashcards

1
Q

Iterative and incremental processes in software development

A

Iterative: fixing errors in the next iteration of the code, testing then repeat
Incremental: features are added one at a time

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

Machine code, assembly language, high level definitions

A

MC: raw binary instructions, no abstraction
AL: symbolic notation for machine code instructions (ADD, SUB etc), slightly more human readable
HL: similar to natural language, lots of abstraction

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

Compiler, assembler definition

A

C: converts high level code into machine code
A: converts assemply language code into machine code

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

Portability in code definition and examples

A

Code being able to run on multiple different processors
Machine code = not portable. Would require rewriting for processors with different instruction sets
High level = very portable
Can use compilers for different processors means same code can be compiled multiple times

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

Compliation process: 4 steps

A
  1. Source code goes through Preprocessor. Involves being expanded with any files or macros
  2. Compilation: source code converted into assembly code made of of mnemonics of the instruction set architecture
  3. Assembly: assembly code is converted into binary machine code (object code) according to instruction format of the particular architecture
  4. Linking: combining object code together with any library code to create an executable file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Flags for c++ compliation stages (last one is special)

Other Flags for c++ compliation (two of them)

A
  • E, -S, -c, g++
  • Wall: outputs any warnings about the code
  • O: optimises code, different levels (-O1, -O2, -O3)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why is the main() function special compared to others?

A

It defaults to returned 0 (hence why its int main() )

Other functions must explicitly contain a return statement

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

What is the link between C and C++?

A

C++ is a superset of C

C code is also C++ code but not all C++ code is C code

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

What can’t variable names contain in C++?

A

Spaces, commas or special charactors other than underscore

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

Types of variable and their bit length: 6 in total. Think about sign and decimal places as well

A
Char (8 bits)
Short (16 bits)
Int (32 bits)
Long long (64 bits)
All can be unsigned or signed. Range example: char= 0-255 OR -128-127

Float (32 bits, 7 decimal places)
Double (64 bits, 16 decimal places)

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

Pull up/pull down resistors on input pins

A

PU: pin reads logic 1 by default, logic 0 from input
PD: pin reads logic 0 by default, logic 1 from input

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

Positive/negative logic on output pins

A
You can use a pin to sink/source small amounts of current
Positive:
Logic 1 on pin: 3.3 V
Causes current to flow from the pin
Pin acts as a current source
Negative: Logic 0 on pin: 0V
Causes current to flow from a supply into the pin
Pin acts as a current sink
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Mbed DigitalOut commands

A

write-set output to 1/0 (or use = as a shortcut)
wait-delay in code
BusOut-a way to address multiple pins at once (array with LSB first)
Example: array with 4 LED’s. Putting in 2 activates the second LED, 7 activates first 3 (think binary numbers)

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

Mbed DigitalIn commands

A

read-returns 0/1 depending on whether its 0V/3.3V on the input pin
mode-changes pin to pull up, pull down or pull none

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

PWN definition and uses

A

Pulse-width modulation
Outputs a periodic waveform controlled by changing its frequency and duty-cycle
Controls brightness of LEDs and speed of motors

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

Duty-cycle definition and equation

A
Ratio of the 'on' time to the period
Remember f=1/T
DC= Tpw/T
DC=duty-cycle
Tpw='on' time
17
Q

Mbed PWM commands

A
PwnOut-sets a pin as a PWN output
Only works with certain pins
period-sets period of waveform
write/=-sets duty-cycle of waveform
Values must between 0.0 to 1.0
18
Q

ADCs definition

A

Used to convert an analogue voltage on a pin into a digital value
Useful as many sensors output an analogue voltage
REVISE how this is calculated

19
Q

Mbed ADC commands

A

AnalogIn-used to create a ADC input
Only works on certain pins
read-reads analogue voltage on pin
Returns number between 0.0 to 1.0

20
Q

Serial communication definition and types

A

Sending data between devices one bit at a time
In contrast to parallel communication where mulitple bits are sent together over a bus
Types: asynchronous and synchronous