• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Tmro 1 Hour Assembler

Status
Not open for further replies.

medallo21

New Member
Hello friends,

I want to temporizer by means of tmro 6 hours as of the moment at which pic ignites, some of you can give an example or help me me with asm.

Thank you very much
 

blueroomelectronics

Well-Known Member
Nigel Goodwin said:
TMR0 is the most useless of the timers, I would suggest you use the far better TMR2 instead, which is used in the 7 segment and 8x8 LED tutorials for the multiplexing.
I like TMR0 :)
With a proper crystal it's makes an awesome RTCC timebase Jiffy, it's lack of love means it's almost always available.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
blueroomelectronics said:
I like TMR0 :)
With a proper crystal it's makes an awesome RTCC timebase Jiffy, it's lack of love means it's almost always available.
Except to use it as a RTCC of any accuracy you need to compensate for it's limitations, it's not just 'load and run' like TMR2.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
blueroomelectronics said:
What limitations? With a proper crystal like 9.8304MHz it works like a charm, serial ports too.
Check the technical bulletins, for an accurate RTCC you have to compensate for the manual reloading of the timer, there was loads about it on the PICList back in the distant past.
 

Pommie

Well-Known Member
Most Helpful Member
Nigel Goodwin said:
Check the technical bulletins, for an accurate RTCC you have to compensate for the manual reloading of the timer, there was loads about it on the PICList back in the distant past.
Not if you don't reload it. This will keep good time with a 4MHz crystal.
Code:
//timer 0 prescaller set to 16

Interrupt{
    if(TMR0IF){
        ticks-=4096;
        if(ticks<0){
            ticks+=1000000;
            Seconds++;
        }
	TMR0IF=0;
    }
}

//or, to keep to integers,

Interrupt{
    if(TMR0IF){
        ticks-=64;
        if(ticks<0){
            ticks+=15625;
            Seconds++;
        }
	TMR0IF=0;
    }
}
Mike.
 
Last edited:
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top