Quiz
Embedded software
Erstelle ein kostenloses Konto, um dieses Quiz zu beenden
Speichere deinen Fortschritt und sieh dir dein Endergebnis an.
oder mit deiner E-Mail registrieren
Schon ein Konto? Anmelden
Fragen in diesem Quiz (58)
1The declaration of a global variable with scope restricted to the file in which it is
declared is accomplished with the keyword:- Astatic
- Bconst
- Cautomatic
2When considering the issue of critical sections, I/O ports are categorized as:
- Alocal variables
- Bglobal variables
- Cvolatile variables
3void __attribute__ ((interrupt)) LPT_ISR(void)
{
LPTMR0_CSR |= LPTMR_CSR_TCF_MASK;
y += 65;
}
void main(void)
{
...
y -= 1000;
..
}
An ISR and a main
program share access to
global variable y. A
critical section occurs
in:- ARTI_ISR and Main
- BRTI_ISR only
- CMain only
4The declaration int* const p = &total; can be interpreted as:
- Ap is a modifiable pointer that points to a read-only int
- Bp is a read-only pointer that points to a modifiable int
- C) p is a read-only pointer that points to a read-only int
5An internal register like FTM0_CNT is defined as volatile because:
- Ait is 16-bits wide
- Bit needs to be permanently allocated
- Cthe software is not allowed to change its value
- DNone
6To store your version-controlled software to a remote Git repository, you would
use the command:- APull
- BFetch
- CPush
7The binary value of an uint8_t variable is
11000001 2
. The decimal value is:- A0xC1
- B193
- C-63
8Assume PTA5 is an output and the other PORTA bits are inputs.
C code that sets PTA5 high only if PTA1 is low and PTA2 is high is:- Aif ((GPIOA_PDIR & 0x06) == 0x04)
GPIOA_PSOR = 0x20; - Bif (((GPIOA_PDIR & 0x02) == 0) && ((GPIOA_PDIR & 0x04) == 1))
GPIOA_PSOR = 0x20; - Cif (((GPIOA_PDIR | 0x02) == 0) && ((GPIOA_PDIR | 0x04) == 1))
GPIOA_PCOR = 0x20;
- Aif ((GPIOA_PDIR & 0x06) == 0x04)
9The initial value of an unsigned char “x” is
01111010 2
. The value of x after
executing the line of code “x ^= (1 << 5);” is:- A11111010
- B01001111
- C00111010
- D01011010
10void __attribute__
((interrupt))
LPT_ISR(void)
{
LPTMR0_CSR |= 0x80;
GPIOA_PSOR = 0x01;
if (GPIOA_PDIR & 0x04)
GPIOA_PCOR = 0x04;
GPIOA_PCOR = 0x01;
}
void main(void)
{
LPT_Init();
for (;;)
{
if (!(GPIOA_PDIR & 0x04))
GPIOA_PSOR = 0x04;
GPIOA_PTOR = 0x02;
}
}
LPT_Init() sets up
the low-power timer
and sets Port A to
output. The waveform
seen at Port A could
be:- A

- B

- C

- A
11void __attribute__ ((interrupt)) LPTMR0_ISR(void)
{
__DI();
LPTMR0_CSR |= 0x80;
Count++;
}
All ISRs are configured
to have a priority of 0.
The redundant code in
this ISR is:- A__DI();
- BLPTMR0_CSR |= 0x80;
- CCount++;
12To download and merge version-controlled software from a remote Git repository,
you would use the command:- APull
- BFetch
- CPush
13void __attribute__ ((interrupt))
FTM0_ISR(void)
{
if (FTM0_CnSC(5) & 0x80)
{
FTM0_CnSC(5) &= ~0x80;
FIFO_Put(ADC_Get(0));
// Your code goes here
}
}
FTM0_CNT is running at 8 MHz and
is used by other channels in the FTM
unit. The goal is to accurately
sample the ADC input 0 every 1 ms
using Channel 5 of the FTM.
What C code do you place in the ISR
to make the timing accurate?- AFTM0_CnV(5) += 8000;
- BFTM0_CnV(5) = FTM0_CNT+8000;
- CFTM0_CNT = 0;
14int16_t Scale(const int16_t input)
{
// multiply by 1.234
return 1234 * (input / 1000);
}
The result of calling
Scale(10) is:- A12.34
- B0
- C12
15bool bLPT = 0;
bool bPIT = 0;
void __attribute__ ((interrupt)) LPTMR_ISR(void)
{
bLPT = !bPIT;
// Acknowledge LPTMR
...
}
void __attribute__ ((interrupt)) PIT_SR(void)
{
bPIT = !bLPT;
// Acknowledge PIT
...
}
The ISRs are called
periodically.
The LPTMR_ISR
interrupt service
routine executes first.
After a long time, the
global variables take on
the values:- AbLPT=1, bPIT=0
- BbLPT=0, bPIT=1
- Cindeterminate
16A global variable is defined using the Embedded Software Style Guide with a
name Voltage_Threshold. It has:- Aprivate scope, temporary allocation (stack)
- Bprivate scope, permanent allocation (RAM)
- Cpublic scope, permanent allocation (RAM)
17The waveform is one
frame of serial data
using an 8N1 protocol.
The LSB occurs before
the MSB. The data is:
- A0x38
- B0x0E
- C0x1C
18UART2_S1 has two
interrupt flags set –
RDRF and TDRE.
C code to acknowledge
(i.e. clear) TDRE is:
- Aif (UART2_S1 & 0x80) // read status with TDRE set
UART2_D = data; // write serial data register - BUART2_S1 = 0x80; // write 1 to clear TDRE flag
- Cif (UART2_S1 & 0x80) // read status with TDRE set
data = UART2_D; // read serial data register
- Aif (UART2_S1 & 0x80) // read status with TDRE set
19When considering the issue of critical sections, I/O ports are categorized as:
- Alocal variables
- Bglobal variables
- Cvolatile variables
20Assume PTA5 is an output and the other PORTA bits are inputs.
C code that sets PTA5 high only if PTA1 is low and PTA2 is high is:- Aif ((GPIOA_PDIR & 0x06) == 0x04)
GPIOA_PSOR = 0x20; - Bif (((GPIOA_PDIR & 0x02) == 0) && ((GPIOA_PDIR & 0x04) == 1))
GPIOA_PSOR = 0x20; - Cif (((GPIOA_PDIR | 0x02) == 0) && ((GPIOA_PDIR | 0x04) == 1))
GPIOA_PCOR = 0x20;
- Aif ((GPIOA_PDIR & 0x06) == 0x04)
21void _attribute_ ((interrupt))
ISR(void)
{
XXXXX uint16_t last = 0;
Elapsed = FTM0_CNT - last;
last = FTM0_CNT;
}
The goal is to measure the elapsed
time from one interrupt call to the
other.
What qualifier do you place in the
XXXXX position to make this
measurement operational?- Avolatile
- Bstatic
- Cconst
22int16_t Add2(const int16_t input)
{
return input + 2;
}
The input parameter
has:- Apermanent allocation, private scope
- B8-bit precision
- Ctemporary allocation, private scope
23The IEEE Code of Ethics says: “to hold paramount the safety, health, and welfare
of the public, to strive to comply with ethical design and sustainable development
practices, and to disclose promptly factors that might endanger the public or the
environment”. If a potential software error or design flaw is found, you should:- Areport it to the IEEE
- Brelease a new version of software to consumers immediately
- Cdiscuss the potential error with your colleagues
24Tri-state logic allows
an output port to
assume a high Z state,
effectively removing
the output from the
circuit.
To turn the LED on,
you need to:
- Aset PTA0 & PTA1
- Bclear PTA0, set PTA1
- Cclear PTA0 & PTA1
25The condition where thread 1 is waiting for a resource held by thread 2, and
thread 2 is waiting for a resource held by thread 1, is known as:- Aa critical section
- Bstarvation
- Cdeadlock
26void __attribute__
((interrupt))
LPT_ISR(void)
{
LPTMR0_CSR |= 0x80;
if (++Time == 60)
Time = 0;
}
void main(void)
{
...
UART_Out(Time/10);
UART_Out(Time%10);
...
}
An ISR and a main
program share access to
global variable Time.
A critical section
occurs:- Anowhere
- Bin main only
- Cin LPT_ISR only
27void __attribute__ ((interrupt))
UART2_ISR(void)
{
char status = UART2_S1;
GPIOA_PSOR = 1;
if (!TxFIFO_Get(&UART2_D))
UART2_C2 &= ~UART_C2_TIE_MASK;
GPIOA_PCOR = 1;
}
void OutChar(const char data)
{
// Wait if FIFO is full
while (!TxFIFO_Put(data));
// Arm TDRE
UART2_C2 |= UART_C2_TIE_MASK;
}
The baud rate is 1000 bps. The UART hardware is initially idle. The time when
OutChar is called is 0. The waveform obtained on PTA0 is:- A

- B

- C

- A
28int8_t A, B, C;
int8_t Out1, Out2, Out3, Out4;
A = 4; B = -7; C = 2;
Out1 = (A + B) – C;
Out2 = A + (B – C);
Out3 = (A * B ) / C;
Out4 = A * (B / C);
The following expression will
evaluate to FALSE:- AOut1 == Out2
- BOut3 == Out4
- COut3 != Out4
29The initial value of an unsigned char “x” is
101010102
. The value of x after
executing the line of code “x = (x >> 3) & 0x0F;” is:- A00001010
- B00001111
- C00000101
30static uint8_t Num, Result;
static uint8_t Filter(const uint8_t n)
{
static uint8_t m = 0;
m = (n + m) / 2;
return m;
}
void __attribute__ ((interrupt)) LPT_ISR(void)
{
LPTMR0_CSR |= 0x80;
Result = Filter(++Num);
}
A critical section
occurs:- Ain Filter only
- Bin LPT_ISR only
- Cnowhere
31const char v1 = 100;
static char v2 = 10;
char add3(const char v3)
{
static char v4;
v4 = v1 + v3;
return (v4);
}
void main(void)
{
v2 = add3(v2);
}
A = Global RAM
B = Stack RAM
C = Non-volatile ROM
The variables v1, v2, v3 and v4 are
respectively allocated in:- AA, B, A, C
- BC, A, B, A
- CA, A, A, A
32The baud rate is:

- A250bps
- B555.6 bps
- C500 bps
33The binary value of a signed char “x” is
110000012
. The decimal value is:- A0xC1
- B193
- C-63
34A big-endian 16-bit number is stored at address 0x0900. The LSB is stored at:
- A0x0900
- B0x0901
- C0x0902
35If an interrupt service routine does not acknowledge or disarm an interrupt then:
- Asoftware “crashes” because no more interrupts will be requested
- Bthe next interrupt is lost
- Csoftware “crashes” because interrupts are requested over and over
36Timer channels 0 and 1
have their interrupt
flags set. Writing a 1 to
a bit clears the flag. C
code to clear only bit 0:
- ATGSR |= 0x01;
- BTGSR = 0x01;
- CTGSR &= ~0x01;
37int32_t x;
int32_t func(int32_t in)
{
int32_t out = 0;
while (in >= 0)
{
out = out + in;
in = in - 2;
}
return out;
}
If we were to execute x=func(5);
what would be the value of x?- A9
- B8
- C5
38A global variable is defined using the Embedded Software Style Guide with a
name VoltageThreshold. It has:- Aprivate scope, temporary allocation (stack)
- Bprivate scope, permanent allocation (RAM)
- Cpublic scope, permanent allocation (RAM)
39void __attribute__
((interrupt))
FTM0_ISR(void)
{
static uint16_t count;
count++;
...
}
void __attribute__
((interrupt))
FTM3_ISR(void)
{
static uint16_t count;
count++;
...
}
The intention is for
each ISR to count the
number of interrupts
occurring. The count
variable:- Ais indeterminate because its value is never initialized
- Bis a global variable shared by both ISRs
- Cis permanently allocated with private scope within each ISR
40A static variable is initialized by compo;er generated code
- Aeach time the program enters the function in which is it declared
- Bone, before the first instance of the users assignment statement
- Conce, just before the program starts to run
41refer to pic

- ASwap(x,y)
- BSwap(*x, *y)
- CSwap (&x, &y)
42pic

- A

- B

- C

- A
43The initial value of an unsigned char 'x' is 0b01111010
the value of x after executing the line of code 'x = x || 0x20'- A0b00000001
- B0b00000000
- C0b011111110
44The periodic interrupt timer is setup to initiate interrupts periodically/ an operation that does NOT occur when a typical PIT interrupt is processed is
- Athe TIF flag is Cleared as a reault of executing a specific instruction (e.g. PIT_TFLG0 = PIT_TFLG_TIF_MASK;)
- Bthe EXC_RETURN instruction is executed
- Cthe "CPSID f" assembly language instruction is executed to disable further interrupts
45In 2's complement notation:
- Aoverflow is impossible when subtracting two positive operands
- Bthe absolute values of full-scale negative and full-scale positive are equal
- Cthere are two representations of zero
46image

- A0,0,0,0,0x34,0x12
- B0,0,0x35,0x12,0,0
- C0,0,0,0x34,0x12,0
47image

- APIT_ISR and MAIN
- BPIT_ISR
- CMAIN
48pic

- Av,y
- Bw,x
- Cx,z
49The declaration of a global variable with scope restricted to the file in which it is declared is accomplished with the keyword
- Astatic
- Bvolatile
- Cautomatic
50The variable I and N are declared as uin16_t . C code performs the most accurate fixed-point calculation I = 3000 * N = 1023
- A(3000 * N +512 ) /1023
- B(44 * N +7 )/15
- C(uint16_t)((3000*(uint32_t)N)/1023)
51The programming bug in the fuction is:

- Apotential overflow in adding ( x + Y)
- Btype mismatch in adding (x + y)
- Cy is initialized over and over again
52After entry to an interrupt service routine, the single bit "fault mask" register FAULTMASK has been automatically
- Acleared
- Bset
- Cleft unchanged
53image

- Aminutes = ( time & 0x3f) << 5
- Bminutes = time & (ox3F
- Cminutes = ( time >> 5) & 0x3f
54image

- ARTI_ISR and main
- BRTI_ISR
- Cnowhere
55Adding the type qualifier volatile to the declaration of a shared object tells the compiler that:
- Aanother thread may change its value so the compiler will generate code to protect against data corruption
- Bthe object may be asynchronously modified by mechanisms other than the code in which the declaration appears
- Cthe object can only be used when interrupts are disabled
56the declaration int * const p = &total; can be interpreted as
- Ap is a modifiable pointer that points to a read only int
- Bp is a read only pointer that points to a modifiable int
- Cp is a read only pointer that points to a read only int
57the declaration const int * const p = &total
- Ap is a modifiable pointer that points to a read only int
- Bp is a read only pointer that points to a modifiable int
- Cp is a read only pointer that points to a read only int
58pic

- Av, y
- Bw, x
- Cx,z
Informationen
- Beschreibung
- Engineering Quiz am Embedded software, erstellt von Tim Baker am 22/09/2019.
- Autor
- Tim Baker
- Sprache
- English
- Aufrufe
- 20
- Verlauf
- Erstellt am 22 Sep 2019 · aktualisiert am 22 Sep 2019
- Schlagwörter
- Bewertung
- Noch keine Bewertungen Bewerte dieses Quiz