Time Delay Generation and 7-Segment Display Counting

Time Delay Generation and 7-Segment Display Counting
Slide Note
Embed
Share

In this project, time delay generation using a 16F84 processor is implemented along with counting on a 7-segment display. The code involves generating delays, setting up the processor, and displaying the count on the 7-segment display. Interrupt handling on RB0 is also covered. Learn how to control timing and display values effectively.

  • Time Delay
  • Generation
  • 16F84 Processor
  • 7-Segment Display
  • Interrupt

Uploaded on Mar 03, 2025 | 0 Views


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


  1. Time delay generation

  2. Time delay generation PROCESSOR 16F84 #include "p16F84.inc" __CONFIG _XT_OSC & _CP_OFF & _WDT_OFF & _PWRTE_ON cblock 0x0C delayL delayM delayH endc org 0x00 goto Main org 0x04 goto Main Loop Delay500 Label end bsf call bcf call goto PORTB, 3 Delay500 PORTB, 3 Delay500 Loop clrf clrf movlw movwf delayH delayL delayM d'3' decfsz delayL goto decfsz delayM goto decfsz delayH goto return Label Main clrf bsf movlw movwf TRISB bcf PORTB STATUS, RP0 b'00000000' Label Label STATUS, RP0

  3. Counting on 7-segment display

  4. Counting on 7-segment display PORTB = dp g f e d c b a

  5. Counting on 7-segment display

  6. Counting on 7-segment display PROCESSOR 16F84 #include p16f84.inc __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC cblock DelayL DelayM DelayH Pointer endc Loop1 clrf Pointer Loop2 movf Pointer,w call DataTable movwf PortB call Delay500 incf Pointer movlw d'10' xorwf Pointer,w btfss Status,Z goto Loop2 goto Loop1 org 0h bsf STATUS,RP0 clrf TRISA clrf TRISB bcf STATUS,RP0

  7. Counting on 7-segment display DataTable addwf PCL retlw b'00111111 ; 0 retlw b'00000110' ; 1 retlw b'01011011' ; 2 retlw b'01001111' ; 3 retlw b'01100110' ; 4 retlw b'01101101' ; 5 retlw b'01111101' ; 6 retlw b'00000111' ; 7 retlw b'01111111' ; 8 retlw b'01101111' ; 9 end Delay500 clrf DelayL clrf DelayM movlw 3h movwf DelayH Wait1 decfsz DelayL goto Wait1 decfsz DelayM goto Wait1 decfsz DelayH goto Wait1 return

  8. Interrupt on RB0

  9. Interrupt on RB0 PROCESSOR 16F84 #include "p16f84.inc" __CONFIG _XT_OSC & _PWRTE_ON & _WDT_OFF & _CP_OFF org 0x00 goto Main org 0x04 goto ISR Main bsf STATUS, RP0 movlw b'00000001' movwf TRISB bcf OPTION_REG, INTEDG bsf OPTION_REG, NOT_RBPU bcf STATUS, RP0 clrf PORTB bsf PORTB, 7 bsf INTCON, INTE bsf INTCON, GIE Loop goto Loop ISR bcf btfss goto bcf retfie Lab1 bsf retfie INTCON, T0IF PORTB,7 Lab1 PORTB,7 PORTB,7 end

  10. Interrupt on TMR0 overflow (255-96)*32us = 5.088ms 5.088ms*196 1s

  11. Interrupt on TMR0 overflow ISR movlw d'96' movwf TMR0 bcf incf movlw d'196' subwf btfss retfie comf clrf retfie bsf movlw d'96' movwf TMR0 bsf clrf INTCON,T0IE PROCESSOR 16F84 #include "p16f84.inc" __CONFIG _XT_OSC & _PWRTE_ON & _WDT_OFF & _CP_OFF cblock 0x0C cnt endc org 0x00 goto Main org 0x04 goto ISR Main bsf STATUS,RP0 clrf TRISB movlw b'10000100' movwf OPTION_REG bcf STATUS,RP0 movlw b 00001111 movwf PORTB INTCON,T0IF cnt INTCON,GIE cnt cnt,W STATUS,Z Loop goto Loop PORTB cnt end

More Related Content