16F688 counter problem


Closed Thread
Results 1 to 9 of 9

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    CMCON0 = 7 wouldn't hurt either..;o}

    Edit: Note that PBP defaults to 4MHz. If you're using the internal 31kHz osc, expect pretty much all timing to be way off.
    Regards,

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

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    CMCON0 = 7 wouldn't hurt either..;o}
    Now how did I miss that?
    I looked, didn't see comparators, DOH!

    Nice catch Bruce.
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default

    I tried both suggestions, and it doesn't help. I am aware of the severe timing differences, but that shouldn't have anything to do with this, should it?

    Thanks for your help.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Here's another possibility.

    By setting WDTCON = %0000000

    If the config bit's say _WDT_ON then you can't turn off the Watch Dog Timer with the WDTCON.0

    However, in the process, it's reduced the WDT prescaler to 1:32

    Since the processor is running so slow. the WDT might not be getting cleared often enough.

    So, either try turning off the WDT in the configs. Or set WDTCON = %00010110 (1:65536)

    hth,
    DT

  5. #5


    Did you find this post helpful? Yes | No

    Default

    I changed it to WDTCON = %00010110, and it works! Thank you!

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


    Did you find this post helpful? Yes | No

    Default

    Nice catch Darrel.

    I would just set WDT_OFF with PBP assuming 4MHz, and running at 31kHz. Just in case. PBP will insert a NOP where it normally had a CLRWDT for timing, but there may be a library routine that doesn't hit the dog in time with the timing being so far out of whack.
    Regards,

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

  7. #7
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Weird problem - just a comment

    OPTION_REG defaults to $FF on power up. It looks like when you define the OPTION_REG value you are setting bits 4 and 5 but you are actually clearing bits 0-3 and 6-7. Bits 0-3 are harmless since they relate to the prescale of TMRO. Bit 6 sets the method of interrupt for RA2 - but the Interrupts are not enabled. That leaves Bit 7, which turns on the weak pull-ups. How strong of signal are you using to drive pin 11?

    EDIT: a bit late but not the problem - glad it works
    Last edited by paul borgmeier; - 16th February 2008 at 04:03. Reason: solution reached before my post
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

Similar Threads

  1. 16F688 problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th May 2009, 23:09
  2. Replies: 14
    Last Post: - 26th September 2007, 05:41
  3. UP/down counter & shiftout interupt problem
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 2nd July 2007, 15:56
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. Problem with 16F688 and Hserout
    By DWV in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 19th March 2005, 05:37

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