Micro Exam 1

studied byStudied by 4 people
5.0(1)
Get a hint
Hint

Suppose a pushbutton switch connects pin 20 on the mbed to the mbed's Vout (power) pin. Pressing the switch completes the circuit between these two pins. What is this an example of?

1 / 43

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

44 Terms

1

Suppose a pushbutton switch connects pin 20 on the mbed to the mbed's Vout (power) pin. Pressing the switch completes the circuit between these two pins. What is this an example of?

An active-high switch

New cards
2

Suppose a pushbutton switch connects pin 20 on the mbed to the mbed's Vout (power) pin. Pressing the switch completes the circuit between these two pins. The resistor for pin 20 should be configured as:

A pull-down resistor

New cards
3

The "Blinky LED Hello World" template includes the following declaration to control built-in LED1:

DigitalOut myled(LED1);

For proper operation, the circuit for LED1 uses:

A current limiting resistor

New cards
4

The "Blinky LED Hello World" template uses the instruction

myled = 1;

to turn on LED1. We can conclude that LED1 is an example of:

An active-high LED

New cards
5

Unless otherwise specified, for the following problems assume a common-cathode 7-segment display is connected to the mbed, with segment A connected to p5, segment B connected to p6, and so on, up to segment G connected to p11. A variable for the 7-segment display has been declared:

BusOut display(p5,p6,p7,p8,p9,p10,p11);

Ignore the decimal point on the display.

What would be the state of the display after the following instruction?

display=0b0000110;

Segments B and C on, all others off

New cards
6

If a common-anode 7-segment display is used instead, what should the assignment in the previous problem be changed to so that the state of the display remains the same (the same segments are on or off)?

display=0b1111001;

New cards
7

To display the number 8 (by turning on all the segments) on the common-cathode display, what assignment should be used?

display=0b1111111;

New cards
8

What are the ramifications of changing the declaration to:

BusOut display(p11,p10,p9,p8,p7,p6,p5);

The program will run, but the symbols on the display will appear incorrectly unless the constants assigned are recomputed

New cards
9

Suppose there is the following declaration on our LPC1768 mbed:

AnalogOut aout(p18);
After the assignment:

aout = 0.5;
what would be the expected voltage on pin p18?

1.65 volts

New cards
10

After the assignment:

aout = 1.0;

what would be the expected voltage on pin p18?

3.3 volts

New cards
11

After the assignment:

aout = -1.0;

what would be the expected voltage on pin p18?

 

0 volts

New cards
12

The smallest change in voltage possible for the LPC1768 mbed's AnalogOut pin is approximately 3.2 mV. If a smaller change in voltage (more precision) is required, how should the digital-to-analog parameters be changed? (Note that these options may require hardware changes, possibly including using a different chip)

Increasing the number of bits in the conversion

New cards
13

After executing the instructions:

led.period(0.4);
led.pulsewidth(0.2);

What would be the duty cycle for the LED?

 

50%

New cards
14

After executing the instructions:

led.period(1);
led=0.1;
led.period(0.5);

What would be the duty cycle for the LED?

20%

New cards
15

While executing the following instructions:

while (1) {
led.period(0.4);
led.pulsewidth(0.2);
}

What is the frequency that the LED blinks at?

 

The LED is not blinking

New cards
16

Assume a piezo transducer is connected between pin 21 and ground and a PwmOut object controlling the pin 21 is configured for a period of 2 milliseconds.

Which of the following duty cycles would generate the loudest tone?

50%

New cards
17

Assume there is no noise and the power rail is exactly 3.3 volts.

Assume the following declarations:

AnalogIn ain(p20);
float x;

If pin p20 is connected to GND, what value would be stored in the variable x by the following instructions?

x = ain.read();

0

New cards
18

If pin p20 is connected to VOUT, what value would be stored in the variable x by the following instruction?

x = ain.read();

1

New cards
19

The LM35 temperature sensor outputs 10mV per degree Celsius (for example at 25 degrees, it would output 250 mV). Given that the LPC1768 mbed's analog-to-digital converter has 12 bits of precision, could it measure a change in temperature as small as 0.1 degrees if pin p20 is directly connected to the LM35's output?

True

New cards
20

Suppose after the following instruction, the variable x has the value 0x8000 (or 32768 in decimal). What is the approximate voltage on p20?

x = ain.read_u16();

1.65 V

New cards
21

For the switch connected to p18 to GND, how should the mbed
class object be declared?
a) DigitalOut redSw(p18);
b) p18 DigitalIn(redSw);
c) AnalogOut redSw(p18);
d) redSw DigitalOut(p18);
e) DigitalIn redSw(p18);
f) redSw AnalogOut(p18);

e) DigitalIn redSw(p18);

New cards
22

For the switch connected to p23, how should the mbed
class object be declared?
a) p23 DigitalIn(greenSw);
b) DigitalIn greenSw(p23);
c) PwmOut greenSw(p23);
d) greenSw DigitalOut(p23);
e) greenSw AnalogIn(p23);
f) DigitalOut greenSw(p23);

b) DigitalIn greenSw(p23);

New cards
23

For the green LED connected to p21, how should the mbed class object be declared?
a) p21 DigitalIn(greenLED);
b) AnalogOut greenLED(p21);
c) DigitalOut greenLED(p21);
d) greenLED DigitalOut(p21);
e) DigitalIn greenLED(p21);
f) greenLED AnalogIn(p21);

c) DigitalOut greenLED(p21);

New cards
24

For the red LED connected to p20, how should the mbed class object be declared?
a) p20 DigitalIn(redLED);
b) redLED DigitalOut(p20);
c) AnalogOut redLED(p20);
d) redLED AnalogIn(p20);
e) DigitalIn redLED(p20);
f) DigitalOut redLED(p20);

f) DigitalOut redLED(p20);

New cards
25

What instruction should be used so that the state of the switch connected to p18 can be reliably
detected (pull-up or pull-down resistor enabled/disabled as appropriate)?
a) redSw.read(0);
b) redSw.write(0);
c) redSw.mode(PullUp);
d) redSw.read(PullUp);
e) redSw.mode(PullDown);
f) redSw.read(PullDown);

c) redSw.mode(PullUp);

New cards
26

What instruction should be used so that the state of the switch connected to p23 can be reliably
detected (pull-up or pull-down resistor enabled/disabled as appropriate)?
a) greenSw.mode(PullDown);
b) greenSw.read(PullDown);
c) greenSw.read(0);
d) greenSw.write(0);
e) greenSw.mode(PullUp);
f) greenSw.read(PullUp);

a) greenSw.mode(PullDown);

New cards
27

Which of the following instructions will turn on the red LED connected to p20 if the switch
connected to p18 is currently pressed (closed) and turn off the LED if the switch is not current
pressed (open)?
a) if (redSw == 0) redLED = 1;
else redLED = 0;
b) if (redSw == 1) redLED = 1;
else redLED = 0;
c) if (redSw == 0) redLED = 0;
else redLED = 1;
d) if (redSw == 1) redLED = 0;
else redLED = 1;
e) redLED = redSw;
f) redSw = redLED;

a) if (redSw == 0) redLED = 1;
else redLED = 0;

New cards
28

Which of the following instructions will turn on the green LED connected to p21 if the switch
connected to p23 is currently pressed (closed) and turn off the LED if the switch is not current
pressed (open)?
a) if (greenSw == 1) greenLED = 1;
else greenLED = 0;
b) if (greenSw == 0) greenLED = 1;
else greenLED = 0;
c) if (greenSw == 1) greenLED = 0;
else greenLED = 1;
d) if (greenSw == 0) greenLED = 0;
else greenLED = 1;
e) greenLED = !greenSw;
f) greenSw = !greenLED;


a) if (greenSw == 1) greenLED = 1;
else greenLED = 0;

New cards
29

Suppose a photometric sensor outputs 0.005 V per lux and is connected to the mbed's analog to
digital subsystem. It is readable through an AnalogIn object named “photometer”. Which of the
following instructions would compute the instantaneous (not average) light level (in lux):
a) lux = photometer.read();
b) lux = photometer.read()*0.005;
c) lux = photometer.read()/0.005;
d) lux = photometer.read()*3.3*0.005;
e) lux = photometer.read()*3.3/0.005;
f) lux = photometer.read()/3.3*0.005;

e) lux = photometer.read()*3.3/0.005;

New cards
30

int main()

return an integer value

New cards
31

DigitalOut

sending out to outside world from mbed, declares an object that can control the digital logic level of a pin

New cards
32

active high LED

cathode towards ground LED =1; turns on

New cards
33

active low LED

anode pin towards a positive rail LED =0; turns on

New cards
34

active high switch

positive power rail, needs a pull down resistor- input to ground sw=1 does something

New cards
35

active low switch

ground; needs a pull up resistor - input to power; sw=0 does something

New cards
36

digitalIn

declares an object that can report the digital logic level of a pin

New cards
37

BusOut

declares an object that can control the digital logic levels of a group of pins, with each bit controlling a pin

New cards
38

digital to analog

Va=(3.3)D/2^10

New cards
39

analog to digital

Va=(3.3)D/2^12

New cards
40

analogOut

declares an object that can control the voltage of a pin in very small steps on the range of 0 to 3.3v (p18)

New cards
41

PwmOut

declare an object that generates a pulsewidth modulated signal on a pin p21-p26

New cards
42

duty cycle

pulse width/period

New cards
43

serialpc(USBTX,USBRX)

pc.baud(9600)

New cards
44

AnalogIn

declares an object that can read the voltage of a pin in very small steps on the range of 0 to 3.3 p15-p20

New cards

Explore top notes

note Note
studied byStudied by 121 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 36 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 17 people
Updated ... ago
4.5 Stars(2)
note Note
studied byStudied by 85 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 43 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 10 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 578 people
Updated ... ago
5.0 Stars(2)

Explore top flashcards

flashcards Flashcard20 terms
studied byStudied by 5 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard20 terms
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard20 terms
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard29 terms
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard24 terms
studied byStudied by 1 person
Updated ... ago
5.0 Stars(1)
flashcards Flashcard52 terms
studied byStudied by 2 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard42 terms
studied byStudied by 5 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard101 terms
studied byStudied by 205 people
Updated ... ago
5.0 Stars(5)