list p=16f877
include <dev_fam.inc> ;this file is checked and corrected
include <math16.inc> ;
include <p16f877.inc>
;**********************************************************
;DEFINITIONS:CONSTANTS
FALSE equ 0
TRUE equ 1
PP0 equ b'00000000' ;PIC program page
PP1 equ b'00001000'
PP2 equ b'00010000'
PP3 equ b'00011000'
;------------------------------------------------------------
; RAM variables
ORG 0X20
;-------------------------------------------------------------
PROGRAMPAGE set PP0
org 0x00 ;RESET VECTOR
goto start ;RUN main routine
org 0x04 ;Interrupt VECTOR
;you can enter your interrupt check routines here
goto ISR
;------------------------------------------------------------------
org 0xA0
start
;code for Initialization of Timer0 and other bits
BANKSEL INTCON ;BANK2
MOVLW 0xA0
MOVWF INTCON ;Global interrupt and TMR0 interrupt enabled
;set timer 0
banksel TMR0
movlw b'00000000'
movwf TMR0
;get one timer 0 inturrupt after 256 triggers
banksel OPTION_REG
movlw b'10000110'
movwf OPTION_REG
;set port B as output
banksel TRISB
movlw b'11110000'
movwf TRISB
banksel PORTB
movlw b'00000000'
movwf PORTB
loop
;loops forever until inturrupts come
goto loop
ISR
;handling the interrupt
comf PORTB,1 ; Toggle Port B
BANKSEL INTCON ;BANK0
BCF INTCON,2 ;CLEAR INTERRUPT FLAG
Retfie ;return and set global in turrupt enable
end
--------------------------------------------------------------------------
I hope to share my knowledge with the others in software and networking industry
Timer0 interrupt generation Assembly code for microchip pic16f877
Subscribe to:
Post Comments (Atom)
Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release
Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...
-
When we increase timeout value in API Manager we have to set 3 properties. 1) Global timeout defined in synapse.properties (\repository\...
-
No matching resource found error or authentication failure can happen due to few reasons. Here we will discuss about errors can happen d...
-
Address and WSDL endpoints can be suspended if they are detected as failed endpoints. When an endpoint is in in suspended state for a speci...
hi,
ReplyDeletei've got an assignment.
if timer 1 is executing its ISR, a timer0 interrupt occurs and it should handle timer0 interrupt and return to the previous state after completing timer0 interrupt.
can u pls help me doing this assignment.
my id:luk4ami@gmail.com
What you have to do is set some flag after timer1 ISR executes then when timer0 ISR executes check that flag and do whatever you want and clear that flag bit.
ReplyDelete