Digital Test 1

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

1/57

encourage image

There's no tags or description

Looks like no tags are added yet.

58 Terms

1
New cards
<p>part A. To allow input signal flow from the pin to the data bus, the gate labelled A must be enabled with a logic ____.</p><p>part B. Assume 8 switches are connected to PORTD. Write the code to enable this gate.</p>

part A. To allow input signal flow from the pin to the data bus, the gate labelled A must be enabled with a logic ____.

part B. Assume 8 switches are connected to PORTD. Write the code to enable this gate.

Logic 1 (high), TRISD = 0xFF;

2
New cards

unsigned char switchState;

switchState = PORTB & 0x0C;


Assume that 4 active low switches are connected to the lower nibble of PORTB and the port is configured properly. If all four switches are not pressed, what value will switchState contain if the code "switchState = PORTB & 0x0C;"  executes?

0x0C

3
New cards
<p>How many pins are available on PORTB for students to use when the Snap debugger is attached?</p>

How many pins are available on PORTB for students to use when the Snap debugger is attached?

6 pins

4
New cards

Timer0 may be configured as a 16-bit timer/counter?

True

5
New cards

Write a for loop to initialize each element of the array with -99.9

for(int i; i < size; i++) { arrayOne[i] = -99.9; }

6
New cards

In MPLAB the Special Functions Registers(SFRs) are set-up to configure Timer0. What is the proper name of the SFR you would need to set-up to  select 8-bit or 16-bit timer?

T0CON

7
New cards

unsigned char var1;

var1= 0x08;

var1 = var1 << 1;

After the code above executes, var1 will contain ______.

0x10

8
New cards

Timer0 preload value is used to achieved specific value between the minimum and maximum values at given configurations

True

9
New cards

Write the declaration to create storage for 120 temperature readings. Each temperature measure is in the range of 10 to 120 degrees Celsius. 

float temperatures [120];

10
New cards

At least one stop bit must be present between data transfer.

True

11
New cards

unsigned char switchState;

Assume that 4 active low switches (SW3-SW0) are connected to the lower nibble of PORTB (RB3:RB0) and the port is configured properly. If SW0 is pressed, what value will switchState contain if the following code executes?

switchState = PORTB & 0x0F; 

0x0E

12
New cards

What is the result of 0b0110 | 0b1100 ?

0b1110

13
New cards

Wiring RS232 port so the the signals are input directly into a PIC will likely result in damage.

True

14
New cards

In RS232 communications, when the transmit line is not active (not transmitting), the pin rests at logic "1".

True

15
New cards

unsigned char var1;

var1= 0x88;

var1 = var1 >> 1;

After the code above executes, var1 will contain ______.

0x44

16
New cards

RS232 is a mechanical and electrical standard. Logic 0 is considered if a signal is in the range of _____ volts to _____ volts

+3 V to +15 V

17
New cards

unsigned char var1;

var1= 0x1F;

var1 = var1 >> 5;

After the code above executes, var1 will contain ______.

0x00

18
New cards

When using MCC to enable serial communications for the 18f45k22, one of two EUSARTs must be selected.

True

19
New cards

What is the result of 0b0110 & 0b1100 ?

0b0100

20
New cards

unsigned char switchState;

Assume that 4 active low switches (SW3-SW0) are connected to the lower nibble of PORTB (RB3:RB0) and the port is configured properly. If SW3 is pressed, what value will switchState contain if the following code executes?

switchState = (PORTB & 0x0F)>>3;

0x00

21
New cards

The following SFRs are needed to be configured for EUSART1



RCSTA1, TRISC, TXSTA1, and BAUDCON1

22
New cards

What standard C function must be called before "truely" random numbers can be generated?

srand()

23
New cards

The oscillator frequency selected for PIC operation does not affects the BAUD rates that are available.

False

24
New cards

RS232 is an example of a NRZ (Non-Return-to-Zero) waveform.

True

25
New cards

Write a code segment (not a full program) to fill an array of size 50 with random numbers in the range 10 to 120



for (int i = 0; i < 50; i++) { arrayOne[i] = (rand() % 111) + 10;}

26
New cards

unsigned char switchState;

Assume that 4 active low switches (SW3-SW0) are connected to the lower nibble of PORTB (RB3:RB0) and the port is configured properly. If the SW2 and SW1 are pressed, what value will switchState contain if the following code executes?

switchState = (~PORTB & 0x0F)>>1; 

0×03

27
New cards

Timer0 overflow flag is automatically reset by MAPLAB X MCC software

False

28
New cards

How many EUSART ports are available in PIC18F45K22?



2 ports

29
New cards

In MPLAB the Special Functions Registers(SFRs) are set-up to configure Timer0. What is the proper name of the SFR you would need to set-up to  selecte prescaler value for  Timer 0.

T0CON

30
New cards

Timer 0 may be configured to count external events that occur on an external pin.

True

31
New cards

What register controls the data direction of a ports pins? i.e: what register must be configured to make a pin act as an input or output. (Proper spelling as it is used in C code)



TRIS = 0 for output, TRIS = 1 for input

32
New cards

RS232 is a mechanical and electrical standard. Logic 1 is considered if  a signal is in the range of _____ volts to _____ volts

−3 V to −15 V

33
New cards
<p>List the states the gate marked with A can output?</p>

List the states the gate marked with A can output?

Logic 0, Logic 1, and High-Impedance (High-Z)

34
New cards

Write c-code to reset Timer0 overflow flag

INTCONbits.TMR0IF = 0;

35
New cards

unsigned char var1;

var1= 0x80;

var1 = var1 >> 1;

After the code above executes, var1 will contain ______.

0x40

36
New cards

unsigned char var1;

var1= 0x80;

var1 = var1 >> 4;

After the code above executes, var1 will contain ______.

0x08

37
New cards

In serial communications the least significant bit is the first data bit to be sent.

True

38
New cards

The Snap debugger supplies power to your breadboard.

False

39
New cards

There are 3 Timer0 Prescaler Selection bits. This allows the programmer to select 1 out of ____ prescaler values.



8 values

40
New cards

Write the code to initialize the lower nibble of port B to be inputs and the upper nibble to be outputs.

TRISB = 0x0F;

41
New cards

RC7 is dedicated TX pin for RS232 port in PIC18F45K22.

True

42
New cards

In MPLAB the Special Functions Registers(SFRs) are set-up to configure Timer0. What is the proper name of the SFR you would find Timer0 overflow (rollover) flag?



INTCON

43
New cards

The current value held by Timer 0 may be read.

True

44
New cards

Calculate the rate in HZ at which timer0 changes if the PIC18f45k22 has its internal oscillator set to 4MHz and a prescaler of 2 is selected

500kHz

45
New cards

In general, interrupt sources have three bits to control their operation. They are:

  • Flag bit : to indicate that an interrupt event occurred

  • Enable bit: that allows program execution to branch to the interrupt vector address when the flag bit is set

  • Priority bit: to select if the interrupt subroutine at address _______ or address ________  is dispatched


0x0008, 0x0018

46
New cards

Explain what effect would setting the #defined symbol TMR0_INTERRUPT_TICKER_FACTOR to 1 have? ie: #define TMR0_INTERRUPT_TICKER_FACTOR 1

Setting it to 1 means the program counts every Timer0 interrupt instead of skipping some.

47
New cards

EUSART1 can be assigned to a high or low priority

True

48
New cards

Timer 0 can be assigned to a high or low priority

True

49
New cards

To allow a counter variable to be incremented or decremented in the callback function, such as flashLED_ISR( ), but the counter is use to control LEDs (such as LED Toggle) within the main loop, what type of variable is required? (ie: global, local, static, etc...)

Global variable

50
New cards

The Timer0 interrupt is generated when the Timer0 count register overflows from FFFFFFh to 000000h in 16-bit mode

False

51
New cards

The oscillator frequency is divided by 8 before entering into the Timer0 block.

True

52
New cards

In lecture example codes, the callback function flashLED_ISR( ) is called every time Timer0 overflows.

True

53
New cards

You can call interrupt subroutine functions from within main safely.

False

54
New cards

In what MCC generated file does #define symbol TMR0_INTERRUPT_TICKER_FACTOR exist?

mcc.h

55
New cards

In the 18f45k22 , high priority interrupts can be enabled while the low priority interrupts are disabled BUT Low priority interrupts can ONLY be enabled if the high priority interrupts are enabled.

False

56
New cards

What is the maximum number of levels of priority interrupts within the 18f45k22?

2 levels

57
New cards

When the prescaler is assigned to Timer0, 3 bits control the prescaler value thus enabling the selection of prescale values of 1:2 through 1:512 in integer power-of-2 increments.

False

58
New cards

In main, what function is required to be enabled in order for Timer0 interrupts to work?

INTERRUPT_GlobalInterruptEnable();