Continue to Site

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.

  • 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.

Correcting timer0 reading

Status
Not open for further replies.

chris414

New Member
According to the PIC18F2550 datasheet:

If the TMR0 register is written to, the increment is inhibited for the following two instruction cycles. The user can work around this by writing an adjusted value to the TMR) register.

Does that mean that when I want to reset the timer I should use:

Code:
WriteTimer0(2);
 
Last edited:
According to the PIC18F2550 datasheet:



Does that mean that when I want to reset the timer I should use:

Code:
WriteTimer0(2);
Yes, but even more accurately:
WriteTimer0( theValueYouWant + 2);

(just add two to the value you want to write to the timer.)
 
thanks very much. ı'm using pic16f877.ı want to do that. ım explaning.a signal range from 0 volt to 5 volt is coming RE5 pin.and the timer start to count and then another current signal is applied RE6 when it is applied ı want to stop count.and calculate the mikroseconds which timer counts,and then ı will find the cos fi.ı cant write this code please help me.
 
real aim of me is the timer0 start to count when voltage(0 volt-5 volt) come Re5 and then when the current signal come Re6 pin timer0 is stopped.the time between this duration will be calculated and then is converted angle.that give me the angle between voltage signal and current signal.(cos fi).thanks for helping from now.
 
Status
Not open for further replies.

Latest threads

Back
Top