Nothing seems to work like I need it to. Is it me, or do others have this same experience?
Anyway, I have two projects where I am measuring objects using lasers. The lasers being used output an analog signal ranging from 0-10V indicating distance or thickness. The lasers are mounted to an X/Y carriage, and controlled by a Galil 1740.
What I am doing is moving the laser at the highest speed possible to reduce cycle time
while maintaining an acceptable amount of accuracy. The 1740 executes instructions at
375uS each. The problem is capturing the position at which the analog voltage crosses a threshold quick enough to measure the target's diameter accurately. Consider the following code fragment:
NOTE X & Y ARE STATIONARY AT STARTING POINT
UTH=9.1 (RISING THRESHOLD)
LTH=9.0 (FALLING THRESHOLD)
PA ,MAX (MOVE TO MAX OF Y)
SP ,120000 (AND HURRY)
TW6000 (SET TIMEOUT TO 6 SECS)
BGY
#L1
JP#L1,@AN[1]P1=_TPY (CAPTURE FIRST POINT)
#L2
JP#L2,@AN[1]>LTH (WAIT FOR SIGNAL TO CROSS LOWER THRESHOLD)
P2=_TPY (CAPTURE SECOND POINT)
STY
MC
DIA=(P2-P1)/8000 (CALC DIAMETER)
EN
The positions captured could be off by as much as 1125uS. At a rate of 120,000 counts/second with 8000 counts/inch, this becomes .015" and not acceptable.
Suggestion
Expand upon the high speed position capture function to use a selected analog port and
voltage as the trigger. With the reduced latency I could have readings within .000375
inches in this application. The syntax could look something like this:
ALX 1,>9.1 (capture X axis position using analog port 1 when voltage rises above 9.1)
ALY 1,<-1.9 (capture Y axis position using analog port 1 when voltage falls below -1.9)
My code fragment would then look something like this:
TW6000
BGY
ALY 1,>UTH
#L1
JP#L1,_ALY=1 (WAIT FOR EVENT TO HAPPEN)
P1=_RLY (RETRIEVE FIRST POINT)
ALY 1,#L2
JP#L2,_ALY=1 (WAIT FOR EVENT TO HAPPEN)
P2=_RLY (RETRIEVE SECOND POINT)
STY
MC
DIA=(P2-P1)/8000 (CALC DIAMETER)
EN
Dr. J, what do you think?
Larry
_________________________
No matter how bad Windows gets, I still prefer Linux.