Laser Control Interface

User Manual



Contents
1. Introduction
2. The Hardware Interface
3. Operation
4. Computer Interface
4.1 Function Reference
4.1.1 Int Lcisetcomport (Int  Nport )
4.1.2 Int Lcisetslaveid ( Int Nid )
4.1.3 Int Lcitimeout ( Int  Ntimeout )
4.1.4 Int Lciinit ( Void )
4.1.5 Int Lcisetparameter ( Int Npar, Int Nparval )
4.1.6 Int Lcireadparameter( Int Npar , Int *Pnparval)
4.1.7 Int Lcitrigger(Void)
4.1.8 Int Lcistartauto( Void)
4.1.9 Int Lcistopauto(Void)
4.1.10 Int  Lcireadinputs(Char *Cinputs)
4.1.11 Int  Lcireadoutputs(Char *Coutputs)
4.1.12 Int  Lcisetoutputs(Char Coutputs)


Introduction

The use of  remote, intelligent input/output modules for data acquisition with computers is common and the REMIO, remote I/O module from IDAPL is one such.  Coupled with the REMIOLIB software drivers on the PC the REMIO module can provide a large number of input and output points at physically different locations from a PC.  The concept has been extended and customised for various applications like computerised paging services in a process plant, extension of I/Os on CNC machines, etc.  To aid ease of driver development for such special applications, the library has been developed in two layers - one layer for basic communication handling and one for application specific commands.

This documentation describes the hardware and software features of REMIO customised for laser control application, acting as an interface between a computer and the remote control unit (RCU) of a C02 Laser (DIAMOND series) manufactured by M/s Coherent Laser Group, California. This unit will be referred as the Laser Control Interface (LCI).

Optionally, the LCI may be used directly with the DDI control board of the Diamond Series RF supplies.


The Hardware Interface

The standard RCU provided by Coherent, offers the following hardware interface to an external agent:

1. Modulation Gate Input
2. External Pulse Input
3. Shutter Remote Input

Additionally, it provides feedback as to the status of shutter, modulation ON or OFF etc.

All the inputs and outputs from the RCU are connected to the LCI through the 15 pin connector at the back of the RCU.

The RCU may be operated from an external controller in one of the two fashions:

1. The RCU may be configured to generate the laser pulsing signals by setting the pulse width and pulse period  and through the modulation gate input, the external controller may stop or allow the pulses to be passed on to the laser unit.  However, in this case, synchronisation between the pulse pattern generation and gating is not achievable.  Hence, precise control will be difficult.  Moreover, while gating will be from one controller, pulse control will be from the RCU.

2. The RCU may be configured to take an analog input for timing and the above gating method may be used for ON/OFF control of the laser.

3. The EXTPULSE input may be used to directly feed pulse patterns.  Additionally, the modulation gate can be used for ON/OFF.

Of these, the LCI provides control from method 1 and 3 above.  They will be called as MODE 0 and MODE 1 respectively i.e., MODE 0 is one in which only gating control is done and MODE 1 is the one in which external pulse generation takes place.



Operation

The LCI can be programmed from a PC and operated to trigger the laser either from the PC or through a dedicated trigger input.  In either case, the output pulses depend upon the programmed mode of operation.

In MODE 0, the LCI manipulates the Modulation gate of the RCU.  Pulse shape is generated by the RCU and is settable from the RCU’s front panel thumb wheels. This mode is ideal for generating simple pulse sequences for continuous operation like cutting.  Power control will be coarse, since the timing of the gating and generation of pulses are not synchronised.

Alternatively, in MODE 1, the timing is supplied by the LCI itself.  In this mode, the modulation gate is permanently pulled ON.  Laser firing is controlled by the EXTPULSE input.  The LCI allows setting of pulse period and pulse width through the serial port.  In this mode, the user may set-up upto 100 sequence of pulses,  each defined by the pulse width and pulse period. Upon receipt of trigger, the LCI generates the specified pulses and controls laser output power.

In this mode, the LCI allows setting up a parameter for number of pulses and precisely this number of programmed sequences are sent to the RCU.  This can be explained below (for programming refer to Section 4.2):

Assume that the one wants the pulse sequence as follows:

Pulse # Pulse Width (mS) Pulse Period (mS)
1 60 3000
2 80 2000
3 100 1800
4 80 2000
5 60 3000

and if the user requires, say, 20 pulses of this pattern for every trigger, then the programmer sets up the parameters of the LCI as follows:

Parameter #2  (Number of sequences)   5
Parameter #3  (Number of pulse sequences per trigger)  20
Parameter #10 (first sequence, pulse width)  60
Parameter #11 (first sequence, pulse period) 3000
Parameter #12 (first sequence, pulse width)  80
Parameter #13 (first sequence, pulse period) 2000
Parameter #14 (first sequence, pulse width)  100
Parameter #15 (first sequence, pulse period) 1800
Parameter #16 (first sequence, pulse width)  80
Parameter #17 (first sequence, pulse period) 2000
Parameter #18 (first sequence, pulse width)  60
Parameter #19 (first sequence, pulse period) 3000

When the parameters are set-up as above, the LCI generates the required pulses each time it is triggered.

The source of trigger input to the LCI may be either a message from the PC via the serial link or an input.  The LCIStartAuto(...) function is used for this purpose. By default, the LCI ignores the input and generates pulses on receipt of the LCITrigger(...) command. After this command has been sent, the LCI responds both to the external input.  This input signal should be at least 1 mS long.  The LCI does not provide any feedback regarding the generation of pulses.  This mode is called the Auto mode and is ideal for systems supervised by a Computer but operated by an external controller.

All the interfaces to the RCU are at TTL levels.  However, optional high current outputs are provided which may then be used directly with the DDI interface bypassing the RCU.  In this case, however, the external controller should provide the interlocking requirements. Specify while ordering, if this option is required.

Additional to the laser control, the LCI offers several inputs and outputs as given below:

· 9 optically isolated Inputs , numbered #0 to #8
· 12 TTL inputs, numbered #9 to #20
· 8 Outputs - these are Open Collector NPN outputs are may be used to trigger opto inputs of interfacing systems.

Of these inputs, input #0 is used for externally triggering the LCI. Some inputs are used to monitor the status of the RCU like shutter open, modulation enable etc.  Other inputs are free for use by the CNC as remote inputs.

Four outputs are reserved for interfacing to the RCU.  These are for modulation gate, remote modulation, external pulse and shutter control.  The first three are not controllable from the Computer.  All the others may be set or reset from the computer through LCISetOutputs(...) and may be used as remote outputs by the CNC.


Computer Interface

The LCI is connected to a computer through a RS-485 serial link at 9.6K baud. Additionally, it also offers a trigger input to which the laser interface responds by providing programmed pulses to the RCU.  This may be used in a supervisor structure, where, a PC is used to program the required pulse profile and other CNC controllers used to trigger the LCI.

On the computer, LCILIB a set of functions callable from C or C++ is provided for program development.  The LCILIB consists of the following files:

LCILIB.OBJ
LCILIB.H

The include file contains all the necessary declarations and function prototypes.  The library is linkable to any C program compiled in the LARGE or HUGE memory models.  In case C++, it is required to override the declarations with C language specifications.  Refer to the C++ language reference for details as to how to link to C functions.

4.1 Function Reference

Following pages list the various functions of the LCILIB.

4.1.1 int LCISetComPort (int  nPort )

This  function informs other routines in LCILIB  of the communication port which is to which the LCI is connected. This routine does not, however, initialise the serial port parameters.  The port is initialised only when IMCStepInit(...) is called.  Do not use this routine after LCIInit(...) has been called as this may lead to improper communications.

Call with :
                    nPort  :  Serial port used (0 for COM1 and 1       for COM2)

Return Value :
                     0      Always

The COM1 port is used by default.

Example :

     status = LCISetComPort(0)  /** Sets COM1 **/

     status = LCISetComPort(1)  /** Sets COM2 **/

4.1.2 int LCISetSlaveId ( int nId )

This routine assigns the ID number connected to the LCI. This routine is to be used when the unit is to participate in the RS485 line like the IMC-01, INT01 series of intelligent controllers and drives. Also, multiple LCI’s may coexist in the RS485.

Ids are assigned during production at factory.  A sticker is applied at the back of the control unit indicating its ID value. Default ID is 4. ID configuration should be specified while ordering, if required.  This routine should be called even if no other device is connected on the bus.

Call with

  nId  :        ID number set on the Unit

Return Value :

  0      Always

4.1.3 int LCITimeOut ( int  nTimeout )

In case of malfunctioning of the communication link or the slave, the slave unit may not transmit any return messages.  In such a condition, the host computer will permanently  wait for a return message.  To avoid this situation a programmable time-out has been provided through this function.  Any LCILIB routine will wait for nTimeout milliseconds before returning or retrying.  This routine also calibrates the delay loops inside the library with respect to the PC speed to avoid problems of portability to faster or slower machines.  The routine takes about 2 seconds (depending upon your PC speed) to return and hence should be used only once in the beginning of the application programme before calling LCIInit().  In case IMCLIB or SERLIB are also to be linked, only one time-out set-up is required.

Call with

       nTimeout     :     Time out in milli seconds.

Return Value
     0      Always
 

Default value of  time-out is  5 milliseconds, which will be sufficient for a IBM-PC-386 running at 16 Mhz.  For a 486 at 30 Mhz, a value of 10 mS would be more appropriate.

Setting a time-out of 0 will result in a no time-out situation - the PC will wait forever for a return message if one is expected.

Example : To set a time-out  of 50 milliseconds

     LCISetTimeOut( 50 ) ;   /** sets 50 ms time-out **/

4.1.4 int LCIInit ( void )

This function initialises the internal data structures of the library, initialises the communication port etc.

Call with:
  No parameters

Return value

                0      always successful

This routine is generally called once in the beginning of the program.  However, it may be called any number of times without causing major problems to the program. No example has been given for this routine, as it is self explanatory.

4.1.5 int LCISetParameter ( int nPar, int nParVal )

The LCI contains 8KB of E2PROM for parameter storage.  Some parameters are reserved for specific purposes.  These are:

Parameter 0 is reserved for setting the mode of operation - MODE 0 or MODE 1 described in Section 2 above.
Parameter 1 is reserved for setting the trigger time, in case MODE 0.  Setting this time 0 will make the output trigger permanently high till stopped by a call to LCIStopAuto(...).
Parameter 2 is reserved for setting the number of sequences in a single trigger cycle.
Parameter 3 is reserved for setting the number of pulses to be provided in MODE 1 triggering.
Parameter 10 to 210 are reserved for setting the sequence of pulse widths and pulse periods in MODE 1.  This provides 100 different pulses of varying widths and periods to be programmed in a single compound pulse sequence.  This sequence may be repeated the number of times specified in Parameter 3. (Refer to discussion in Section 2 above for detailed description of operation).

These parameters are settable from the computer through the LCISetParameter(...) routine.

Call with:
  nPar  :  The parameter number to be set
  nParVal :  The value of the parameter
     For timings, this value is in microseconds

Return value

  0  No Response
  1  Successful
  2  Slave present, but in Communication

Note:

1. The return value should be always checked for successful transmission of parameter.  If the message was not transmitter successfully, then the message should be sent again.
2. There must be a waiting period of at least 50 times the normal time-out specified before the next message is sent. This time is required, as the parameter values are written to the slow E2PROM.
3. To ensure proper setting of parameters, the parameter value should be read and verified using LCIReadParameter(...).

Example: To set the number of pulses to 5, the following piece of code may be used:

 #define NPULSEPAR  3

 int i1 ;
 extern nTimeOut ;

 while (1)
 {
  i1 = LCISetParameter(NPULSEPAR,5) ;
  if (i1 == 1)
   break ;
  /** Communication failed, try again after some time **/
  MyDelay(nTimeOut) ;
  }
 /** following delay required before attempting comm. to that
  slave again **/
 MyDelay(50*nTimeOut) ;

4.1.6 int LCIReadParameter( int nPar , int *pnParVal)

This function is used to read the parameter values.  The parameter values are stored in the non volatile memory of the LCI.  The user program on the PC may update its own values by using this function to read from the LCI.

Call with:
  nPar  :  The parameter number to be set
  *pnParVal :  Pointer to an integer in which the parameter value      is returned.

Return value

  0  No Response
  1  Successful
  2  Slave present, but in Communication

Note:

1. The return value should be always checked before the returned parameter value is used.

Example: To continue the example for the previous function, if after setting the parameter, one wants to read back and check, then:

 #define NPULSEPAR  3

 int i1 ;
 extern nTimeOut ;
 int nPulses,nDummy ;

 while (1)
 {
  i1 = LCISetParameter(NPULSEPAR,5) ;
  if (i1 == 1)
   break ;
  /** Communication failed, try again after some time **/
  MyDelay(nTimeOut) ;
  }
 /** following delay required before attempting comm. to that
  slave again **/
 MyDelay(50*nTimeOut) ;

 /** Now reading back **/

 while (1)
 {
  i1 = LCIReadParameter(NPULSEPAR,&nDummy) ;
  if (i1 == 1)
   break ;
  /** Communication failed, try again after some time **/
  MyDelay(nTimeOut) ;
  }
 nPulse = nDummy ;
 /** following delay required before attempting comm. to that
  slave again **/
 MyDelay(50*nTimeOut) ;

4.1.7 int LCITrigger(void)

This function commands the LCI to go through a trigger cycle as set by the mode, pulse pattern and number of pulses.

Call with:
  None

Return value

  0  No Response
  1  Successful
  2  Slave present, but in Communication

Note:  During the period taken to complete the pulse sequences and number of sequences programmed, the LCI will not respond to any PC messages or to any of the inputs.  Hence, if the pulse duration is long, then it is advisable to trigger using the auto mode.  For this purpose, any of the free outputs of the LCI may be looped back to the trigger input.  This output may then be operated from the computer.

4.1.8 int LCIStartAuto( void)
4.1.9 int LCIStopAuto(void)

The LCI may be made to respond to the specified input for control from external CNCs using this command.  After this command has been sent, the LCI may be triggered with the input, rather than from the serial port.  The LCIStopAuto(...) is used to bring the LCI back to serial triggered mode.  The pulse train output will depend upon the parameters values set.

Note, however, that it is not possible to set, read or modify parameters while the LCI is set in the auto mode.  However, the inputs/outputs may be operated even while in this mode.

Call with:
  None

Return value

  0  No Response
  1  Successful
  2  Slave present, but in Communication

Example: To set the LCI in the auto mode:
 

 extern nTimeOut ;

 while (1)
 {
  i1 = LCIStartAuto() ;
  if (i1 == 1)
   break ;
  /** Communication failed, try again after some time **/
  MyDelay(nTimeOut) ;
  }
 /** following delay required before attempting comm. to that
  slave again **/
 MyDelay(50*nTimeOut) ;

 /** After all operations are over **/
 while (1)
 {
  i1 = LCIStopAuto() ;
  if (i1 == 1)
   break ;
  /** Communication failed, try again after some time **/
  MyDelay(nTimeOut) ;
  }

4.1.10 int  LCIReadInputs(char *cInputs)

The LCI offers inputs which may be read using this function.

Call with
       *cInputs  : Pointer to an array of 3 characters

Return Value

   0  No Response
  1  Successful
  2  Slave present, but in Communication

Note:

1. The return value should be always checked before the returned input statuses is used.

Example: To read the inputs:

 extern nTimeOut ;
 char cInStat[3] ;

 while (1)
 {
  i1 = LCIReadInputs(cInStat) ;
  if (i1 == 1)
   break ;
  /** Communication failed, try again after some time **/
  MyDelay(nTimeOut) ;
  }

4.1.11 int  LCIReadOutputs(char *cOutputs)

The LCI offers outputs whose status may be read using this function.

Call with
       *cOutputs  : Pointer to a character/byte

Return Value

  0    No Response
  1  Successful
  2  Slave present, but in Communication

Note:

1. The return value should be always checked before the  cOutput value is used.

Example: To read the current state of the outputs:

 extern nTimeOut ;
 char cOutStat ;

 while (1)
 {
  i1 = LCIReadOutputs(&cOutStat) ;
  if (i1 == 1)
   break ;
  /** Communication failed, try again after some time **/
  MyDelay(nTimeOut) ;
  }

4.1.12 int  LCISetOutputs(char cOutputs)

The LCI offers outputs whose status may be set or reset with this function.  Note that outputs cannot be set individually - all are set or reset together, i.e. after this function call, the output status would be cOutput irrespective of the earlier status.  Therefore, it is advisable to use LCIReadOutputs(...) to read the outputs, change whatever bits as required and then call LCISetOutputs.

Call with
       cOutputs  : Byte to be output

Return Value

  0  No Response
  1  Successful
  2  Slave present, but in Communication

Example: To set output #7 to 1, the following may be used (assuming prior status of outputs are now known):

 extern nTimeOut ;
 char cOutStat ;

 while (1)
 {
  i1 = LCIReadOutputs(&cOutStat) ;
  if (i1 == 1)
   break ;
  /** Communication failed, try again after some time **/
  MyDelay(nTimeOut) ;
  }
 cOutStat = cOutStat | 0x80 ;
 LCISetOutputs(cOutStat) ;