PhyScript™ Integrated Laser Control Operating System
An integrated laser lithography control system developed by the Nanomaterials Research Lab, NUS
Author: Chen Guoyi, Sun Yudong, Wu Mingsong, Lan Ziying Principal Investigators: Sharon Xiaodai Lim, Sow Chorng Haur DOI: 10.5281/zenodo.13119830
This open-sourced project is sponsored by the NUS Department of Physics.
Chapter 3: .lcs Coding Standards
The Laser Control Script (.lcs) is a specialized programming language designed for the High-Precision Vector Laser Control System. It is used to control nanometer-level precision in laser lithography processes, supporting various programming methods including mathematical functions and iterations, to achieve vector control of nanometer-level laser processes. The .lcs language is a C-like language. To enhance the safety and real-time performance of laser control, the .lcs language implements isolation from the control unit at the escape and compilation level, shielding unsafe features of the C language architecture. Therefore, the .lcs language syntax differs from that of C. This article will introduce the syntax and coding standards of the .lcs language and provide tutorial examples for researchers to learn and use.
1. Functions
The .lcs supports the following predefined functions, with arg* indicating the parameter types and formats supported by the function. By default, arg* supports its annotated data types and can also convert the expressions or functions contained into high-precision numeric values for further computation. However, there are restrictions on function nesting: parentheses can be nested for operator parentheses and angle-bracket functions, but cannot be nested for function identifier parentheses. Angle brackets can only be nested for operator parentheses.
Important Note: In .lcs, operations can only occur within the parameters of a function. The script will only evaluate expressions contained within the parameters.
1.1 Laser Power Control Function
The laser() function is used to control the laser power and switch.
laser (arg0)
└─ unsigned_char (0~255)
The actual power of the laser has a linear relationship with the parameter arg0. When arg0 is 0, the laser is off; when arg0 is between 1 and 255, the actual laser power changes linearly within the theoretical power range of the laser.
1.2 Relative Motion Control Function
The mv() function controls the laser to move to the coordinate position using the current position as the reference origin.
arg1: The x-coordinate position using the current position as the reference origin; arg2: The y-coordinate position using the current position as the reference origin;
The laser is controlled to move from the current position, traveling arg1 distance on the x-axis and arg2 distance on the y-axis.
1.3 Absolute Motion Control Function
The mvAbs() function controls the laser to move to the coordinate position in the global reference frame.
arg1: x-coordinate in the global reference frame; arg2: y-coordinate in the global reference frame;
The laser is controlled to move to the position in the global reference frame.
1.4 Trigonometric Functions
Predefined high-precision trigonometric functions for real-time numerical stability in trigonometric calculations.
sin
<arg0>
Sine function
cos
<arg0>
Cosine function
tan
<arg0>
Tangent function
csc
<arg0>
Cosecant function
sec
<arg0>
Secant function
cot
<arg0>
Cotangent function
asn
<arg0>
Arcsine function
acs
<arg0>
Arccosine function
atn
<arg0>
Arctangent function
2. Variables and Iteration
The .lcs supports the following five predefined variables: j, k, x, y, z. Variables can only be declared at the start of the iteration, and their lifecycle must match the scope of the iteration. Therefore, the maximum level of nested iterations supported by .lcs is 5. The syntax for iteration is:
var = param0 ~ param1BEGIN
...
END
Here, var is a variable declared for the current iteration, and param* are the upper and lower bounds of the iteration, which must be integers. If the upper limit of the iteration is less than the lower limit, the variable value decreases by 1 with each step; otherwise, it increases by 1. The BEGIN and END markers denote the start and end of the iteration, and must be used in pairs. If a variable exits the scope of its iteration, the defined variable var becomes 0.
Here are some quizzes for you to self-test your .lcs knowledge!
Quizzes
Quiz 1: Complex Function Nesting
x = 0 ~ 5 BEGIN mv(cos<1 + x>, sin<2 + x * pi>) END
Question: Does this code conform to the .lcs syntax?
Quiz 2: Variable Lifecycle and Scope
x = 0 ~ 5 BEGIN y = 0 ~ 10 BEGIN mv(x, y) END END
Question: Does this code conform to the .lcs syntax?
Quiz 3: Incorrect Iteration Parameter Types
j = 0.5 ~ 5 BEGIN laser(j) END
Question: Does this code conform to the .lcs syntax?
Quiz 4: Function Identifier Nesting Restriction
mv(cos<tan<arg0>>, sin<arg0>)
Question: Does this code conform to the .lcs syntax?
Quiz 5: Correct Trigonometric Function Syntax
laser(asn<arg0>)
Question: Does this code conform to the .lcs syntax?
Quiz 6: Variable Redefinition
k = 1 ~ 3 BEGIN k = 5 ~ 10 BEGIN mv(k, k) END END
Question: Does this code conform to the .lcs syntax?