1/57
Looks like no tags are added yet.

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;
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

How many pins are available on PORTB for students to use when the Snap debugger is attached?
6 pins
Timer0 may be configured as a 16-bit timer/counter?
True
Write a for loop to initialize each element of the array with -99.9
for(int i; i < size; i++) { arrayOne[i] = -99.9; }
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
unsigned char var1;
var1= 0x08;
var1 = var1 << 1;
After the code above executes, var1 will contain ______.
0x10
Timer0 preload value is used to achieved specific value between the minimum and maximum values at given configurations
True
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];
At least one stop bit must be present between data transfer.
True
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
What is the result of 0b0110 | 0b1100 ?
0b1110
Wiring RS232 port so the the signals are input directly into a PIC will likely result in damage.
True
In RS232 communications, when the transmit line is not active (not transmitting), the pin rests at logic "1".
True
unsigned char var1;
var1= 0x88;
var1 = var1 >> 1;
After the code above executes, var1 will contain ______.
0x44
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
unsigned char var1;
var1= 0x1F;
var1 = var1 >> 5;
After the code above executes, var1 will contain ______.
0x00
When using MCC to enable serial communications for the 18f45k22, one of two EUSARTs must be selected.
True
What is the result of 0b0110 & 0b1100 ?
0b0100
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
The following SFRs are needed to be configured for EUSART1
RCSTA1, TRISC, TXSTA1, and BAUDCON1
What standard C function must be called before "truely" random numbers can be generated?
srand()
The oscillator frequency selected for PIC operation does not affects the BAUD rates that are available.
False
RS232 is an example of a NRZ (Non-Return-to-Zero) waveform.
True
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;}
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
Timer0 overflow flag is automatically reset by MAPLAB X MCC software
False
How many EUSART ports are available in PIC18F45K22?
2 ports
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
Timer 0 may be configured to count external events that occur on an external pin.
True
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
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

List the states the gate marked with A can output?
Logic 0, Logic 1, and High-Impedance (High-Z)
Write c-code to reset Timer0 overflow flag
INTCONbits.TMR0IF = 0;
unsigned char var1;
var1= 0x80;
var1 = var1 >> 1;
After the code above executes, var1 will contain ______.
0x40
unsigned char var1;
var1= 0x80;
var1 = var1 >> 4;
After the code above executes, var1 will contain ______.
0x08
In serial communications the least significant bit is the first data bit to be sent.
True
The Snap debugger supplies power to your breadboard.
False
There are 3 Timer0 Prescaler Selection bits. This allows the programmer to select 1 out of ____ prescaler values.
8 values
Write the code to initialize the lower nibble of port B to be inputs and the upper nibble to be outputs.
TRISB = 0x0F;
RC7 is dedicated TX pin for RS232 port in PIC18F45K22.
True
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
The current value held by Timer 0 may be read.
True
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
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
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.
EUSART1 can be assigned to a high or low priority
True
Timer 0 can be assigned to a high or low priority
True
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
The Timer0 interrupt is generated when the Timer0 count register overflows from FFFFFFh to 000000h in 16-bit mode
False
The oscillator frequency is divided by 8 before entering into the Timer0 block.
True
In lecture example codes, the callback function flashLED_ISR( ) is called every time Timer0 overflows.
True
You can call interrupt subroutine functions from within main safely.
False
In what MCC generated file does #define symbol TMR0_INTERRUPT_TICKER_FACTOR exist?
mcc.h
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
What is the maximum number of levels of priority interrupts within the 18f45k22?
2 levels
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
In main, what function is required to be enabled in order for Timer0 interrupts to work?
INTERRUPT_GlobalInterruptEnable();