Command |
Specifies the end of a block of commands which can be executed in a loop.
public void AppendLoopEnd()
Causes execution to continue at the nearest preceding LOOP_START.
Example 1: Mark a path 20 times.
using ( ClientAPI client = new ClientAPI() ) { client.Connect( cardIP ); // <--- insert your card's IP address here! client.System.ResetToDefaults(); CommandList list1 = new CommandList(); list1.AppendJumpSpeed( 100 ); list1.AppendMarkSpeed( 20 ); list1.AppendLmFrequency( 1.0 / 50 ); list1.AppendLmWidth( 35 ); list1.AppendJumpAbs( -20000, 0 ); list1.AppendLoopStart( 20 ); list1.AppendMarkRel( 0, 20000 ); list1.AppendMarkRel( 20000, 0 ); list1.AppendMarkRel( 0, -20000 ); list1.AppendMarkRel( -20000, 0 ); list1.AppendLoopEnd(); list1.AppendJumpAbs( 0, 0 ); client.List.Set( 1, list1 ); client.List.Execute( 1 ); client.Disconnect(); }
Example 2: Mark a path up to 20 times, but stop early if certain bits are NOT active on PortB.
This is a somewhat contrived example to illustrate available functionality: your mileage certainly should vary!
using ( ClientAPI client = new ClientAPI() ) { client.Connect( cardIP ); // <--- insert your card's IP address here! client.System.ResetToDefaults(); CommandList list1 = new CommandList(); list1.AppendJumpSpeed( 100 ); list1.AppendMarkSpeed( 20 ); list1.AppendLmFrequency( 1.0 / 50 ); list1.AppendLmWidth( 35 ); list1.AppendJumpAbs( -20000, 0 ); list1.AppendLoopStart( maximumLoopCount ); // // Break out of loop if certain bits are NOT active on PortB. // // The branch offset (2) is the relative position of the branch target command. // list1.AppendBranchRel(2, continueLoopingBitmask, PortID.PortB); list1.AppendLoopBreak(); list1.AppendMarkRel( 0, 20000 ); // this is the branch target command. list1.AppendMarkRel( 20000, 0 ); list1.AppendMarkRel( 0, -20000 ); list1.AppendMarkRel( -20000, 0 ); list1.AppendLoopEnd(); list1.AppendJumpAbs( 0, 0 ); client.List.Set( 7, list1 ); client.List.Execute( 7 ); client.Disconnect(); }