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.

Get precise times with interrupt in PIC

Status
Not open for further replies.

neuralc

Full Member level 4
Joined
Nov 6, 2001
Messages
236
Helped
9
Reputation
18
Reaction score
3
Trophy points
1,298
Activity points
2,202
Hi all,

I need to build a clock using 16F870, and I'm using HTPICC. The only interrupt that I use is Timer1, and in the interrupt function in C I set the content of TMR1L and TMR1H.

The problems is, if I put a breakpoint at the end of the interrupt function, and I simulate it in MPLAB I get different values of time from interrupt to interrupt... and I think that is because at 0x0004 HTPICC put some interrupt recovery info, and that code depends on the place where interrupt occurs, so in each interrupt it can execute different number of instructions and give different times in the interrupt function.

I think the solution is to put the set of TMR1L and TMR1H on position 0x0004 of the program, but how can I do this?

ThX

NeuralC
 

Very simple solution.

Use RTC (real time clock) and you dont have any problems.

Mr.Cube
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top