Motf WaitForCount
NOTE: This method is deprecated. Please use MOTF.WaitForDistance()
Wait for scaled HW encoder counter to reach or exceed a specific value.
Syntax
| WaitForCount ( int scaledEncoderCounts ) |
| WaitForCount ( int scaledEncoderCounts , bool isAbsolute ) |
Parameters
| scaledEncoderCounts | int | Scaled encoder count. |
| isAbsolute | bool | Count is absolute or relative to the last position when StopTrackingAndJump is called. Default False. |
| isAbsolute = TRUE | absolute - indicates that the wait is to use absolute scaled encoder counts. |
| isAbsolute = FALSE | relative - wait for a count relative to the position when the last StopTrackingAndJump occurred. This will be the default value. |
Copy
Example
-- This sample marks a series of circles spaced at a constant distance
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorY * encoderLinResInMmPerCount
-- Initialize the MOTF settings
MOTF.Initialize()
-- Initialize laser/scan-head settings
Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true
-- Wait for this web travel before marking
partDistanceInMm = 50.
partDistanceInBits = partDistanceInMm * System.CalFactorY
-- Wait for start signal
IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)
-- Initialize to wait the initial distance
MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
-- Using MOTF CalFactor scaled counts which are galvo bits
MOTF.WaitForCount(partDistanceInBits)
-- Counters are automatically reset when WaitForCount() releases
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end
Report ("Job Finished")