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.

timersss..

Status
Not open for further replies.
Wait for a pulse to arrive, and once it does start running a loop of fixed length. Count how many times you ran trough the loop until a second pulse arrives.

Now multiply the loop's length * the amount of times you've gone trough it and you know the length...

This, of course, only works if the pic doesn't need to do anything else at the same time...
 
yeah pall..

i'm not stupid..

but i wanted to use a timer..

something that you can start and then stop...

???

or a countdown timer..even better..

TKS
 
If you wanna use timer, you have to get in in interrupts changes. You may use interrupt in portB, pin RB0 or use Capture. Each time, you get the interrupts, you send out the value of timer and reset the timer.

Of course, you have to take in account that how many instructions you lost to take the timer value, and substract it in your code to get realtime result.

goodluck
 
interupts..

if i program my program for 2Mhz to the interupts..

is it then true..

that i lose 2Mhz of power for the rest of the program..??

or how do i have to look @ that..


TKS
 
if i program my program for 2Mhz to the interupts..

is it then true..

that i lose 2Mhz of power for the rest of the program..??

or how do i have to look @ that..

I dont understand your question?

program for 2MHz to interrupts?? What does it mean? Is that you need to timing about 2MHz pulses.

With 2MHz pulses, you cannot use anything to measure the duty cycle, because 5MHz is the max pulse generate from normal 20MHz crystal. You only can wait by counting and checking the port. Because it needs some instruction to go to ISR and get out from it, you will lose your pulses.

However, you may try with capture and external timer1 clock??? Did you try it?
 
Re: interupts..

TKS said:
if i program my program for 2Mhz to the interupts..

is it then true..

that i lose 2Mhz of power for the rest of the program..??

or how do i have to look @ that..


TKS

You can't possibly generate interrupts at 2Mhz. If your signal is comming in that fast then forget using a pic, it's way to fast you wouldn't be able to do anything with the results.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top