PDA

View Full Version : Routine of an exact second



Leonardo
- 28th February 2007, 03:26
Hello forum,

Can Somebody tell me as obtaining 1 exact second using some routine in pbp?.

Thank you

skimask
- 28th February 2007, 03:55
Hello forum,

Can Somebody tell me as obtaining 1 exact second using some routine in pbp?.

Thank you

start:
pause 500
led = 1
pause 500
led = 0
goto start

Led flashes at 1hz (+ maybe 30 or 60 microseconds if using a 4mhz oscillator)

Of course like EVERYTHING ELSE that will be mentioned in this thread, and has been mentioned in other threads you have started and/or participated in, a one second clock/timer will only be as accurate as the clock that initially drives the PIC. And as also stated in other threads, using an RTC (Real Time Clock) chip is quite possibly the easiest route to go. There are many WORKING examples (and some not-so-working) in these PICBasic forums and many freely available examples on the internet...provided a person does a search for this and is able to learn and use the language that an example may be provided in.

Leonardo
- 28th February 2007, 23:26
Hello,

It Happens that I don't want to use an alone RTC I want to use code.

skimask
- 28th February 2007, 23:31
Hello,

It Happens that I don't want to use an alone RTC I want to use code.

Well, then here's some good code for you that take into account the time it takes for the loop and the led statement,....with a 4mhz oscillator

start:
pause 499
pauseus 988
led = 1
pause 499
pauseus 988
led = 0
goto start

Now, how about showing us what you've got written so far, and let us know which PIC you are going to use, what your oscillator source is going to be, etc.etc. We'll help you...but you've got to help yourself...

mister_e
- 1st March 2007, 18:24
depending of what's around... you may want to use an internal timer, or sim it with your code in MPLAB using StopWatch.