<< Click to Display Table of Contents > 

Scanner Card Interface > Example Code > Initialization

Initialization
Previous pageReturn to chapter overviewNext page

The initialization of the system for a CO2 laser may look like this:

First, define necessary interface variables. Their data types are provided by the Scanner Card Interface:

ScOpticModule2D        m_optic_module;
long                device_mode, device_flags;
 

Specify the full path to the correction file:

m_optic_module.ScSetDevicePath(ScapsSamOpticModule2D.ScComStandardDevicePathConstants.scComStandardDeviceIDCorrectionFilePath0,"C:\installdir\usc1\cor_neutral.ucf");
 

Initialize the device itself:

m_optic_modlue.ScInitControl();
 

Set values for available field, working area, offset and gain and enable the scan head:

m_optic_module.ScSetField(-32768,-32768,32767,32767);
m_optic_module.ScSetWorkingArea(-32768,-32768,32767,32767);
m_optic_module.ScSetOffset(0,0);
m_optic_module.ScSetGain(1,1);
 
m_optic_module.ScSetEnableHead(1);

 

The device mode flags can be used to adjust several device-specific settings according to the desired mode. To do that the current flags are retrieved, unwanted flags are unset, desired flags are set and the complete flag set is sent back to the device interface.

This example disables simulation mode, disables the output window and sets the laser type to CO2.

device_mode = m_optic_module.ScGetDeviceOperationMode();
device_mode = device_mode & ~scComStandardDeviceOperationModeSimulation;
device_mode = device_mode | scComStandardDeviceOperationModeHideOutputWindow;
 
device_mode = device_mode & ~scComStandardDeviceOperationModeIdCO2;
device_mode = device_mode & ~scComStandardDeviceOperationModeIdLEE;
device_mode = device_mode & ~scComStandardDeviceOperationModeIdYAG;
device_mode = device_mode | scComStandardDeviceOperationModeIdCO2;

 
m_optic_module.ScSetDeviceOperationMode(device_mode);

 

The same principle can be used with the device enable flags - this enables the standby pulse for CO2 mode:

device_flags = m_optic_module.ScGetDeviceEnableFlags(scComStandardDeviceEnableFlagGroupStyle);

device_flags = device_flags | scComStandardDeviceStyleFlagEnableCO2List;

m_optic_module.ScSetDeviceEnableFlags(scComStandardDeviceEnableFlagGroupStyle, device_flags);

 

Several timing-specific values are set to change the laser's operation power and its stand by power. The frequency the laser is operating with results from the length of half a period in unit microseconds (frequency = 2 / halfperiod). The power results out of the pulse-pause-ratio that is defined by the laser length (in microseconds) in proportion to the half period. All these settings can also be changed after marking has started too, they would then influence all further marking commands.

m_optic_module.ScSetDeviceTimer(scComStandardDeviceStyleIDHalfPeriodCO2,10);

m_optic_module.ScSetDeviceTimer(scComStandardDeviceStyleIDLaser1Length,5);

m_optic_module.ScSetDeviceTimer(scComStandardDeviceIDHalfPeriodStandBy,100);

m_optic_module.ScSetDeviceTimer(scComStandardDeviceIDStandByPulse,10);

 

Afterwards the Scanner Card device should be set to a defined state with the laser turned off and marking disabled.

m_optic_module.ScExecute = 0;

m_optic_module.ScMoveLaserState = 0;