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.

how to read time and set timer in PIC 16F7X microcontroller

Status
Not open for further replies.

sweetmirror

Newbie level 1
Newbie level 1
Joined
Jan 8, 2004
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
7
I want to implement this pseudo code:

function GetClockTics
begin
{retreive the current system clock tic value}
end;

I don't know how to do it, anybody can help me out?
Thanks
 

Re: how to read time and set timer in PIC 16F7X microcontrol

Hi.

You need get the atual clock cicle, right?

For do it you must configure a timer (This timer must be incremented at each clock tick) to generate an overflow when the value of the timer register is 256, and increment a global variable in the interrupt procedure.

To get the actual value of ticks you need to read that global variable shift left 8 bits and add the timer register value.

If I helped you please click on the Helped button.
 

Re: how to read time and set timer in PIC 16F7X microcontrol

Hi,

Before i answer, i want to say that im very happy that people are using my line with the help me button...

To your question, i would sugest you read how to use the TMR ( timers ) function. it will do exacly what you want, and it will work in the background so it want load your main program. to start the time, you just enable to clock, and it will start counting. to see what value it is, you can either stop it and read, or you can just read the TMR register. to start over, you just clear the register and start over.
You can do lots of things with the timers in the PIC so it all depands what you want to masure and how long it is, micro, mili or seconds. Each type needs a diffrent way of thinking...
Here is the link to microchip web site App Note for the timers. Have a look there, im usre you will gain much from reading one of the files...
**broken link removed**

And here is the original line:
If you found my answer useful, click on the button that says Helped me. ( NO points will be taken from you! )


Good luck.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top