EE3329 Midterm 1

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/43

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 8:42 PM on 10/1/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

44 Terms

1
New cards

What is the intended “flow” of code

#define variable definitions, main(), called functions below

2
New cards

How would you call an integer function turnLED within main, then what would the function definition look like if there was #define ON (1)

turnLED(ON), int turnLED(int state)

3
New cards

what are the different uint and int definition types for? What do we use typically?

unsigned and signed values. uint

4
New cards

What are GPIO MODER bit assignments 00 and 01?

Input and Output

5
New cards

What is the operator %?

gives remainder after division

6
New cards

When is XOR (^) = 1?

if only 1 is 1

7
New cards

how do you write an if statement with multiple alternatives. What does while(condition) do?

if (condition) … else if (condition)… else. While will repeat the while function as long as the condition is met

8
New cards

How do you mask (isolate certain bits) within a register by clearing the upper four bits of A then shifting 9 up to the 4 bits?

a = a & 0×0F, a = a | (9 << 4)

9
New cards

What does this do?: GPIOC->MODER &= ~(GPIO_MODER_MODE0 | GPIO_MODER_MODE1);


Clears the bits for PC0 and PC1

10
New cards

What does this do?: GPIOC->MODER |= (GPIO_MODER_MODE0_0 | GPIO_MODER_MODE1_0);


Sets bit 0 of each to 01 to declare output

11
New cards

What does this do?: GPIOC->OTYPER &= ~(GPIO_OTYPER_OT0 | GPIO_OTYPER_OT1);


Clears bits to zero for open drain output

12
New cards

What does this do? GPIOC->PUPDR &= ~(GPIO_PUPDR_PUPD0 | GPIO_PUPDR_PUPD1);


Clears bits for no pull up resistor

13
New cards

What does this do?: GPIOC->OSPEEDR |= ((3 << GPIO_OSPEEDR_OSPEED0_Pos) |

(3 << GPIO_OSPEEDR_OSPEED1_Pos));

Sets the speed for both pins to be 11 for the highest speed and shifts it left to the correct pin

14
New cards

What does this do?: GPIOC->BRR = GPIO_PIN_0 | GPIO_PIN_1;

Sets 1 to the bit reset register in both pins

15
New cards

What does this do?: RCC - > AHB2ENR |= ( RCC_AHB2ENR_GPIOAEN | RCC_AHB2ENR_GPIOCEN ) ;

Turns on the clock for both gpioa and gpioc

16
New cards

What are the two main paths of GPIO pins?

IDR and ODR

17
New cards

What is the problem with ODR? What can we use instead to mitigate this problem, and what is the word associated with the solution?

It takes too many clock cycles. Use BSRR on the GPIO pins to execute as a single operation, this is known as atomic

18
New cards

What is MODEx_Pos, MODEx_1, MODEx_0?

The bit position of mode x, 1 at bit 1 of mode x, 1 and bit 0 of mode x

19
New cards

How do you make a for loop for a variable Idx that starts at 0, has to be less than 5, and gets 1 added each iteration?

for (Idx = 0 ; Idx < 5 ; Idx++)

20
New cards

How do you define a variable PI to be 3.14? Where would this be?

#define PI (3.14). Header file

21
New cards

What is typedef used for and what is the syntax?

it is used to define a type of variable. typedef data_type name

22
New cards

How do you get a binary value from a number?

Divide by 2 and take remainder then reverse the output

23
New cards

How do you write pseudocode?

start with configurations, then how decisions are made

24
New cards

What is a switch statement? How do you create one?

A state defintion. switch(expression) { case constant-expression: statements; break: default: … }

25
New cards

what do .h files do?

They initialize variables and functions to be used within c files

26
New cards

In regards to functions, what does void mean? what does int mean?

void means nothing is returned by the function, int means an integer is returned

27
New cards

how do you use typedef to set up boolean logic?

typedef int bool;

#define false (0)

#define true (!false)

28
New cards

Where should you initialize most variables? Where do most functions belong in c code (not where they are called from)

initiate within the given function to avoid global variables. Belong below main()

29
New cards

What is debounce? How do we avoid it with software?

It is a strategy to avoid the oscillation that comes with switching. Checking once every few microseconds for state changes multiple times in a row

30
New cards

For timing diagrams, what are setup and hold times. What is minimum pulse width?

setup times are data time before clock edge, hold times are data time after clock edge. It is the time the clock must stay high or low long enough for the register to recognize it.

31
New cards

For LCD Control explain what the values mean, then what these are afterwards:

RS = 0 and 1, R/W = 0 and 1, E falling edge

command and data, write and read, LCD captures data. RS tells LCD what is being sent, R/W tells LCD what is being read/written, E tells LCD to capture the data on falling edge

32
New cards

What are flowcharts? How do you write them?

Flowcharts outline the reasoning behind code like pseudocode. You start with a oval and end with an oval, squares are processes, stop signs are decisions meant to branch

33
New cards

A 4 MHz clock is how many clock edges per second? One clock tick every how many seconds?

4M, 1/4M

34
New cards

What is the progression of the timer setup?

Clock, Prescaler, Counter, AAR/CCR, Interrupt

35
New cards

What do the Clock, Prescaler, Counter, AAR/CCR do?

the clock is the sources of edges to be counted, prescaler slows clock by dividing frequency, counter is 32 bits to count the clock edge amount, AAR sets the end of timer count, CCR can generate an event at a different point than AAR

36
New cards

What is upcount, downcount, center-alligned?

count from 0 to AAR then reset, count from AAR to 0 then reset, count from 0 to AAR then 0 repeatedly

37
New cards

What is continuous counting?

When you set AAR to the maximum value then let CCR set the intended period for events

38
New cards

How does an interrupt work? What are its parts?

It temporarily stops main() at an interrupt flag. When the timer generates an interrupt, the interrupt vector table allows reading of ISR addresses for each timer flag due to interrupt request

39
New cards

What are the bit options for OTYPER (OTx)?

0 = push-pull, 1 = open drain

40
New cards

What are the PUPDR 2 bit options?

00 - none, 01 - pullup, 10 - pulldown, 11 - reserved

41
New cards

For all types of initialization (PUPDR, MODER, OSPEEDR, etc) besides OTYPER, where are the 2 bits located? Where is the one bit for OTYPER?

the first bit is at 2 times the pin number, the bit is at the pin number

42
New cards

What is the BSRR options?

0-15 sets corresponding GPIO pin high, 16-31 resets GPIO pin low

43
New cards

What are the options for BRR?

0 - nothing, 1 - pin is set low

44
New cards

How do you make a negative number corresponding to its positive number (signed)?

write binary for number, flip every bit, add 1