Hi Guys
I have some code down below which is being used in a home made in-circuit tester, this code tests all test pins for short circuits against one another and the code is working fairly well, it will print a pass or fail for each pin and at the end of the test i have a list of result
The only problem i have is that some of the pins are shorted through tracks on the PCB board i wish to test, What i now need to introduce into the code is a way of saying the 8 pairs of pins that are shorted are still passes even though they are returning a high reading.
For example
Pins 2-66 are all tested against one another they are taken for a one dimensional array one at a time and tested.
All Pins except (2 and 10) (23 and 44) (24 and 30 ) (29 and 31) (32 and 33) (39 and 41) (42 and 47) and (55 and 60) will return a low and a pass but the above pairs will return a high and a fail,
What i want my code is to acknowledge these high as passes.
I have thought of introducing a 2 dimensional array with these pairs but i am not quiet sure on how to implement it
Let me know what you think
template<class T> inline Print &operator <<(Print &obj, T arg) { obj.print(arg); return obj; }
// Don't use pin 0 & 1 else serial monitor wont work
const byte pinArray[] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66};
//sizeof(pinArray) returns the size of the array in bytes not elements so if your using a byte array it will match the number of elements
//but if it was an int/long array then the sizeof will be 2x/4x times respectfully the number of elements in the array as int uses 2 bytes to store and long uses 4 bytes.
//Print the sizeof(pinArray) value and then change the array type to int/long and print it again and you will see.
const byte pinArraySize = sizeof(pinArray) / sizeof(pinArray[0]);
void setup(){
Serial.begin(9600);
}
void loop(){
for (byte a = 0; a < pinArraySize - 1; a++){ // Loop from start to penultimate entry of array
pinMode(pinArray[a],OUTPUT); // Set pin to output
digitalWrite(pinArray[a],LOW); // Set it low
Serial << "Pin " << pinArray[a] << " to...\r\n";
for (byte b = a + 1; b < pinArraySize; b++){ // Loop from test pin + 1 to end of array
pinMode(pinArray[b],INPUT_PULLUP); // Set pin to input with pullup to stop floating pin errors
Serial << "\tPin " << pinArray[b] << " = ";
if (digitalRead(pinArray[b]) == LOW){ // Has the pin been pulled low by a short?
Serial.println(" ****FAIL****");
}
else {
Serial.println("PASS");
}
pinMode(pinArray[b],INPUT); // Turn off pullup resistor
}
pinMode(pinArray[a],INPUT); // Set back to input
}
while(1){}; // Loop forever
}