tailieunhanh - Interfacing PIC Microcontrollers 11

Interfacing PIC Microcontrollers 11. Explore in detail microcontroller interfacing techniques using the popular PIC 16F877 Work through step-by-step examples interactively using circuit simulation software, supplied as assembly source code Gain the knowledge of a wide range of peripheral devices such as keyboards, displays, sensors and drives and serial communication with other processors, memory and more Use interactive simulation software to design and test circuits. | Interfacing PIC Microcontrollers Load Read TMR0 Register CLKIN 4 RA4 TMR0 Input --------r H X X X X X X X X Prescaler TMR0 Overflow Edge Select Input Select Prescale Value Select Prescale Enable TMR0 Register INTCON Register I1 X 1 X X 1 X X Bit 7 6 5 4 3 2 1 0 interrupt or Poll Bit Timer Interrupt Bit Label Function 2 T0IF TMR0 Overflow interrupt Flag 0 No Overflow 1 Overflow 5 T0IE TMR0 Overflow interrupt Enable 0 Disable 1 Enable 7 GIE Global interrupt Enable 0 Disable 1 Enable x x o 1 1 o o o OPTION Register Bit 7 6 5 4 3 2 1 0 Bit Timer Control Bit Label Function Prescaler Division Ratio 2 4 8 16 32 64 128 256 0 PS0 Prescaler Rate Select Bit 0 1 PS1 Prescaler Rate Select Bit 1 2 PS2 Prescaler Rate Select Bit 2 0 1 0 1 0 1 0 1 00 1 1 0 0 1 1 00 0 0 1 1 1 1 3 PSA Prescaler Assignment Bit 0 Select Prescaler for TMR0 1 Deselect Prescaler for TMR0 4 T0SE TMR0 Source Edge Select Bit 0 increment on rising edge of RA4 1 increment on falling edge of RA4 5 T0CS TMR0 Clock source Select Bit 0 instruction Clock Ext Clock 4 1 select RA4 input Figure Timer0 operation by default. If more than one interrupt source is enabled the program must test the flags to see which is active as part of the ISR. In program LED1H TimerO is initialised to make a full count of 256 instruction cycles. At 10 kHz this gives a delay of about 26 ms. This is more than enough for debouncing. The OPTION register is set up for the timer to operate from the instruction clock with no pre-scaling. The INTCON register is initialised to enable the timer interrupt. When the timer times out the program jumps to the interrupt service routine at address 004 resets the time out flag and returns. The program then waits for the button to be released and increments the LED count. 86 Input Output Keypad Input A keypad is simply an array of push buttons connected in rows and columns so that each can be tested for closure with the minimum number of connections Figure . There are 12 keys on a phone type pad .

TỪ KHÓA LIÊN QUAN