microprocessor problems
EET 3264 - Fall 2014 - Exam I
1) Suppose the keypad is connected to PORTB as shown below. For each of the keys, determine
the pattern that would be used in the keypad scanning routine. (16 patterns needed.)
PIC
RB7
RB6
RB5
RB4
RB3
RB2
RB1
RB0
1 2 3 A
4 5 6 B
7 8 9 C
* 0 # D
Row 2
Col 2
Row 4
Row 3
Col 1
Row 1
Col 3
Col 4
C1 C2 C3 C4
R1
R2
R3
R4
2) For the PWM waveform shown in the following scope image, determine the frequency, the
duty cycle, and the average voltage. Show your work.
3) Determine the values that should be loaded into each register listed below to get a 1000Hz
PWM signal with a duty cycle of 40%. Assume that the oscillator frequency is 16MHz.
CCP2CON:
CCPR2L:
PR4:
T4CON:
CCPTMRS0:
4) Suppose the UART has been initialized with the values given below. If the oscillator
frequency is 12MHz, what is the Baud rate of the UART?
TXSTA = 0x20 RCSTA = 0x80
BAUDCON = 0x08
SPBRGL = 0x37
SPBRGH = 0x01
5) Sketch the timing diagram for an asynchronous serial transmission of the value 0x74.
6) Write a C-language function to set up the DAC in the PIC16F1936 as follows. Do not use
macros.
Pos. Ref. is Vdd
Neg. Ref. is input on RA2
DAC voltage is 3/4 full-scale
DAC output pin not enabled