16 Stand-Alone Mode |
Stand-Alone Mode enables the automatic and autonomous execution of a pre-defined CommandList (the Stand-Alone List
) after the SP-ICE-3 Card has (re-)booted.
This stand-alone list is distinguished only by being selected for use in stand-alone mode, and is in all other respects a normal CommandList, which may itself branch to, or make calls to, other lists.
Warning! |
---|
|
The main configuration of stand-alone mode is specified by the following three properties of RAYLASE.SPICE3SystemConfig:
Name | Description |
---|---|
This enables/disables the stand-alone mode. Note that this setting only takes effect after the card has been rebooted. | |
The ID of the Stand-Alone List that should be automatically executed after the card has (re-)booted. Note that the stand-alone list, and any other lists which it calls, must already have been stored on the card before it is (re-)booted. Command Lists can be stored on the card by using ListAPIStore. | |
The ID of the Execute-On-Error List that should be automatically executed if an error occurs during execution of Stand-Alone List.
If set to a negative value, execution is simply stopped if an error occurs. In this case, execution of the Stand-Alone List can be resumed by:
|
Please follow 17.1 Accessing the card with the SP-ICE-3 Configuration Tool to prepare for the remaining steps.
Select the System tab.
Scroll and resize it, if necessary, so that the required items are visible.
Set the Stand-Alone Main List and Stand-Alone Error List as appropriate for your application.
Warning! |
---|
|
Click the Enable Stand-Alone Mode checkbox.
To save the altered configuration to the card's non-volatile memory, click the Upload to card button.
Besides storing the list(s) and enabling stand-alone mode, there are several other items that must be configured in order for stand-alone mode to work as expected:
Appropriate settings for ScannerConfig and LaserConfig must be stored on the card before starting stand-alone mode.
Do not forget to store the configurations on the card using the corresponding API functions (LaserAPIStoreConfig, ScannerAPIStoreConfig, etc.).
Any configuration values which have not been stored will be lost when the card is rebooted.
Suitable values for the ProcessVariables can either be stored on the card using ProcessAPIStoreVariables, or specified within the Stand-Alone List itself.
From the SP-ICE-3 Configuration Tool (SPICE3Config.exe), the various configuration and variable settings are stored automatically when they are sent to the card using Upload To Card.
Within the Stand-Alone List, the laser must be armed (using AppendArmLaser) before the first marking command.
When using an Execute-On-Error List, make sure it does not attempt to restart execution until the condition that led to the error has been cleared: otherwise an infinite loop may occur.
The following example shows how configuration of stand-alone mode can be performed by an application program.
using ( ClientAPI client = new ClientAPI( myCardIP ) ) { client.System.ResetToDefaults(); ScannerConfig sc = client.Scanner.GetConfig(); sc.FieldSize = new Utils.Point3D( 512000, 512000, 1 ); sc.Heads[0].FieldTransform = new XForm(); sc.Heads[0].TrackingError = new Utils.Point3D( 120, 120, 0 ); client.Scanner.SetConfig( sc ); client.Scanner.StoreConfig(); // Important! Config has to be stored in order to be available after a reboot of the card LaserConfig lc = client.Laser.GetConfig(); lc.PowerScale = 0.8; client.Laser.SetConfig( lc ); client.Laser.StoreConfig(); // Important! Config has to be stored in order to be available after a reboot of the card PortConfig pA = client.Gpio.GetConfig().Ports[IOPort.PortA]; pA.Directions[0] = IODirection.Input; // Set Pin 0-9 of PortA as input pA.Functions[0] = 0; // Set mapping of Pin 0 t 0 (Gpio) pA.Functions[4] = 1; // Set mapping of Pin 4 t 1 (StartMark) pA.Polarities[0] = Polarity.ActiveLow; pA.Polarities[4] = Polarity.ActiveLow; GpioConfig gpio = new GpioConfig(); gpio.Ports.Add( IOPort.PortA, pA ); client.Gpio.SetConfig( gpio ); client.Gpio.StoreConfig(); // Important! Config has to be stored in order to be available after a reboot of the card const int standAloneID = 100; const int executeOnErrorID = 300; const int otherListID = 2; // This list will be started directly after every boot of the card when stand-alone is enabled CommandList standAloneList = new CommandList(); standAloneList.AppendJumpSpeed( 5 ); standAloneList.AppendJumpDelay( 0 ); standAloneList.AppendMarkSpeed( 0.5 ); standAloneList.AppendMarkDelay( 0 ); standAloneList.AppendPolyDelay( 0 ); standAloneList.AppendJumpAbs( 0, 0 ); standAloneList.AppendProgress( 5 ); // If we connect to the card when running in stand-alone mode we can receive some progress standAloneList.AppendWaitStart(); // Wait for StartMark standAloneList.AppendArmLaser( true ); standAloneList.AppendBranchList( otherListID ); client.List.Set( standAloneID, standAloneList ); client.List.Store( standAloneID ); // Important! List has to be stored in order to be available after a reboot of the card CommandList otherList = new CommandList(); otherList.AppendLoopStart( -1 ); // Endless loop otherList.AppendJumpAbs( 0, 0 ); otherList.AppendMarkRel( 200000, 200000 ); otherList.AppendJumpRel( -200000, -200000 ); otherList.AppendMarkRel( -200000, -200000 ); otherList.AppendJumpRel( 200000, 200000 ); otherList.AppendMarkRel( 200000, -200000 ); otherList.AppendJumpRel( -200000, 200000 ); otherList.AppendMarkRel( -200000, 200000 ); otherList.AppendJumpRel( 200000, -200000 ); otherList.AppendProgress( 10 ); // If we connect to the card when running in stand-alone mode we can receive some progress otherList.AppendLoopEnd(); client.List.Set( otherListID, otherList ); client.List.Store( otherListID ); // Important! List has to be stored in order to be available after a reboot of the card // This list will be executed if an error occurres during execution CommandList executeOnErrorList = new CommandList(); executeOnErrorList.AppendLoopStart( -1 ); executeOnErrorList.AppendBranchList( standAloneID, 0x01, IOPort.PortA ); // Wait for Pin 0 of PortA to be active executeOnErrorList.AppendSleep( 1000000 ); // Sleep 1 Second executeOnErrorList.AppendLoopEnd(); client.List.Set( executeOnErrorID, executeOnErrorList ); client.List.Store( executeOnErrorID ); // Important! List has to be stored in order to be available after a reboot of the card // After all configurations have been made the stand-alone mode can be activated SystemConfig sys = client.System.GetConfig(); sys = client.System.GetConfig(); sys.StandAloneList = standAloneID; // The list to automatically start after booting the card sys.StandAloneExecuteOnErrorList = executeOnErrorID; // The list that should be executed if an error occurres during execution sys.EnableStandAloneMode = true; // Enable stand-alone mode client.System.SetConfig( sys ); client.System.StoreConfig(); // Important! Config has to be stored in order to be available after a reboot of the card }
Now the SP-ICE-3 Card is ready to be rebooted. After rebooting, the card will start executing the Stand-Alone List ( standAloneListID = 100 ).
Operation of the Execute-On-Error List can be tested by using Abort Execution on the General tab of the SP-ICE-3 Configuration Tool (SPICE3Config.exe).