16f88 problems


Closed Thread
Results 1 to 18 of 18

Thread: 16f88 problems

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Posts
    7

    Default 16f88 problems

    Greetings,

    I've written a program for the 16f88 which is behaving strangely in the circuit.

    I have an initial loop which waits for a button press, the button press leaves the loop, then evaluates two other pins for high or low status (a two position switch is forcing one of the pins high, and the other low).

    Depending on the status the program proceeds to a ten second timed section, or a ten minute timed section.


    The behaviour is this: When power is initially applied, the pic jumps past the first wait. Even when I add a two second pause before entering the loop to evaluate the first button press.

    It evaluates the two pins, and proceeds to the timed section. It is evaluating the two pins properly, and the timed sections run flawlessly.

    When the timed section are complete, it goes back to the loop waiting for the start button.

    Then the device operates properly.
    Why would it skip the wait for button press loop on the first execution?

    I have tied MCLR to vdd with a 10k resistor. I have a 10uF electrolytic smoothing out the supply which is from an lm7805 supplied by a high capacity 12v source. I have a 100nf cap between vdd and ground right at the pins.

    The behaviour hasn't changed at all with these extra components in place.

    I have some questions; If you state ansel = 0 does that mean the analog pins are now digital? I would like this to be the case.

    I've heard that defining MCLR as an input is a mistake because you can't reprogram the pic properly thereafter. This could be the case. On the same token, I've heard that MCLR can't act as an output. So I don't know what I should do with this.

    I'm using the internal oscillator.

    Any Ideas? I am totally stumped, and it's for a product I'd like to demo for a group ASAP.

    Mike

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Can we see your code?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Nov 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Default lingering questions

    Unfortunately I don't have it with me. When I get home I will put it up.

    I'm curious if there are any events during startup which could influence my code to jump past the first loop that is waiting for the buttonpress.

    Also my question about ansel = 0 and whether that makes the analog pins digital still stands.

    Also the fixes I tried with power supply, and the questions about the MCLR pin are still bothering me.

    As I say, I don't actually think it's the code that is the problem. I feel it's more of an odd hardware issue with the 16f88. I realize this is a pbp forum, but other people have had trouble with the 16f88 that are similar to mine, and I thought some people here may have already faced this one down.

    My code size is small enough for the chip as well. Something like 500 words.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I do not have the data sheet in front of me but I do not think ansel=0 is the way to go.
    Check the data sheet and read this.
    http://www.picbasic.co.uk/forum/showthread.php?t=561

    MCLR is not a problem when made an input. The only concern is tothe external parts if any being able to handle the higher voltage. A well placed diode will normally solve any problems.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mikey11 View Post
    I'm curious if there are any events during startup which could influence my code to jump past the first loop that is waiting for the buttonpress.
    Hi Mikey11,
    The buttonpress . . . does it go high or low when pressed? What is its power off status? Any chance your PIC is seeing a buttonpress condition there ? Can you accept a delay at startup before initialising your TRIS registers ?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    You still need to post the code. It truly sounds like you have something not properly initialized. If nothing else the code will show which pins are in use and what functions those pins share.

    Make sure you have CMCON = 7, as well as ANSEL = 0.

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    As I say, I don't actually think it's the code that is the problem. I feel it's more of an odd hardware issue with the 16f88.
    So why should the OP post the code? We were told that is not the problem.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Code works on 16F84A but not on 16F88?
    By pharaohamps in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th November 2009, 18:29
  2. Can't get a 16F88 to do anything.
    By ccowley in forum General
    Replies: 14
    Last Post: - 25th August 2008, 23:42
  3. 16F88 RA6 and RA7 troubles
    By gandora in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 3rd August 2007, 02:57
  4. 16f88 help
    By ccsparky in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 3rd July 2004, 17:50
  5. 4 line LCD with 16F88
    By anj in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th February 2004, 09:06

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