Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Cable Tester — Parallax Forums

Propeller Cable Tester

SarielSariel Posts: 182
edited 2012-01-17 23:08 in Propeller 1
Alright guys. I have this project most of the way done, I just hit a roadblock today, and I am having a problem seeing the other side. I have a prop-based programmable cable tester that will not correctly detect a shorted wire. I have a 74HC595 and a 74HC165 on each end of a wire, and by passing serial data to the 595, and reading the data that is on the 165, then comparing it to a static Binary value, I can Detect opens all day long. When miswires (appearing as opens and shorts) or just shorts are present in the cable, I am finding that the amount of voltage output by the 595 is not quite enough to drive 2 pins high at the 165. The way it is wired is so that the 595 is directly connected to the cable under test and is driven by the 3.3 volts for the prop. Each input of the 165 is driven low by a resistor. I originally started with a 10K, then tried a 100k, then all the way up to 10 Meg ohm, but I am still getting 0.65 volts (approx) instead of the 3.3 volts I see normally. I also tried without a pull-down resistor, but not even that would drive the pins high enough to signal the miswire.

Am I doomed to adding a transistor, or maybe even a buffer IC in between the Cable under test and the 74HC165? Maybe even bump the 74HC595 up to the 5 Volt rail? I guess I am not even sure if that will fry my Prop by too much voltage returned back from the 165. What is going to happen when I have a cable that I want to have jumpers installed into so more than one line is going to be active by design. I can see the tester having a serious problem with that. I am afraid that it is going to be a show stopper unless I find something very simple and inexpensive to fix this project.
«1

Comments

  • groggorygroggory Posts: 205
    edited 2011-03-21 13:42
    What kind of cable testing are you trying to do?

    Please post a schematic?

    What conditions are you trying to design for?
  • SarielSariel Posts: 182
    edited 2011-03-22 04:32
    Auto Tester.zip
    Ok... Here is my full source. I included all of the object files that I use as well. The 74HC595 and the 74HC165 object files are lightly modified versions of ones I found in forums or the obex. TV and TV_Text are unmodified. The source is very heavily commented, with the schematics inside.

    It is just a simple continuity tester, looking for opens and shorts. It crudely will show you a mis-wire by displaying an "Open and Short" failure to the same pins. Pretty self-evident when you analyze the failure data. Maybe in the future I would like to incorporate resistance, Kelvin testing, maybe add a high voltage supply and a big ole gang of relays for HiPot testing, but boy is that waaaaaay down the road.

    Thank you for taking a peek for me. Like I said tho, it is not really a firmware problem so much as it is my data lines do not have enough juice to drive the 165 when there is a jumper or a short in the assembly. I am leaning towards bumping the 595 voltage up to 5 instead of running 3.3... but I am afraid to put too much juice to a prop IO pin and fry the thing.

    Oh.. I wanted to add that this version does not know the difference between an open or short, but it can find them if I get past this error.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-03-22 20:13
    Sariel,

    I use 5 volt 74HC595 frequently with the Prop. As long as you have 3k resistors in series with the receiving Prop pin, you should be okay.

    I usually use 10k resistors with 5V data. I'm not sure if the added resistance of your cable will cause trouble. I'd be inclined to think it would work.

    Duane
  • SarielSariel Posts: 182
    edited 2011-03-23 07:49
    Duane Degn wrote: »
    Sariel,

    I use 5 volt 74HC595 frequently with the Prop. As long as you have 3k resistors in series with the receiving Prop pin, you should be okay.

    I usually use 10k resistors with 5V data. I'm not sure if the added resistance of your cable will cause trouble. I'd be inclined to think it would work.

    Duane


    I tried it out on a small sample circuit so I did not fry anything on my gang of breadboards, and voltages look promising so far. I added a 2K7 to SerOut from the 165 after bumping all of the shift in/out registers up to 5 volts. Now, on to adjusting the full proto. I am thinking I am going to have to do a study on cable length and Resistance to find out if there is going to be a length limitation for larger assemblies. Future re-designs will employ an optocoupler, or maybe buffers. I just don't want to make too many adjustments to the hardware (or the price) at this stage until I get a better idea on performance and stability after it has been used for a while.

    Thanks for the idea.
  • SarielSariel Posts: 182
    edited 2011-03-23 11:15
    I changed it over and it won't work with my proto. Still it works fine with opens and mis-wires, but I just cannot get jumpers or shorts to work... can't seem to get the voltage high enough to do any good if 1 pin from the 595 is trying to drive 2 pins of the 165. They come up open every time. I did a voltage check on it in super-slow debug mode and found that when one pin drives one, I get 4.8 volts or so, and if I have one pin driving two, it gives me just a hair over 1.1 volts, well below the spec for the 165's high voltage levels, even if I was to drop the 165 back down to 3.3 volts. I guess it is time to either find a diff par to ser chip that has a lower voltage threshold for high pins, or find a different ser to par chip that possibly has a bit more current on it's outputs. I'm going to go hit the datasheets and suck up another major design change.... If only this project would be over with.
  • groggorygroggory Posts: 205
    edited 2011-03-23 11:40
    Here's what I think you should do.

    Your 'cable testing' circuit is about the pinnacle of a basic circuit. Resistors in parallel. Which means you should do some EE work and calculate all of the currents and voltage drops and whatnot. Then once you know what everything will look like you can then pick your chips and your supporting infrastructure.

    It sounds to me like you have an idea and then you're just throwing chips at the problem. Do some pencil and paper work before you start your design (even though you've already failed a few times). Then report back with all of your calculations and full design specifications. Then do the circuit design. Circuit design is not supposed to be step 1!
  • kwinnkwinn Posts: 8,697
    edited 2011-03-23 12:00
    Sariel, I have built a cable tester for use with a proto board that could test cables with as many as 16 wires using 2 74HC595's and 2 74HC597's. One of the cables being tested had a single pin on the on the 9 pin connector going to 5 pins on the 15 pin end and had no problem driving the 5 '597 inputs. I also tested a 1000 foot box of cat5 cable, so cable resistance was not an issue. Please post your schematic so we can see if there is a problem with the hardware.
  • SarielSariel Posts: 182
    edited 2011-03-24 10:35
    groggory -
    Yeah after the fact I was thinking about something like that, that's why I tried bumping thee resistance up to 100k. My algebra skills are not super-spectacular, but you would think that 100k resistors would have a good trickle so the pin stays low, and when you toggle a maximum of 8 pins high at the same time and effectively making 8 100k resistors in parallel. (1/Rt) = (1/R1) + (1/R2) + ... my total is just a hair over 12 k, and should not be sinking all of my current away from the 165 causing the problem I am seeing. Just in case there was something in the IC I was not expecting, I changed the value to 10 meg after that, then tested the pin with a logic probe to see that the Register side of the resistor was in fact still pulling the pin low, and it did not work.
    I am sure during the course of a design, something came up that you did not foresee, and you had to make changes to your original penned idea. This is one of those circumstances. I thank you for your input, but certainly I don't need a Holier-Than-Thou attitude.

    Kwinn -
    My schematics are in the top level file of the .zip I included in my 2nd post. It is overly commented mostly because this is my first major propeller project, and I want to easily be able to see what is going on. I happen to have a couple 597's sitting around here, and I am trying to get the file in the obex to do my bidding with a sample circuit. Do you have a snippet of code around for driving those chips that I can take a peek at? I plan on pretty much the same thing you made, only 2x as big, and a few other bells and whistles.


    Schematics.txt
  • kwinnkwinn Posts: 8,697
    edited 2011-03-24 15:13
    Sorry Sariel, I finished and delivered this project to the customer just before my laptop died and it was not backed up. It was a very simple project as far as electronics and software went. The enclosure took the most time. There were two '595's connected in series controlled by 4 prop pins to shift a single 1 bit down the '595 outputs and two '597's in series controlled by another 4 prop pins. The software performed the following functions:

    Cleared the '595 and '597s
    Shifted a 1 into the first position of the '595 and then shifted in 16 bits from the '597 and compared the data to the first entry in a table
    Toggled the '595 clock to shift the 1 to the next position, shifted 16 bits in from the '597, compared data to second entry in table
    Repeated previous line until the 1 bit had shifted through all 16 bits of the two '595's and compared to all 16 table entries

    It was a very simple go/no go tester.
  • kwinnkwinn Posts: 8,697
    edited 2011-03-24 16:04
    I reread the entire thread and took a look at your schematics again, and except for having 32 outputs and inputs , and using a '165 instead of a '597 your circuit is the same as mine. I used 47K resistor networks to pull down the '597 inputs and 470 ohm resistors on the outputs of the '595's.
    You use 10K (or have you gone to 100K?) pull down resistors which would draw 0.5mA each at +5V. Since the '595 can output 35 mA per pin and you have no resistors on the outputs a single output pin should have no problem pulling all 32 of the '165 input pins high.

    Are your chips in sockets or are they soldered in place?
  • SarielSariel Posts: 182
    edited 2011-03-25 04:27
    yeah that is basically what my program is doing, only I am using just 3 pins from the 165 and 3 from the 595, holding the reset lines to their respective logic levels. And, I am shifting the entire long out to the 595 in each step. If I was having a speed issue, that would be a great way to save a few moments, but, as it is, this thing runs pretty fast.

    The whole beast is breadboarded at this stage, simply because I wanted a quick and easy way to test out the failure detection by moving jumper wires. I have been drawing up a surface mount board that I plan on using as the final assembly, but that stalled out when this issue reared it's ugly head. I see your thoughts are the same as mine tho. There is no reason why this should not work. You thinking that something went wrong with my shift registers? I have a tube in my cabinet of each, so if I find some time today, I'll change them out to see what happens.
  • SarielSariel Posts: 182
    edited 2011-03-25 10:36
    First of all, I wanted to say I am back to the 10k's because all of the figures I did (plus your double checking) tells me those should work without a problem. Also, I replaced the 595 and 165's, and I am getting the same results.

    I also did a couple checks to see what my voltage and current draw is with the brand new IC's and I am getting 4.9 volts, 0.6 mA with no jumper. With 2 points jumpered, I get 1.3Volts, 63.3 mA. Any Idea what would cause those readings?

    Just tried toggling the 165 pins manually with a probe from the 5 volt line while the tester was running, and it detected a short! I am starting to think that rules out the source code and the 165 circuit.... maybe something is going all wonky with the 595? could it have something to do with the lack of resistor on the parallel side of it?
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2011-03-25 12:51
    Your circuit is not the same as kwinn's.
    He has 470 ohm series resisters on the outputs of the shift registers which limit the current.
    See #11.

    Duane
  • kwinnkwinn Posts: 8,697
    edited 2011-03-25 16:36
    Sariel, if I were breadboarding this circuit I would take it one step at a time. First breadboard a single '165 circuit (with all connections and pulldowns) and use a resistor to pull up each input pin one at a time to see if a 1 is detected on each of the 8 pins. Once I know the input is working I would add a '595 circuit and connect it's outputs to the '165 inputs and verify that the '165 detects the data being output on the '595. At this point I would add a second '165, test it as I did the first one, then add a second '597, test that, and continue adding one chip at a time until I had as many as I wanted.

    This way you know the last chip you added is the most likely cause of any problem you have.
  • kwinnkwinn Posts: 8,697
    edited 2011-03-25 16:47
    BTW, I shifted the 1 bit down the '595 that way because I am lazy, not because of any need for speed. Even using spin the prop tests the cable before the operator can release the TEST button.
  • kwinnkwinn Posts: 8,697
    edited 2011-03-25 16:59
    Another BTW - You were saying you were having a problem testing for shorts but not opens. There is a simple way to test for both as you shift a single 1 bit through the register. If you store a table of the result you expect to read in for a 1 bit at each location you can compare it to the result you get. If the result is higher than you expect the wire/pin under test is shorted to one or more of the other wires/pins. If the result is lower than expected the wire/pin is open or shorted to ground.
  • SarielSariel Posts: 182
    edited 2011-03-28 05:30
    kwinn wrote: »
    Another BTW - You were saying you were having a problem testing for shorts but not opens. There is a simple way to test for both as you shift a single 1 bit through the register. If you store a table of the result you expect to read in for a 1 bit at each location you can compare it to the result you get. If the result is higher than you expect the wire/pin under test is shorted to one or more of the other wires/pins. If the result is lower than expected the wire/pin is open or shorted to ground.

    That is exactly what it is supposed to be doing. I added that in shortly after seeing the issue, and starting up this thread. I will attach an updated version of the source.
    kwinn wrote: »
    BTW, I shifted the 1 bit down the '595 that way because I am lazy, not because of any need for speed. Even using spin the prop tests the cable before the operator can release the TEST button.

    I kinda noticed that... this beast is a lot faster than I would have expected it to be.
    kwinn wrote: »
    Sariel, if I were breadboarding this circuit I would take it one step at a time. First breadboard a single '165 circuit (with all connections and pulldowns) and use a resistor to pull up each input pin one at a time to see if a 1 is detected on each of the 8 pins. Once I know the input is working I would add a '595 circuit and connect it's outputs to the '165 inputs and verify that the '165 detects the data being output on the '595. At this point I would add a second '165, test it as I did the first one, then add a second '597, test that, and continue adding one chip at a time until I had as many as I wanted.

    This way you know the last chip you added is the most likely cause of any problem you have.

    Yup. That's how I built this thing up. Take a peek at the rev history, and it should reflect that.
    Your circuit is not the same as kwinn's.
    He has 470 ohm series resisters on the outputs of the shift registers which limit the current.
    See #11.Duane

    Yeah I tried that, but still no joy. Was not sure how limiting my current even more would help, but it was worth a shot.


    Autotester v1.201 - Archive [Date 2011.03.28 Time 07.21].zip
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2011-03-28 06:16
    The 470 ohm series resisters are "Required".
    A short in the cable has the effect of shorting the outputs of the shift register.
    You said in #13 that the voltage on the shift registers dropped to 1.3 volts.
    This would not happen with the series resisters in place.

    Duane
  • SarielSariel Posts: 182
    edited 2011-03-28 06:42
    Not sure what happened the first time I tried it, but adding the 470's the second go around seemed to do the trick. It did in fact sense that the two pins were shorted together. FINALLY something seems to be going right with this thing. Thank you for your help everyone. Time to put the finishing touches on this guy and be done with it once and for all.
  • SarielSariel Posts: 182
    edited 2011-05-25 08:19
    Finally got a chance to get back at this project, and all is mostly well. The last part of this project hinges on getting better pass/fail logic in place than what is currently used. The way it works is I have an excel file that I fill out to determine what connections should be found when voltage is applied to pin one. This generates one long of data, representing expected data. this is repeated for each pin, making a total of 32 longs for an entire check. At the moment, I am just using simple greater than/less than comaprison to find if an open or short is found when compared to the expected value, but there are situations where this will not work. I remember back in my BS2 days that I could use "//" to seperate one byte into 8 individual bits and compare it bit by bit. This will not work since trying the modulous on step 10 results in errors for exceeding a 32 bit number at compile. I have an idea, but I'm not sure on how to implement it. Rather than performing multiple math operations to divide the numbers down a bit, is it possible to use "<<=" and "=>>" to shift the data, and do a comparison that way? I theorize that I could also improve "Probe Mode" with this to be able to display 2 jumpered (or shorted) connections. Here is my code so far so folks can get an idea of where I'm at.

    {{
    >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<<  
    >>  (¯`·._.·(¯`·._.·(¯`·._. CONNECTION INFORMATION ._.·´¯)·._.·´¯)·._.·´¯)  <<
    >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<<  
    SMT Board IO Assignments
      P0 - 
      P1 - 
      P2 - DIP8 
      P3 - DIP7
      P4 - 
      P5 - 
      P6 - 
      P7 - 
      P8 - RESERVED
      P9 - RESERVED
     P10 - RESERVED
     P11 - RESERVED
     P12 - SPEAKER
     P13 - Button
     P14 - Green LED
     P15 - Red LED
     P16 - RESERVED
     P17 - RESERVED
     P18 - 74HC165 CLK
     P19 - 74HC165 Ser out 
     P20 - 74HC165 LD 
     P21 - 74HC595 Serial Clk
     P22 - 74HC595 Serial in
     P23 - 74HC595 Latch
     P24 - TV out 1 (1.1kO)
     P25 - TV out 2 (560O)
     P26 - TV out 3 (270O)
     P27 - 
     P28 -
     
    }}
    CON
    '' Clock settings
      _CLKMODE      = XTAL1 + PLL16X 
      _XINFREQ      = 5_000_000
     
    '' I/O connection constants
     
      CLK165        = 18                                                            '' 74HC165 Clock (Pin2 of device)
      SDat165       = 19                                                            '' 74HC165 Serial Data (Pin9 of device)
      LD165         = 20                                                            '' 74HC165 Data Load (Pin1 of device)
      CLK595        = 21                                                            '' 74HC595 Clock (Pin11 of device) 
      SDat595       = 22                                                            '' 74HC595 Serial Data (Pin14 of device)
      Lat595        = 23                                                            '' 74HC595 Data Latch (Pin12 of device)  
      BeepPin       = 12                                                            '' Speaker connection constant  
      BUTTON        = 13                                                            '' IO for "Test" button
      GrnLED        = 14                                                            '' Green Data line for the "Begin Test" Button
      RedLED        = 15                                                            '' Red Data line for the "Begin Test" Button 
      TVPin         = 24                                                            '' First TV pin. Consumes 3 consecutive pins
      DIP7          = 3                                                             '' Dip Switch 7
      DIP8          = 2                                                             '' Dip Switch 8
     
      NoOfBits      = 8                                                             '' number of Data lines to use for assembly. MUST   
                                                                                    ''    be in multiples of 8, and greater than or                                                  
                                                                                    ''    equal to the amount of wires in the assembly.
     
    '' Revision constants   
      RevA          = 1                                                             '' First part of AutoTester Firmware rev number
      RevB          = 220                                                           '' Second part of AutoTester Firmware rev number
      Assy          = 01234567                                                      '' Assembly number
      FixA          = 9876                                                          '' Fixture number used with Connector A
      FixB          = 5432                                                          '' Fixture number used with Connector B
     
    VAR
      Long L[31]                                                                    '' Matrix Data Variables
      Long LongValue                                                                '' Serial data from 74HC165
      Byte pattern1                                                                 '' Data out pattern 1
      Byte pattern2                                                                 '' Data out pattern 2    
      Byte pattern3                                                                 '' Data out pattern 3    
      Byte pattern4                                                                 '' Data out pattern 4
      Byte StepCnt                                                                  '' Stepper for Pass/Fail logic
      Byte FailCnt                                                                  '' Failure counter
      Byte TP                                                                       '' Test Point conversion variable
     
    OBJ
     
      serout : "74HC595.object"                                                     '' Driver file for 74HC595
      Serin  : "74HC165.object"                                                     '' Driver file for 74HC165
      disp   : "messages.object"                                                    '' Driver file for all alerts and displays
     
    PUB Main
     
      init                                                                          '' Run baseline init 
      if ina[DIP7]                                                                  '' If DIP7 is active,
        GetProbe                                                                       '' Switch tester to probe mode                                     
      repeat                                                                        '' Scan for button press indefinitely
        if ina[BUTTON]                                                              '' Look for the begin test button to be pressed
          disp.beep( 40, 50_181)                                                    '' Beep acknowledging that the button was pressed
          disp.Red( GrnLED, RedLED)                                                 '' Make Switch LED Red
          disp.Testing                                                              '' Display "Testing"                        
          RunTest                                                                   '' Do that thing that you do so well, when you do it!
          serout.out4cln                                                            '' Send all 0's to the 595 array
          End
     
    PUB init
     
      L[0]          := %0000_0000_0000_0000_0000_0000_0000_0001                     '' Load Cable Data into Matrix
      L[1]          := %0000_0000_0000_0000_0000_0000_0000_0010 
      L[2]          := %0000_0000_0000_0000_0000_0000_0000_0100
      L[3]          := %0000_0000_0000_0000_0000_0000_0000_1000
      L[4]          := %0000_0000_0000_0000_0000_0000_0001_0000
      L[5]          := %0000_0000_0000_0000_0000_0000_0010_0000
      L[6]          := %0000_0000_0000_0000_0000_0000_0100_0000
      L[7]          := %0000_0000_0000_0000_0000_0000_1000_0000
      L[8]          := %0000_0000_0000_0000_0000_0001_0000_0000
      L[9]          := %0000_0000_0000_0000_0000_0010_0000_0000
      L[10]         := %0000_0000_0000_0000_0000_0100_0000_0000
      L[11]         := %0000_0000_0000_0000_0000_1000_0000_0000
      L[12]         := %0000_0000_0000_0000_0001_0000_0000_0000
      L[13]         := %0000_0000_0000_0000_0010_0000_0000_0000
      L[14]         := %0000_0000_0000_0000_0100_0000_0000_0000
      L[15]         := %0000_0000_0000_0000_1000_0000_0000_0000                     
      L[16]         := %0000_0000_0000_0001_0000_0000_0000_0000
      L[17]         := %0000_0000_0000_0010_0000_0000_0000_0000
      L[18]         := %0000_0000_0000_0100_0000_0000_0000_0000
      L[19]         := %0000_0000_0000_1000_0000_0000_0000_0000
      L[20]         := %0000_0000_0001_0000_0000_0000_0000_0000
      L[21]         := %0000_0000_0010_0000_0000_0000_0000_0000
      L[22]         := %0000_0000_0100_0000_0000_0000_0000_0000
      L[23]         := %0000_0000_1000_0000_0000_0000_0000_0000
      L[24]         := %0000_0001_0000_0000_0000_0000_0000_0000
      L[25]         := %0000_0010_0000_0000_0000_0000_0000_0000
      L[26]         := %0000_0100_0000_0000_0000_0000_0000_0000
      L[27]         := %0000_1000_0000_0000_0000_0000_0000_0000
      L[28]         := %0001_0000_0000_0000_0000_0000_0000_0000
      L[29]         := %0010_0000_0000_0000_0000_0000_0000_0000
      L[30]         := %0100_0000_0000_0000_0000_0000_0000_0000
      L[31]         := %1000_0000_0000_0000_0000_0000_0000_0000
      FailCnt := 0                                                                  '' Init Failure counter
      disp.SetRev(RevA, RevB)                                                       '' init rev number   
      disp.SetAssy(Assy)                                                            '' init assembly number 
      disp.SetFix(FixA, FixB)                                                       '' init Fixture numbers 
      serout.init(SDat595, CLK595, Lat595)                                          '' init 595
      serout.out4cln                                                                '' Send all 0's to 595 cascade to clear data lines
      disp.Off( GrnLED, RedLED)                                                     '' LED object init
      dira[BUTTON] := 0                                                             '' init Button      
      dira[DIP7] := 0                                                               '' init DIP7        
      dira[DIP8] := 0                                                               '' init DIP8
      disp.SetBeep(BeepPin)                                                         '' Tell display object what pin number the speaker is on
      StepCnt := 0                                                                  '' Initialize Step Counter for logic tracking
      pattern1 := %0000_0000                                                        '' Init the serial output pattern1
      pattern2 := %0000_0000                                                        '' Init the serial output pattern2
      pattern3 := %0000_0000                                                        '' Init the serial output pattern3
      pattern4 := %0000_0000                                                        '' Init the serial output pattern4
      disp.header(TVPin)                                                            '' init display and draw base screen
      disp.GRN( GrnLED, RedLED)                                                     '' Tester Ready, LED Green                                                                                                                                                                                                                               
     
     
    PUB RunTest
     
      pattern1 := %0000_0001                                                        '' Store pattern 1 start position
      repeat 8                                                                      '' Begin 8 bit data series
        disp.Counter(StepCnt)                                                       '' Display step number
        serout.out4(pattern1, pattern2, pattern3, pattern4)                         '' Output pattern Data                
        pattern1 <<= 1                                                              '' Shift binary data one left
        LongValue := Serin.ShiftIn ( LD165, SDat165 , CLK165 , 32)                  '' Read data from connector B
        if LongValue > L[StepCnt]                                                   '' If data is greater than          
          short                                                                     '' Consider it as a short
        if LongValue < L[StepCnt]                                                   '' If data is less than             
          open                                                                      '' Consider it as an open
        Stepcnt := Stepcnt + 1                                                      '' Advance Step/Matrix counter           
        if ina[DIP8]                                                                '' If Debug mode is active
          disp.BinOut(LongValue, 32)                                                '' Display debugging Binary data to TV 
          waitcnt(clkfreq + cnt)                                                    '' wait for a while (debugging pause)  
     
      pattern2 := %0000_0001                                                        '' Store pattern 2 start position    
      repeat 8                                                                      '' Begin 8 bit data series    
        disp.Counter(StepCnt)                                                       '' Display step number               
        serout.out4(pattern1, pattern2, pattern3, pattern4)                         '' Output pattern Data                 
        pattern2 <<= 1                                                              '' Shift binary data one left        
        LongValue := Serin.ShiftIn ( LD165, SDat165 , CLK165 , 32)                  '' Read data from connector B
        if LongValue > L[StepCnt]                                                   '' If data is greater than         
          short                                                                     '' Consider it as a short
        if LongValue < L[StepCnt]                                                   '' If data is less than           
          open                                                                      '' Consider it as an open
        Stepcnt := Stepcnt + 1                                                      '' Advance Step/Matrix counter            
        if ina[DIP8]                                                                '' If Debug mode is active
          disp.BinOut(LongValue, 32)                                                '' Display debugging Binary data to TV 
          waitcnt(clkfreq + cnt)                                                    '' wait for a while (debugging pause)  
     
      pattern3 := %0000_0001                                                        '' Store pattern 3 start position 
      repeat 8                                                                      '' Begin 8 bit data series    
        disp.Counter(StepCnt)                                                       '' Display step number            
        serout.out4(pattern1, pattern2, pattern3, pattern4)                         '' Output pattern Data                 
        pattern3 <<= 1                                                              '' Shift binary data one left        
        LongValue := Serin.ShiftIn ( LD165, SDat165 , CLK165 , 32)                  '' Read data from connector B
        if LongValue > L[StepCnt]                                                   '' If data is greater than        
          short                                                                     '' Consider it as a short     
        if LongValue < L[StepCnt]                                                   '' If data is less than             
          open                                                                      '' Consider it as an open
        Stepcnt := Stepcnt + 1                                                      '' Advance Step/Matrix counter             
        if ina[DIP8]                                                                '' If Debug mode is active
          disp.BinOut(LongValue, 32)                                                '' Display debugging Binary data to TV 
          waitcnt(clkfreq + cnt)                                                    '' wait for a while (debugging pause)  
     
      pattern4 := %0000_0001                                                        '' Store pattern 4 start position
      repeat 8                                                                      '' Begin 8 bit data series    
        disp.Counter(StepCnt)                                                       '' Display step number                                                      
        serout.out4(pattern1, pattern2, pattern3, pattern4)                         '' Output pattern Data                  
        pattern4 <<= 1                                                              '' Shift binary data one left       
        LongValue := Serin.ShiftIn ( LD165, SDat165 , CLK165 , 32)                  '' Read data from connector B
        if LongValue > L[StepCnt]                                                   '' If data is greater than        
          short                                                                     '' Consider it as a short
        if LongValue < L[StepCnt]                                                   '' If data is less than           
          open                                                                      '' Consider it as an open
        Stepcnt := Stepcnt + 1                                                      '' Advance Step/Matrix counter            
        if ina[DIP8]                                                                '' If Debug mode is active
          disp.BinOut(LongValue, 32)                                                '' Display debugging Binary data to TV 
          waitcnt(clkfreq + cnt)                                                    '' wait for a while (debugging pause)                  
      StepCnt := 0                                                                  '' Re-Init Step Counter for logic tracking  
      disp.GRN( GrnLED, RedLED)                                                     '' LED color change to Green
    PUB Short
      FailCnt := FailCnt + 1
      disp.short(StepCnt + 1, FailCnt)
    PUB Open
      FailCnt := FailCnt + 1
      disp.open(StepCnt + 1, FailCnt) 
    Pub End
     
      if FailCnt > 0
        disp.fail                                                                   '' Display Failure message
        repeat                                                                      '' Scan for button press indefinitely
          if ina[BUTTON]                                                            '' Look for the begin test button to be pressed 
            disp.beep( 40, 50_181)                                                  '' Beep acknowledging that the button was pressed
            waitcnt(clkfreq/2 + cnt)                                                '' wait for a while (debouncing pause)   
            Main                                                                    '' Return to main Method
      disp.Pass
      repeat                                                                        '' Scan for button press indefinitely
        if ina[BUTTON]                                                              '' Look for the begin test button to be pressed 
          disp.beep( 40, 50_181)                                                    '' Beep acknowledging that the button was pressed 
          waitcnt(clkfreq/2 + cnt)                                                  '' wait for a while (debouncing pause)   
          Main                                                                      '' Return to main Method
     
    PUB GetProbe
    repeat
      LongValue := Serin.ShiftIn ( LD165, SDat165 , CLK165 , 32)                   '' Read data from connector B   
      disp.BinOut(LongValue, 32)                                                   '' Display debugging Binary data to TV 
      if LongValue == %1
        TP := 1    
        disp.Point(TP)
      if LongValue == %0000_0000_0000_0000_0000_0000_0000_0010
        TP := 2    
        disp.Point(TP)   
      if LongValue == %0000_0000_0000_0000_0000_0000_0000_0100
        TP := 3   
        disp.Point(TP)   
      if LongValue == %0000_0000_0000_0000_0000_0000_0000_1000
        TP := 4    
        disp.Point(TP)     
      if LongValue == %0000_0000_0000_0000_0000_0000_0001_0000
        TP := 5    
        disp.Point(TP)  
      if LongValue == %0000_0000_0000_0000_0000_0000_0010_0000
        TP := 6    
        disp.Point(TP)   
      if LongValue == %0000_0000_0000_0000_0000_0000_0100_0000
        TP := 7    
        disp.Point(TP)   
      if LongValue == %0000_0000_0000_0000_0000_0000_1000_0000
        TP := 8  
        disp.Point(TP)   
      if LongValue == %0000_0000_0000_0000_0000_0001_0000_0000
        TP := 9    
        disp.Point(TP)   
      if LongValue == %0000_0000_0000_0000_0000_0010_0000_0000
        TP := 10  
        disp.Point(TP)   
      if LongValue == %0000_0000_0000_0000_0000_0100_0000_0000
        TP := 11  
        disp.Point(TP)  
      if LongValue == %0000_0000_0000_0000_0000_1000_0000_0000
        TP := 12   
        disp.Point(TP)    
      if LongValue == %0000_0000_0000_0000_0001_0000_0000_0000 
        TP := 13  
        disp.Point(TP)  
      if LongValue == %0000_0000_0000_0000_0010_0000_0000_0000
        TP := 14  
        disp.Point(TP)   
      if LongValue == %0000_0000_0000_0000_0100_0000_0000_0000
        TP := 15  
        disp.Point(TP)   
      if LongValue == %0000_0000_0000_0000_1000_0000_0000_0000
        TP := 16  
        disp.Point(TP)   
      if LongValue == %0000_0000_0000_0001_0000_0000_0000_0000
        TP := 17  
        disp.Point(TP)  
      if LongValue == %0000_0000_0000_0010_0000_0000_0000_0000
        TP := 18  
        disp.Point(TP)    
      if LongValue == %0000_0000_0000_0100_0000_0000_0000_0000
        TP := 19 
        disp.Point(TP)   
      if LongValue == %0000_0000_0000_1000_0000_0000_0000_0000
        TP := 20    
        disp.Point(TP)    
      if LongValue == %0000_0000_0001_0000_0000_0000_0000_0000
        TP := 21         
        disp.Point(TP)   
      if LongValue == %0000_0000_0010_0000_0000_0000_0000_0000
        TP := 22   
        disp.Point(TP)    
      if LongValue == %0000_0000_0100_0000_0000_0000_0000_0000
        TP := 23  
        disp.Point(TP)     
      if LongValue == %0000_0000_1000_0000_0000_0000_0000_0000
        TP := 24 
        disp.Point(TP)    
      if LongValue == %0000_0001_0000_0000_0000_0000_0000_0000
        TP := 25   
        disp.Point(TP)    
      if LongValue == %0000_0010_0000_0000_0000_0000_0000_0000
        TP := 26  
        disp.Point(TP)   
      if LongValue == %0000_0100_0000_0000_0000_0000_0000_0000
        TP := 27    
        disp.Point(TP)    
      if LongValue == %0000_1000_0000_0000_0000_0000_0000_0000
        TP := 28   
        disp.Point(TP)   
      if LongValue == %0001_0000_0000_0000_0000_0000_0000_0000
        TP := 29    
        disp.Point(TP)    
      if LongValue == %0010_0000_0000_0000_0000_0000_0000_0000
        TP := 30    
        disp.Point(TP)    
      if LongValue == %0100_0000_0000_0000_0000_0000_0000_0000
        TP := 31   
        disp.Point(TP)   
      if LongValue == %1000_0000_0000_0000_0000_0000_0000_0000
        TP := 32 
        disp.Point(TP)              
    
  • kwinnkwinn Posts: 8,697
    edited 2011-05-25 10:34
    Sariel, you can "exclusive or" the 32 bits you input and the 32 bits expected from your table to do this. See page 43 "^ --or-- ^= Bitwise: XOR; p 165" and page 165 of the propeller manual for details. The result of the xor will leave all matching bits set to zero and non matching bits to one.
  • SarielSariel Posts: 182
    edited 2011-05-26 04:45
    I like the idea, but I am still missing something. My project model requires that more information to be passed to the end user... What wire is at fault, and weather it is a pass or fail. By looking into this, I am failing to grasp how to tell the difference between an open and a short if both conditions return a 1.

    (edit) working on a spreadsheet to see if I can find any correlation in the data... will be back later with findings.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2011-05-26 07:56
    Where did you get the 74HC595 and 74HC165 objects?
  • SarielSariel Posts: 182
    edited 2011-05-26 09:32
    Where did you get the 74HC595 and 74HC165 objects?

    For the 595 I am using a slightly modified version of the one found n the Obex, "jm_595_ez_demo.zip", and for the 165 I used one that I found digging in the forums called HC165try.spin, found here:

    [HTML]
    http://forums.parallax.com/showthread.php?91963-74HC165-Spin-Test-code-need-some-help
    [/HTML]

    Sariel, you can "exclusive or" the 32 bits you input and the 32 bits expected from your table to do this. See page 43 "^ --or-- ^= Bitwise: XOR; p 165" and page 165 of the propeller manual for details. The result of the xor will leave all matching bits set to zero and non matching bits to one.

    I think I have an answer to my own question. I filled out the Spreadsheet of random pass/fail conditions, and I started seeing a trend in the XOR translations. Correct me if I am wrong, but wouldn't returning all 0's indicate a passing check, if expected condition is equal to the XOR'd data, that would be a short. if an open condition is found, XOR'd data would be greater than expected data in the L[x] variable. I could then rely on the step number to tell me what pin on the 595 connector side would be faulty, like I am already doing, and use that as error reporting to the end user.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2011-05-26 10:37
    Thanks for the link!
  • SarielSariel Posts: 182
    edited 2011-05-26 11:16
    Thanks for the link!

    Any time.

    Wanted to say thanks again to kwinn for guiding me through the serious questions I had. If you ever find yourself in Cheeseville, I owe ya a beer or five.

    I have that short bug fixed now, where it is detecting all shorts, not just ones that are shorting to a pin higher in the pin number being tested. XOR did the trick, after I had to visualize on paper what the heck the real data would be. For simplicity, I left the open detection alone since there was nothing wrong with that. Snippets I changed were:

    (rinse and repeat for all 4 pattern sets)
    pattern1 := %0000_0001                                                        '' Store pattern 1 start position
      repeat 8                                                                      '' Begin 8 bit data series
        disp.Counter(StepCnt)                                                       '' Display step number
        serout.out4(pattern1, pattern2, pattern3, pattern4)                         '' Output pattern Data                
        pattern1 <<= 1                                                              '' Shift binary data one left
        LongValue := Serin.ShiftIn ( LD165, SDat165 , CLK165 , 32)                  '' Read data from connector B
        if (LongValue <> L[StepCnt])                                                  '' If data is not equal       
          logic                                                                     '' go to XOR routine                  
        Stepcnt := Stepcnt + 1                                                      '' Advance Step/Matrix counter           
        if ina[DIP8]                                                                '' If Debug mode is active
          disp.BinOut(LongValue, 32)                                                '' Display debugging Binary data to TV 
          waitcnt(clkfreq + cnt)                                                    '' wait for a while (debugging pause)
    

    and added in the method:
    PUB logic                                                                                                                            
      XORd := LongValue ^ L[StepCnt]
      if (XORd := LongValue)                                                                                                             
        short
      if LongValue < L[StepCnt]                                                   '' If data is less than 
        disp.nerp                                                                 '' Nerpity do-dah for blabbitization           
        open                                                                      '' Consider it as an open    
    

    Now, it is time to add in operator requests that are not system vital like short conditions displaying pin from and to data... just stuff to make thier life easier.. maybe some time in the future I will add wire color mapping so they can go right to the failure and fix it without even having to look at a print. Starting to get excited about this again. :nerd:
  • kwinnkwinn Posts: 8,697
    edited 2011-05-26 23:36
    Congrats on getting things going. Always happy to help out. As for the beers, appreciate the offer. You never know, I might get there some day and take you up on it.
  • SarielSariel Posts: 182
    edited 2011-06-14 06:58
    Been using this unit on the floor for a little while now, and it is great... for the most part. One of our longer assemblies (and it has to be the one production is most interested using this on) includes 4 jumper wires. The length of the cable, coupled with jumper wires, is bringing my voltage output from the 595's down to 1.15V with the 595's running at 5 volts, and the output is obviously not high enough to drive the 165 pins (with them running at 3.3V), signaling an open condition on just those wires. I have looked at using opto-couplers to try and give a layer of isolation to the input side, as well as bring the voltage up. With the price of those things, it is not in the project budget to go that route. 4050 buffers won't work because 1.15V is below the high level threshold on the input side. I have browsed around and have not found any cheap and easy to implement solutions. I would like to come up with a solution that would take anything that is one volt or higher, and turn it into something that would drive the 165 high. Does anyone have an idea on what I can try next? Keep in mind it has to be cost-effective, and I need to cram 32 level shifters into this thing... one for each test point.

    *edit*
    It has something to do with output current. I re-wrote a bit of the program to toggle all 4 jumpers high at once, and it was enough to get the intended results. I really don't want to write programs this specific for each cable, so I am in search for something on the output side that brings more than 25 mA to the table, or an input chip that is a bit more sensitive.
  • kwinnkwinn Posts: 8,697
    edited 2011-06-14 22:03
    Sariel, you might try something like the ULN28xx chips on the input side ahead of the '165's. If you do that the first thing you will have to do is invert all the input bits (xor with 111111...etc) since the ULN inverts the bits. If that is not enough you can add a ULN on the output side and connect it to a higher voltage (9-12V?) to provide a bit of extra drive.

    If you want a bit more specific info I will need an accurate schematic of a few bits of the output and input circuitry. PM me with your email address and we can echange info directly.
  • SarielSariel Posts: 182
    edited 2011-06-15 07:03
    kwinn wrote: »
    Sariel, you might try something like the ULN28xx chips on the input side ahead of the '165's. If you do that the first thing you will have to do is invert all the input bits (xor with 111111...etc) since the ULN inverts the bits. If that is not enough you can add a ULN on the output side and connect it to a higher voltage (9-12V?) to provide a bit of extra drive.

    Hrm... that guy looks like it will possibly do the trick. Just now trying to figure out if there will be enough voltage to toggle the ULN's after it has travelled down the length of the assembly. Wouldn't it be better to just have one set on the output side?

    XOR again? awesome. I'll be an expert in that trick very soon. I have learned so much in this project that is going to carry over to some of the other ideas floating around in my head.
Sign In or Register to comment.