Electronic Circuits and Projects Forum



Checking 3 pin wire connections automatically?

« First 123
  1. Thread Starter #21
    bigal_scorpio bigal_scorpio is offline
    Hi Panic Mode,

    I haven't had chance to try your code yet but how does it discriminate between a short and a swapped wire?

    I am not well versed in masks but I get the general idea of how you are checking but as I said, I don't get how I can get a result that tells me which problem if any is present?

    Thanks Al
    0
    I am an insomniac, but I don't lose sleep over it!

  2. #22
    panic mode panic mode is offline
    hello bigal,

    you are right, this only handles the simplest case in which it expects 1:1 cable, anything other connection(or lack off) is considered wrong.
    therefore no decoding is done on PIC, decision is left to user from displayed LED pattern (pic stops scan when any mismatch is found).
    as with any oversimplified system, there is a hidden pitfall,
    if all wires are short, all LEDs would be on and there would be no distinction with "OK" case where the MCU just scans perfect cable.

    to do a full tester, it would take more effort, including constant manipulation of TRIS registers, case by case comparison and separate indication.
    and that comes back to what you started...
    0
    Last edited by panic mode; 22nd April 2012 at 06:11 PM.

  3. #23
    Mr RB Mr RB is offline
    Bigal, I would suggest refining the algorithm first, ie specify the exact test sequence and draw it out as a flowchart (or just a text flowchart sequence).

    Once the algorithm is designed (possibly with some input from others) it should be easier to just write some code to execute it.

    When programming I often write the entire sequence out in comments, then debug it in comments until the procedure is exactly what I want, then just write some code in to match the comments last and it all works.

    Trying to design the algorithm and what it will do at the same time you write the code is a very difficult way of working.
    0
    Last edited by Mr RB; 22nd April 2012 at 10:49 PM.
    Roman Black - PICs and electronics. Author of BTc PIC-sound encoder, Shift1-LCD project, the TalkBotBrain talking PIC controller, LiniStepper open-source microstepping motor driver, the Black Regulator 2-transistor SMPS, and probably some other stuff; www.RomanBlack.com

  4. Thread Starter #24
    bigal_scorpio bigal_scorpio is offline
    Hi Roman,

    Yes mate, I am finding that out and agree completely!

    At the moment I have the program working in a fashion, but trying to catch the shorts, swaps and breaks is more puzzling that I would have believed!

    This started out as a simple project just to make checking lots of cables easier, but wow is this a complicated logic problem.

    I'm thinking of breaking the problem into smaller parts to try and make sense of it.

    Al
    0
    I am an insomniac, but I don't lose sleep over it!

  5. #25
    kubeek kubeek is offline
    I think the logic is quite simple:
    set voltage on wire x
    Read all inputs
    if you read input only on wire x, the wire is ok
    if you read input anywhere else the wire is shorted or connected to wrong pin
    if you read nothing the wire is open

    repeat for all wires
    0
    Last edited by kubeek; 23rd April 2012 at 10:45 AM.

  6. #26
    panic mode panic mode is offline
    for simple cables (few wires and only 1:1 connection) the logic is simple.
    but some cables (by design) can have multiple connections to any of the pins.
    this is moer general case and logic is a bit more complex.
    0

  7. #27
    Mr RB Mr RB is offline
    Quote Originally Posted by kubeek View Post
    I think the logic is quite simple:
    set voltage on wire x
    Read all inputs
    if you read input only on wire x, the wire is ok
    if you read input anywhere else the wire is shorted or connected to wrong pin
    if you read nothing the wire is open

    repeat for all wires
    Yep that looks pretty good, I would extrapolate a bit;
    // PIC pins to the two 3pin cables (all pins have a 10k pullup resistor);
    // A D
    // B E
    // C F

    // test A
    // all pins as inputs, but pin A as LOW output
    // if D is high; record error A-D is open
    // if any of BECF are low; record error A-x is shorted

    // test B (repeat etc)

    // final;
    // if no errors; signal cable ie good
    // if errors; signal which error as needed

    As a display you could have one green LED for "all good" and 3 red LEDs for open cables, and 3 red LEDs for shorted cables.
    0
    Roman Black - PICs and electronics. Author of BTc PIC-sound encoder, Shift1-LCD project, the TalkBotBrain talking PIC controller, LiniStepper open-source microstepping motor driver, the Black Regulator 2-transistor SMPS, and probably some other stuff; www.RomanBlack.com

« First 123
Tags
Similar Threads
Thread Starter Forum Replies Last Post
Need help with pin connections... Mastahh General Electronics Chat 1 24th November 2010, 06:41 PM
Thermocouple wire connections frimer General Electronics Chat 5 12th October 2010, 11:34 PM
wire a computer speaker jack to an LED? PammyBoy Electronic Projects Design/Ideas/Reviews 21 7th February 2003, 03:30 PM
Coil wire? hantto General Electronics Chat 11 13th December 2002, 04:40 PM
How to change 8 PIN mini DIN video input to RF input helpmeplz Electronic Projects Design/Ideas/Reviews 0 5th December 2002, 02:32 AM
Electronic Circuits  |  Learning Electronics

Join our community with over 100,000 Members! It's free, easy and when you're logged in you have many more features! Click to register.
Page Time: 0.07445 seconds      Memory: 7,530 KB      Queries: 16      Templates: 0