Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB

Ads

Discussion Groups

Discussion Groups | BasicX | Re: High resolution timers?

Discussion forum for the BasicX family of microcontroller chips.

Re: High resolution timers? - n0ure - Apr 6 16:52:38 2006

Tony, did you ever write some code for the 2404?

John
--- In b...@yahoogroups.com, "arhodes19044" wrote:
> That is a really nice device. It has some really good day/date
and
> interval functions.
>
> Its granularity is 1/256 second, not better than the BX-24
itself.
> I can not tell about the temperature compensation. I would assume
> that it is at least as good as the BX-24's. It uses an external
> oscillator. and the connections are noise sensitive. It may be
> sufficiently sensitive that it is not applicable to my uses.
>
> You are right, the 1hz signal is perfect for me too!!!!
>
> I may try one of these out. They are not "cheap", though.
>
> Great device, and thanks for the heads up on this one!
>
> -Tony
>
> --- In b...@yahoogroups.com, "Don Kinzer" wrote:
> >
> > --- In b...@yahoogroups.com, "arhodes19044"
wrote:
> > > Is there an external timer commercially available and
relatively
> > > inexpensive that is easy to interface to a BX-24?
> > >
> > > I am hoping to find something accurate to a few seconds a year
> and
> > > with better granularity than 1/512 of a second. Temperature
> > > compensation would be a great thing as well. Lithium watch
> battery
> > > backup would be great too!
> > >
> > > Any ideas of what to use?
> >
> > The DS2404 may fit the bill. As a bonus, it has a 1Hz square
wave
> > output signal. You can interface it to the BX-24 using either
the
> > 1-wire or 3-wire interface. I have experimented with it a little
> > using the 1-wire interface. It's fairly easy to use.
> >
> > Don
>



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


Re: High resolution timers? - arhodes19044 - Apr 7 15:55:12 2006

No, I did not.

I ended up using the DS3231. This is a combo of a precsion oscillator
good to 2ppm over an industrial temp range. It is a RTC with date and
time down to the second.

It also has various squarewave output frequencies. Only powers of 2,
though.

I had been hoping for 1/1000 second to be one of the options, but the
closest I could come is 1/1024. I used that output (actually 8192Hz)
and fed that into the AVR counter/timer input. I then set it to
create an interrupt every 8th tick. I was able to get this to work
well for me.

Unfortunately for this bulletin board, it was used on raw AVR
hardware. If I were to use a BX, I would set the square wave to the
slowest setting, and have it trigger the external interrupt on the
rising or falling edge (probably the falling edge, with the internal
pullup enabled). If I needed more resolution than 1/1024th sec, then
I would have to use a higher freq (upto 32768Hz) and use a counter
within the interrupt to set a flag when it was time.

In the end I got it to work very very nicely. Very clean and
precise. BTW, the 3231 uses an I2C interface to read the RTC and set
the settings. The squarewave is a separate output of the 3231 chip.
You can see some of the code I generated for the 3231 using the Zx-24
platform which is a very similar device to the BX. Check on the
www.zbasic.net website in the user files. I also have some code for
other dallas RTC devices too.

-Tony
--- In b...@yahoogroups.com, "n0ure" wrote:
>
> Tony, did you ever write some code for the 2404?
>
> John
>



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )