Strange behaviour from PIC16F877 on TMR0


Closed Thread
Results 1 to 19 of 19

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default wow

    Quote Originally Posted by mikebar
    I've connected the open collector output of the single channel encoder of the motor to a 2.2Kohm pull-up resistor and then to a NOT gate made with a BC547 transistor and a couple of resistors. From this NOT gate, directly to a spare quad-or gate 7432. The output of the OR gate is applied to the RA4 (Timer0) input of the PIC 16F877, running at 4MHz with two 22pf capacitors on the crystal.
    The RA4 pin is set to be incremented from an external source.

    Mike.
    HI MIKEBAR, Your schematic attachment did not come through, but I think I understand from your description how your circuit works. First off the old style TTL 7400 series chips while plentiful still really BLOW, they are lazy and usually do not switch cleanly, are severly noisey and cantankerous, and that's their good points. I would use a more modern IC, probably an inverter with schmitt triggers. make sure to use a pullup / pulldown on your RA4 depending on which level you have it setup to trigger on. I do not know where you live or how difficult parts are to get there, here goes some part numbers:
    old style TTL:7413 dual 4 input NAND with schmitt trigger,74132 quad 2 input schmitt trigger NAND gates 7414 hex schmitt trigger inverter, Advanced low power shotkey:74ALS14 hex schmitt trigger inverter, etc etc the newer logic has 2 or 3 letters between the 74 and the next 2 or 3 numbers the letters define what improved device type they are I. E. LS = Low Power Shotkey,
    ALS = Advanced LS, AS=Advanced Shotkey, hc/hct High speed cmos etc.

    Bottom line . . make sure your sensor is switching cleanly your RA4 input and that you have a measurable voltage swing in that pin, and if you do and it still doesn't count, I believe your problem lies elsewhere, chip failure, software glitch . . .
    Regards
    JS

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


    Did you find this post helpful? Yes | No

    Default Ttl

    Hi JS.
    Thank you for your suggestions. I will try to use these parts. Did you think that the HC version of the gates are good enough?
    I mean 74HC02, 74HC04 etc.

    All the best.
    Mike.

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


    Did you find this post helpful? Yes | No

    Default yep

    Yes I do, but I think the key is to use something with a schmitt trigger, too often logic without them tends to languish in a state 1/2 way between high and low, and then they will operate intermittantly as power suppliy voltage, temp. and humidity, or will of the gods dictate.

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


    Did you find this post helpful? Yes | No

    Default addendum:

    Before you go out and buy anything, try a low power LED on you input and visually see what happens when you turn the motor by hand.
    JS

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