EEprom and MCP9801 I2C communication problems


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: EEprom and MCP9801 I2C communication problems

    There is nothing wroing with the PAUSEUS command, but if you using a variable after the PAUSEUS, it should be a WORD variable.

    Without looking at your code, there is no way of knowing what effect the longer delays may have.

    Anything that requires close timing should be done with a timer. Even if you aren't using interrupts, you can use a timer by setting up the prescaler and clock source, and turning the timer ON. When you want to start your timing interval, you clear the timer, and later on in the program you can sit in a loop until the timer is > a certain value. The upside is that you can do other tasks after you start the timer, and as long as the tasks don't take longer than your desired time interval, timing will be maintained. And this technique works especially well if you DO use interrupts, because the interrupts can "steal" time from the main loop, and make the PAUSEs take longer than their set value. Using a timer keeps timing perfect.

    The downside is that at 40MHz, TMR1 times out in ~52mSec even with a /8 prescaler.
    Charles Linquist

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: EEprom and MCP9801 I2C communication problems

    I guess I should have also added that TMR0 can have a lot longer time period because it has a /256 prescaler. I just always use TMR0 for my main interrupt timer and TMR1 for the time delays in the loop. You could reverse the operation and use TMR1 for ints and TMR0 for the loop timer. That will get you over 1 second.
    Charles Linquist

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