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.

timers in mplab question

Status
Not open for further replies.

cipi-cips

Member level 4
Joined
Jun 30, 2008
Messages
76
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Activity points
1,867
hello

Is it possible to compare value with timer in c18 compiler, if yes can you show me how
for example

I have variable that change from 1000-2000 and i have timer where interrupt occurs every 20ms

while (my_variable <= timer)
{
do something
}


thx
 


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
void interrupt(){
 
    if(INTCON.TMR0IF){
 
        INTCON.TMR0IF = 0;
        TMR0H = x;
        TMR0L = y;
        timer++;
        
    }
 
}
 
 
void main(){
 
 
 
    //Initialize and start Timer0 here
 
    while(1){
    
        
        if(my_variable <= timer){
 
        }
    }
}

 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top