Strange behaviour from PIC16F877 on TMR0


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Woohaa i try to figure out but there's too much 'maybe this or that' in my mind.
    Can you post your whole code and schematic?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Aug 2006
    Location
    Italy
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Schematic here and some info more

    Quote Originally Posted by mister_e
    Woohaa i try to figure out but there's too much 'maybe this or that' in my mind.
    Can you post your whole code and schematic?
    Thank you, mister_e.
    Tonight I've found that absolutely there is not the software that cause this so strange behaviour. Since the board is under control of another one that drive 2 bigger motors in PWM (24Vdc, anytime separated from the power of the logic but this 24Vdc are the same that power the tiny motors where I loose pulses), I've found the following:
    If I let one of this bigger motor to use a little bit more power (just because I'm trying to move the shaft with my hand and the PID controllers try to oppose to my strenght) THEN the strange behaviour start happening. If I turn off one of these motors, the "strangeness" do not happen.
    Seems that there is some kind of disturbance that is picked-up by the micro.
    I've putted so many caps and grounded any unused pin as you can see... what can I do more?
    Also, when I start missing pulses on TMR0 (RA4) seems that I pick-up many other "ghost" pulses on RB0...

    Thank you for your time.
    Attached Images Attached Images  

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Maybe the Mister_E to english dictionnary will be needed here

    OR your power supply is not good enough to provide more power. Assuming a spike when you need more power, the voltage may decrease enough at the input of the 7805 to make this one unable to provide the stable 5Volt at the output. If the output of the regulator drop under the Brown Out voltage of your PIC, it may badly reset the PIC and send the PC to an unwanted program location. Hence do some strange behaviours.

    How about if you use another transformer (let's say wall wart) to drive your PIC?

    I'll have a look to your schematic.. maybe i could find something in.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Aug 2006
    Location
    Italy
    Posts
    72


    Did you find this post helpful? Yes | No

    Default About the power supply

    Thank you mister_e for the answer.
    I forgot to mention that I'm using a commercial switching power supply for the logic that is able to deliver 4A at 12V. Then I slow down from 12V to 5 with the LM7805. The power supply is really bigger than my needs.
    But let me explain what I've discovered next:
    The board that is "misunderstunding" the pulses is inside a big metal case. This big metal case is connected to the earth ground throught the switching power supply, BUT not to the GND of my boards.

    Then, when I was making my tests, a personal computer inside this big case was running in the same time. Then I was experiencing the erratic behaviour as I told you.
    I found that the personal computer inside the case was running by ANOTHER power extension that DOEN'T HAVE any earth socket!
    Now, I'm running this PC with the earth ground connected and SEEMs that this erratic behaviour is disappeared.
    I Hope...

    There is a logic in this?

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Every missing earth or else ground could do something. Without seeing the whole it's a little bit hard but maybe you got one of the possible cause.

    Ground bouncing, ground looping is sometimes hard to find... Well keep us posted.
    Finger crossed!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Aug 2006
    Location
    Italy
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Filters!

    Oh boy...
    MAYBE I've discovered WHY so strange behaviours...
    I was supposing that my DC motors provider got me a couple of motor with filters capacitors inside (just like the invoice said).
    Instead I've found that NO CAPACITORS was inside the motors.
    Now I've mounted a couple of motors with capacitors inside and still seems that anything is working...
    The motors without the filter capacitors was a couple of big one that are not in the schematic I've posted, and seems that the disturbances are coming from the board that drive in PWM locked anti-phase these 2 motors.

    Anyway, Steve, some good suggestion on PCB design to avoid disturbance as much is possible?
    I'm using for the PWM section two LMD18201.
    These 2 drivers are very close to the regulator section...
    There is a ground plane on both side of the PCB connected to the logic gnd.

    Thank you.

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    probably something like that
    http://www.picbasic.co.uk/forum/show...14&postcount=3

    and keep driver far from the regulators. Well, my idea.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Strange Behaviour - Simple code+DT_INT+16F676
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th February 2010, 19:53
  2. Strange Serout Behaviour
    By bluesmoke in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th August 2009, 05:12
  3. COUNT is not counting again
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 19th June 2009, 05:52
  4. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 16:10
  5. strange int behaviour
    By tom in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th November 2005, 16:41

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