1. List and explain the structures of all SFR registers associated in setting up PIC18 Time r0. TMR0H:TMR0L T0CON INTCON
2. List and explain the structures of all SFR registers associated in setting up PIC18 UART Serial communication.
3. With a neat complete block diagram. Describe the steps to program Time r0 in 16-bit mode.
4. With a neat complete block diagram. Describe the steps to program Time r0 in 8bit mode.
5. Find the time rs clock frequency and its period for various PIC-18 based system, with the following crystal frequencies. Assume that a prescaler of 1:64 is used. a. 10 MHz b. 16 MHz
6. Assume the crystal frequency of 10 MHz connected to PIC-18, Calculate the maximum 16-bit Timer0 value in seconds for the following.
a. 1:256 prescaler b. 1:128 prescaler
7. Write a C18 program to toggle only the PORTB.4 bit continuously every 50ms. Use Time r0, 16-bit mode, the 1:4 prescalar to create the delay. Assume XTAL = 10MHz.
8. Write a C18 program to gene rate a frequency of 2 Hz only on pin PORTB.5. Use Time r0, 8-bit mode to create the delay.
9. Write a C18 program to gene rate a frequency of 250 Hz on all the bits of PORTC. Using Time r0 16bit mode. Assume XTAL=10MHz.
10. Write the diffe rence between Serial and Parallel communications. Briefly explain different types of serial communication.
11. List DB9 connector pins and explain the RS232 serial communication protocol interface used between DTE and DCE.
12. Given XTAL = 10MHz. find the SPBRG for the following baud rate a. 9600 b. 4800 c. 2400 d. 1200
13. Draw the asynchronous frame structure and wave form for 8-bit data “A” (41H).
14. Describe the steps to program PIC18 to transfer data serially.
15. Describe the steps to program PIC18 to receive data serially.
16. Write an assembly program to transmit the message “SET COLLEGE” serially at 9600 baud rate, 8-bit UART, 1 stop bit and do this forever.
17. Describe the importance of TXIF flag bit of PIC18 in serial communication.
18. Describe the importance of RCIF flag bit of PIC18 in serial communication.
19. Interface DC Motor to PIC-18 through optoisolator ILD74 and explain the H-Bridge DC motor connection.
20. W rite the C18 program to monitor the status of switch connected to RD7 and perform the following If SW = 0 DC motor moves with 50% duty cycle pulse. If SW = 1 DC motor moves with 2 5% duty cycle pulse.
21. Interface 1 6X2 LCD to PIC -18. And write a C18 program to send “JAIN” to the LCD starting at 5th position of line 1.
#include
#define rs PORTCbits.RC0 #define rw PORTCbits.RC1 #define en PORTCbits.RC2 void lcddata(unsigned int); void lcdcommand(unsigned int); void lcdinit(void); void MSDelay( int itime); void MSDelay( int itime) { unsigned int i, j; for(i=0;i
void lcddata(unsigned int character) { PORTD=character ; rs = 1; en = 1; en = 0; MSDelay(10); } void lcdinit(void) { lcdcommand(0X38); lcdcommand(0X0E); lcdcommand(0X0C); lcdcommand(0X01); lcdcommand(0X06); } void main(void) { TRISC=0x00; TRISD=0x00; PORTC=0x00; PORTD=0x00; MSDelay(200); while(1) { lcdinit(); lcdcommand(0X85); lcddata('J); lcddata(‘A'); lcddata('I’); lcddata('N’); MSDelay(500); lcdcommand(0XC1); } } 22. Interface 4x4 keypad to P IC-18 and also write the Key scanning algorithm.
Inte rfacing the keyboard to the PIC18
At the lowest level, keyboards are organized in a matrix of rows and columns.
The CPU accesses both rows and columns through ports; therefore, with two 8-bit ports, an 8 x 8 matrix of keys can be connected to a microprocessor. When a key is pressed, a row and a column make a contact; otherwise, there is no connection between rows and columns. In programming for keypad interfacing we must have two processes: (a) key press detection, and (b) key identification.
There are two ways by which the PIC 18 can perform key press detection: (1) the interrupt method, and (2) the scanning method. Scanning method for key press detection
1. Key press detection is by scanning. In this method, to detect a pressed key, the microcontroller grounds all rows by providing 0 to the output latch, then it reads the columns. 2. If the data read from the columns are equal to nil, no key has been pressed and the process continues until a key press is detected. If one of the column bits has a zero, however, this means that a key press has occurred. 3. After a key press is detected, the microcontroller will go through the process of identifying the key. Starting with the top row, the microcontroller grounds it by providing a LOW to the first row only; then it reads the columns. 4. If the data read is all Is, no key in that row is activated and the process is moved to the next row. It grounds the next row, reads the columns, and checks for any zero. 5. This process continues until the row is identified. After identification of the row in which the key has been pressed, the next task is to find out which column the pressed key belongs to. This should be easy since the microcontroller knows at any time which row and column are being accessed. Figure shows the flowchart for this method.
23. Interface unipolar stepper motor to PIC-18 through Line driver ULN2003. And write half wave(8 step) sequence and normal four step sequence.
24. For an 8 -bit ADC , we have VREF = 5V. Calculate D0:D7 output if the analog input is 2.1volt and 1.7volt.