On Tue, 1 Mar 2005, James Newtons Massmind wrote: > Too cool of you to post this! Thanks! > > In the language you are using here, is 0 or 1 considered true? Also, what > does the "tag[j]" on the line after the print " $j" do? It is a pseudo language and my rendering of it is full of inconsistencies (like using bin(i) and tag[i], both being array references). > If we are not to "add anything for open reading or zero reading" and we are > "using -1 as reading for an open reading" then "R (i+1lj+1) != +inf" needs > to be something like "(R (i+1,j+1) != +inf) && (R (i+1,j+1) > 0)" correct? assuming +inf is represented as -1 as I proposed, make that R(i+1,j+1) != -1 > In javascript, I did > r = R(i+1,j+1); > x = ( isNaN(r) ? 0 : parseFloat(r) ); > bin[i] += (0 Where isNaN returns true if r is not a number so x becomes 0 if r is empty > and the numeric value of r otherwise. > bin[i] is incremented only if x is greater than 0. Yes, that is the idea. > "slice = (min * 11) / 9" seems to work better than "slice = (max + min) / 2" > but why not just "if (bin[i] <= slice) " rather than "if (bin[i] < slice) " > since this also managed the case where min == 0. Then slice can just be set > to min. Or am I missing something there? min is not supposed to be 0, unless there is a short. Getting users to take meaningful readings for < 1 ohm windings with a $5 DVM will be interesting anyway. The idea of slice is that the measured values will be all around R and 2*R, where R is the approximate winding resistance. Then after min/max slice will be approximately R+2*R/2 = 3/2*R and the farthest from either group's strays (iow poor measurments) (I hope). > I also added some checks for coil resistance readings that vary from one > phase to the next and for phase to phase resistances that aren't double the > coil resistance. > > The javascript/web page translation is at > http://www.piclist.com/techref/io/stepper/wires.htm and seems to work up to > 6 wire motors. > > This still doesn't find the ORDER of the phases, but I can't see a way to do > that with out applying power or using a dual trace 'scope. That is correct, you cannot find the order easily, but I have something in mind that involves a $1 magnetic compass and some thin wire coils wound around it ... let it sit for a while it isn't just there yet. Peter -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist