Check for short and continuity

Thread Starter

Leta Dela Puerto

Joined Sep 7, 2017
4
Hello,

I am working on a small project that should test one cable with 24 pins on one side and on the other side it got another 24 pins, in total 48 points. I want to use an Atmel328p, an LCD 16x2, and few mux and demux in order to complete the test.

My question is very simple how should I create the code in order the test to be fast and after it is finished to print on lcd if the cable is ok or not and where is the problem between witch pins .

#include <LiquidCrystal_SR_LCD3.h>


const int PIN_LCD_STROBE = 12; // Out: LCD IC4094 shift-register strobe
const int PIN_LCD_DATA = 11; // Out: LCD IC4094 shift-register data
const int PIN_LCD_CLOCK = 10; // Out: LCD IC4094 shift-register clock
const int PIN_LCD_BACKLIGHT = 7; // Out: LCD backlight (PWM)

// srdata / srclock / strobe
LiquidCrystal_SR_LCD3 lcd(PIN_LCD_DATA, PIN_LCD_CLOCK, PIN_LCD_STROBE);

int buton=3; //buton
int b=0;
int mux=0;
int pinmux=0;
int demux=0;
int pindemux=0;
int test=0;
int countermux=0;
int counterdemux=0;
int eroare_scurt=0;
int eroare_open=0;
int pinliber=0;
int doipini=0;
int i=0;

void setup(){
pinMode(PIN_LCD_BACKLIGHT, OUTPUT);
analogWrite(PIN_LCD_BACKLIGHT, 80);
pinMode(0 ,OUTPUT); //Atmegapin 2 mux A
pinMode(1 ,OUTPUT); //Atmegapin 3 mux B
pinMode(2 ,OUTPUT); //Atmegapin 4 mux C
pinMode(3 ,OUTPUT); //Atmegapin 5 mux 1 enable
pinMode(4 ,OUTPUT); //Atmegapin 6 mux 2 enable
pinMode(5 ,OUTPUT); //Atmegapin 11 mux 3 enable
pinMode(6 ,OUTPUT); //Atmegapin 12 demux A
pinMode(7 ,OUTPUT); //Atmegapin 13 demux B
pinMode(8 ,OUTPUT); //Atmegapin 14 demux C
pinMode(9 ,INPUT); //Atmegapin 15 outputdemux
pinMode(10 ,OUTPUT); //Atmegapin 16 display clk
pinMode(11 ,OUTPUT); //Atmegapin 17 display D
pinMode(12 ,OUTPUT); //Atmegapin 18 display stb
pinMode(A0, OUTPUT); //Atmegapin 23 demux 1 enable
pinMode(A1, OUTPUT); //Atmegapin 24 demux 2 enable
pinMode(A2, OUTPUT); //Atmegapin 25 demux 3 enable
pinMode(A3, INPUT); //Atmegapin 26 button
pinMode(13, OUTPUT); //Atmegapin 19 buzzer


lcd.begin(16, 2); // lcd init

lcd.home (); // go home
lcd.setCursor (0, 0);
lcd.print(F("text1"));
lcd.setCursor (0, 1);
lcd.print(F("text2"));
lcd.setCursor (0, 2);
}

void loop()
{
Start:
digitalWrite(3,1); //mux&demux off
digitalWrite(4,1);
digitalWrite(5,1);
digitalWrite(14,1);
digitalWrite(15,1);
digitalWrite(16,1);
// b=digitalRead(A3);

// if(b>=1){
eroare_scurt=0;
eroare_open=0;
pinliber=0;
countermux=0;
lcd.setCursor (0, 1);
//lcd.print(F("Start Program"));
for(mux=3;mux<6;mux++){ //mux on
digitalWrite(mux,0);
for(pinmux=0;pinmux<8;pinmux++){
digitalWrite(0, pinmux%2); //bit A
if(( pinmux >=2 && pinmux <=3) || pinmux>=6){
digitalWrite(1, HIGH); //bit B
};
if(pinmux>=4){
digitalWrite(2, HIGH); //bit C
};
countermux++;

counterdemux=0;
for(demux=14;demux<17;demux++){
digitalWrite(demux,0); //demux on
for(pindemux=0;pindemux<8;pindemux++){ //pin count
digitalWrite(6, pindemux%2); //bit A
if(( pindemux >=2 && pindemux <=3) || pindemux>=6){ //bit B
digitalWrite(7, HIGH);
};
if(pindemux>=4){
digitalWrite(8, HIGH);
};
counterdemux++;
//lcd.setCursor (0, 1); //debug code.
// lcd.print(F("CM "));
// lcd.print(countermux);
// lcd.print(F("CDM "));
// lcd.print(counterdemux);
// lcd.print(F(" "));
// delay(50);

test = digitalRead(9); //read demux value

if((countermux<=4 || countermux==7) || (countermux==11 || (countermux>=14 && countermux<=18))) { //if its soldered
if(test==1 && (countermux!=counterdemux)){ //verify when 1
eroare_scurt=countermux;
};
if(test==0 && (countermux==counterdemux)){
eroare_open=countermux;
};
};

if((countermux>=8 && countermux<=10) || (countermux>=21 && countermux<=24)){ //if the pin its free
if(test==1)
eroare_scurt=countermux;
};

if(countermux==5){ //verify pins 5 si 6
if(test==1&&counterdemux==5){
doipini=1;
};
if((test==1&&counterdemux==6)&&doipini==1){
doipini=2;
};
};
if(countermux==6){
if((test==1&&counterdemux==5)&&doipini==2)
doipini=3;
if((test==1&&counterdemux==6)&&doipini==3)
doipini=4;
};
if(countermux==7&&doipini!=4)
eroare_open=6;
if(countermux==7)
doipini==0;

if(countermux==12){ //verify pins 12 si 13
if(test==1&&counterdemux==12){
doipini=1;
};
if((test==1&&counterdemux==13)&&doipini==1){
doipini=2;
};
};
if(countermux==13){
if((test==1&&counterdemux==12)&&doipini==2)
doipini=3;
if((test==1&&counterdemux==13)&&doipini==3)
doipini=4;
};
if(countermux==14&&doipini!=4)
eroare_open=13;
if(countermux==14)
doipini==0;

if(countermux==19){ //verify pins 19 si 20
if(test==1&&counterdemux==19){
doipini=1;
};
if((test==1&&counterdemux==20)&&doipini==1){
doipini=2;
};
};
if(countermux==20){
if((test==1&&counterdemux==19)&&doipini==2)
doipini=3;
if((test==1&&counterdemux==20)&&doipini==3)
doipini=4;
};
if(countermux==21&&doipini!=4)
eroare_open=20;
if(countermux==21)
doipini==0;
digitalWrite(6,0);
digitalWrite(7,0);
digitalWrite(8,0);

if(eroare_scurt!=0 || eroare_open!=0)
goto Sfarsit;
};
digitalWrite(demux,1); //demux used off
};
digitalWrite(0,0);
digitalWrite(1,0);
digitalWrite(2,0);
};
digitalWrite(mux,1);
};
Sfarsit:
digitalWrite(demux,1); //demux used off
digitalWrite(0,0);
digitalWrite(1,0);
digitalWrite(2,0);
digitalWrite(mux,1);
lcd.setCursor (0, 1);
if(eroare_scurt!=0){
lcd.print(F("Short pin "));
lcd.print(eroare_scurt);
for(i=eroare_scurt;i>0;i--){
digitalWrite(13,1);
delay(500);
digitalWrite(13,0);
delay(10);
};
}
else if(eroare_open!=0){
lcd.print(F("Open pin "));
lcd.print(eroare_open);
lcd.print(F(" "));
for(i=eroare_open;i>0;i--){
digitalWrite(13,1);
delay(500);
digitalWrite(13,0);
delay(10);
goto Start;
};
}
else{
lcd.print(F("Cable OK. "));
};
// b=digitalRead(A3);
// lcd.print(b);
// delay(100);
// };
delay(100);
}
 

Externet

Joined Nov 29, 2005
2,631
Hi. Welcome.
I would install resistors on each pin of one connector end of the cable test jig like 1000, 2000, 3000, 4000, 5000.....23000, 24000 Ohms.

A 24 position multiplexer selecting sequentially each conductor; and a second demultiplexer at the other end of the test jack. Measuring the resistances while the two mux/demux scan synchronized all connections against a table of values will detect opens, shorts and proper pin usage between conductors.

I did that manually with a 12 position-two pole switch a loooong ago with an ohmeter and a two jack jig. If position one showed 1k, position two showed 2K, ... position twelve showed 12K; meant wiring was correct with no anomalies. Did not read your code nor will write such to fit your hardware taste.
 

DickCappels

Joined Aug 21, 2008
10,661
That sounds like a job for Arduino (<== hyperlink), a relatively easy to make small embedded applications for the ATMEGA326 and other ATMEGA controllers.

It is designed to allow people to write small embedded programs without having to become a firmware engineer.
 

DickCappels

Joined Aug 21, 2008
10,661
Hello,

(Some text removed for clarity)

My question is very simple how should I create the code in order the test to be fast and after it is finished to print on lcd if the cable is ok or not and where is the problem between witch pins .
Why are you asking this question if you have already written code? What do you want?
 

Thread Starter

Leta Dela Puerto

Joined Sep 7, 2017
4
Why are you asking this question if you have already written code? What do you want?
The problem is that i dont know what i need to change in order to get the short test if only one side of my cable is connected...My code is not alright from my point of view, I think it can be made better and I need some help form people with more experience then me.
 
Last edited:

Thread Starter

Leta Dela Puerto

Joined Sep 7, 2017
4
hi,
Is there a minimum specified current or voltage that has to be used to check continuity and isolation.?
E
there is no minimum specified current or voltage, but if u think it will work I can do a current or voltage limit. As I said earlier my code is not alright from my point of view, I think it can be made better and I need some help form people with more experience then me.
 

ericgibbs

Joined Jan 29, 2010
21,439
hi LDP,
The connector/cable form testers I made long ago, specified a continuity test current of 1Amp and insulation test at 500Vdc.
That was for an avionics test project, what is the end use of the cable forms you are testing.?
E
 

Thread Starter

Leta Dela Puerto

Joined Sep 7, 2017
4
hi LDP,
The connector/cable form testers I made long ago, specified a continuity test current of 1Amp and insulation test at 500Vdc.
That was for an avionics test project, what is the end use of the cable forms you are testing.?
E
I use it to connect some LCD`s to amain computer, its like an old tester from my work that i`m upgrade it, i purchase some custom cables from china and it does not work, i want to test it for continuity and short and then make a complain if its they're fault because the connector are sealed with some epoxy.
 

ericgibbs

Joined Jan 29, 2010
21,439
hi,
Your test method sounds OK for your application.
One way of indicating a continuity fault from pin to pin, is to stop the test cycle at that pin to pin point and indicate a open circuit and the pin number.
Even one pin to pin fail means the cable is faulty, so there is no point in testing that cable form any further.

If it passes the continuity test then carry out the inter-pin short circuit test.

E
 

Reloadron

Joined Jan 15, 2015
7,889
The problem is that i dont know what i need to change in order to get the short test if only one side of my cable is connected...My code is not alright from my point of view, I think it can be made better and I need some help form people with more experience then me.
This may work better if you posted your code and the procedure and methods you are using? This means posting the hardware, code and the code should include 'Remarks.

Ron
 
Top