
RTC
®
5 PC Interface Board
Rev. 1.9 e
7 Basic Functions for Scan Head and Laser Control
97
innovators for industry
7.1.4 Example Code
The following example C source code shows the
commands of a simple laser scan application:
A point, a square and a circle are marked in CO
2
mode. Here it is assumed that the RTC
®
4 compati-
bility mode is activated.
The code must be included in a user program (see
// Scan system initialization:
// Loading and assigning a correction file
ErrorCode = load_correction_file( 0,
// initialize like "D2_1to1.ct5",
1,
// table (#1 is used by default)
2 );
// use 2D only
if ( ErrorCode )
{
printf( "Correction file loading error: %d\n", ErrorCode );
free_rtc5_dll();
return;
}
select_cor_table( 1, 0 ); // assigning table #1 to the primary scan head connector (default)
// Laser control initialization (see
):
// Setting the CO
2
laser mode
set_laser_mode( 0 );
// Setting and enabling the “laser active” laser control signals
set_laser_control( 0x18 ); // All laser signals LOW active (Bit #3 and #4)
// This command must be called at least once to activate laser signals. Later on
would be
//sufficient.
//
The following are list commands
//
Opens List 1
set_start_list( 1 );
// Setting the standby pulses
set_standby( 800, 8 );
// In RTC
®
4 compatibility mode the standby parameters are specified in units of 1/8
µ
s as with the RTC
®
4 and the
// RTC
®
5 multiplies the specified values by 8 to convert in integer-multiple of 1/64
µ
s.
// Half of the standby output period = 100
µ
s
// Pulse length of the standby pulses = 1
µ
s
// Timing, delay and speed preset
// Setting the scanner delays (see
set_scanner_delays( 25, 10, 5 );
// Jump delay = 250
µ
s (specified in [10
µ
s])
// Mark delay = 100
µ
s (specified in [10
µ
s])
// Polygon delay = 50
µ
s (specified in [10
µ
s])
// Setting the jump and marking speed:
set_jump_speed( 1000.0 );
set_mark_speed( 250.0 );
// In RTC
®
4 compatibility mode the speed values are specified as with the RTC
®
4 and the RTC
®
5 multiplies the specified
// values by 16.
// Jump speed = 1000.0 bits/ms
// Marking speed = 250.0 bits/ms
// Setting the laser timing (see
set_laser_pulses( 800, 400 );
// In RTC
®
4 compatibility mode the timing parameters are specified in units of 1/8
µ
s as with the RTC
®
4 and the RTC
®
5
// multiplies the specified values by 8 to convert in integer-multiple of 1/64
µ
s.
// Laser HalfPeriod = 100
µ
s
// Laser PulseLength = 50
µ
s
// Setting the laser delays (see
set_laser_delays( 100, 100 );
// In RTC
®
4 compatibility mode the laser delays are specified in units of 1
µ
s as with the RTC
®
4 and the RTC
®
5
// multiplies the specified values by 2 to convert in integer-multiple of 0.5
µ
s.
// LaserOn delay = 100
µ
s
// LaserOff delay = 100
µ
s