DS18B20 interfers with Timer 2 interrupts


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Red face

    Hi,

    I do agree with Bruce ... and do not see how to avoid Timer 1 use.

    a 1 sec interrupt interval would be the best for 12 bits ... Interrupt can ask for conversion launching ... and you do what you want in between ...

    500 ms interval ( easy w/Timer 1 ...) is perfect for 11 bits ...

    In fact, the clock tick would be perfect to initiate each full cycle ...

    As I smell, this could be a Datalogger ( so, why use a clock ??? ) ... 30 or 40 ms mini NOT INTERRUPTED for EEPROM writing is to consider too ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    If you need even more time, load CCPR1H:CCPR1L with 62,500, and set Timer1 prescale to 1:8 for 500mS interrupts. You have around 500,000 single-cycle instructions before each interrupt.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Feb 2009
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    Great minds.... I was just in the process of longer times between interrupts given all the math and I/O and conversion. I will look into Timer1 and the other tricks. But I still find it a mystery why the clock runs FASTER with the DS. If I'm missing interrupts without it, adding the DS should make it worse.

    Thanks for all the pointers and I will update when i actually figure it out (if not sooner).

    John

  4. #4
    Join Date
    Feb 2009
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    ok what i did was to use Timer 1 (16 bit) with a prescale of 1:8 at 4 MHz. This gives me 1usec*65K*8 or about 0.5sec interrupt period.

    Now with or without DS readout I get the same clock speed, and get the calculated interrupt period. So looks like this will work. Trick is to also be sure all lengthy PAUSE statements are broken into DO loops of 1msec PAUSEs and no other "WAIT" options. The readout of the DS doesn't seem to be a problem since I issue a convert command, then test for BUSY bit in a loop, so it can be interrupted.

    If I had a 32 KHz xrystal I would run an external clock, but don't right now. Can get een longer interrupts that way (including a realtime clock).

    The biggest reason in going to Timer 1 from 2 was the 16 bit count registers for 1 vs 8 bit for 2 (even though you can adjust the clock)...win some and loose some.

    So this fixes my problems. Thanks for the good suggestions.

Similar Threads

  1. PICkit 2 and RBC interrupts
    By jderson in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 4th April 2009, 02:33
  2. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  3. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10
  4. Totally Baffled with Elapsed Timer
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th June 2008, 21:01
  5. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts