Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Timer0 Interrupt flag bit question?

Status
Not open for further replies.
Hello!

Just for your information: there are many processor makers, and they have each many
kinds of processor. The least you can do is to specify what processor you are using.

Dora.
 

Thank you zuisti

Then why my code is not working?

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//MCU = PIC18F458
//Fosc = 4 MHz
//Timer0
//Prescaler 1:4; TMR0 Preload = 15535; Actual Interrupt Time : 100.001 ms
 
//Place/Copy this part in declaration section
void InitTimer0(){
  T0CON  = 0x81;
  TMR0H  = 0x3C;
  TMR0L  = 0xAF;
  GIE_bit    = 1;
  TMR0IE_bit     = 1;
}
 
void Interrupt(){
  if (TMR0IF_bit){ 
            ;
  }
} 
 
void main(){
 
    TRISB.F4 = 0;
    PORTB.F4 = 0;
 
    InitTimer0();
 
    while(1){
 
        if(TMR0IF){
            TMR0IF = 0;
            PORTB.F4 = 1;
        }
    }
}



@Dora

I think TMR0IF comes only in PIC MCU.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top