
PIC16f84 Microcontroller Exam Preparation Guide
Get ready for your exam with this comprehensive guide on PIC16f84 microcontroller featuring topics such as machine cycle duration, interrupt sources, I/O pins configuration, counting programs, and circuit analysis. Enhance your understanding and ace your exam with confidence.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Preparation for the exam
1. If the PIC16f84 microcontroller is connected to a quartz oscillator of 1MHz, what is the duration of the machine cycle, and the instruction cycle? The duration of the machine cycle is ________. The duration of the instruction cycle is ________. 2. How many sources of interrupts are there for the PIC16f84? List at least two of them. The number of interrupt sources are ______. Interrupt sources are _____________. 3. Which register is used to set the input/output pins of the microcontroller? How? Setting the input/output pins is done using the register ___________, in the following way ________________________
The following program performs counting on a 7-segment display. Determine the sequence of counting (first 10 numbers)! The counting sequence is: _______________________. If the used oscillator has a frequency of 0.4MHz, what is the time interval between the states of the counter? The time interval between the states is ___________. What is the maximum possible time delay when using 2 variables and the oscillator frequency is 0.4Mhz?
PROCESSOR 16F84 #include p16f84.inc __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC cblock 0x0c DelayL DelayM DelayH Pointer endc Loop1 clrf Loop2 movf Pointer,W call DataTable movwf PORTB call Delay incf Pointer movlw d'5' xorwf Pointer,W btfss STATUS,Z goto Loop2 goto Loop Pointer org goto org goto 0x00 Main 0x04 Main Main bsf clrf clrf bcf movlw d 5 call movwf PORTB STATUS,RP0 TRISA TRISB STATUS,RP0 DataTable
DataTable addwf PCL retlw b'01011011 retlw b'01111101 retlw b'01101111 retlw b'01100110 retlw b'00111111 retlw b'01001111 retlw b'00000110 retlw b'01111111 retlw b'01101101 retlw b'00000111 end Delay clrf movlw d 168 movwf DelayH Wait1 decfsz DelayL goto Wait1 decfsz DelayH goto Wait1 return DelayL ; 2 ; 6 ; 9 ; 4 ; 0 ; 3 ; 1 ; 8 ; 5 ; 7
The following schematic shows a microcontroller circuit with LEDs connected to PORTB pins. a/ Which LEDs will be ON at the beginning of the program? b/ Which values will have the counter variable during the execution of the program? c/ Is there an LED that will not be ON at all during the execution of the program? If so, which one?
PROCESSOR 16F84 #include p16f84.inc __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC cblock DelayL DelayM DelayH counter Endc org 0x00 goto Main org 0x04 goto Main Loop1 call rlf incf incf movlw d 6 xorwf btfss goto Ciklus goto Delay clrf movlw d 2 movwf delayH Wait1 decfsz delayL goto decfsz delayH goto return Delay PORTB counter counter counter,W STATUS,Z Loop1 Ciklus delayL bsf clrf bcf bcf movlw b 00001111 movwf PORTB clrf counter STATUS, RP0 TRISB STATUS, RP0 STATUS, C Wait1 Wait1 end
5. The following program is used to generate time intervals using the free running Timer0 TMR0. In what periodic time intervals will the TMR0 overflow? Determine the flashing frequency of the LEDs connected to PORTB. The frequency of the applied oscillator is 4MHz.
PROCESSOR 16F84 #include "p16f84.inc" __CONFIG _XT_OSC & _PWRTE_ON & _WDT_OFF & _CP_OFF cblock 0x0C cnt endc bsf movlw movwf bsf clrf Loop goto Loop ISR movlw movwf bcf incf movlw subwf btfss retfie comf clrf retfie INTCON,T0IE d'72' TMR0 INTCON,GIE cnt org goto org goto Main bsf clrf movlw movwf bcf clrf 0x00 Main 0x04 ISR d'72' TMR0 INTCON,T0IF cnt d'144' cnt,W STATUS,Z STATUS,RP0 TRISB b'10000100' ;1:32 OPTION_REG STATUS,RP0 PORTB PORTB cnt end