A script which scans and writes data to the file
var
start =
0
;
// Starting coordinate in steps
var
step =
10
;
// Shift amount in steps
var
end =
100
;
// Ending coordinate in steps
var
speed =
300
;
// maximum movement speed in steps / second
var
accel =
100
;
// acceleration value in steps / second^2
var
decel =
100
;
// deceleration value in steps / second^2
var
delay =
100
;
var
m = get_move_settings();
// read movement settings from the controller
m.Speed = speed;
// set movement speed
m.Accel = accel;
// set acceleration
m.Decel = decel;
// set deceleration
set_move_settings(m);
// write movement settings into the controller
var
f = new_file(
"
C:/a.csv
"
);
// Choose a file name and path
f.open();
// Open a file
f.seek(
0
);
// Seek to the beginning of the file
command_move(start);
// Move to the starting position
command_wait_for_stop(delay);
// Wait until controller stops moving
while
(get_status().CurPosition < end) {
f.write( get_status().CurPo
"
,
"
+ get_chart_data().Pot +
"
,
"
+ Date.now() +
"
\n
"
);
// Get curren
t position, potentiometer value and date and write them to file
command_movr(step);
// Move to the next position
command_wait_for_stop(delay);
// Wait until controller stops moving
}
f.close();
// Close the file
A script which moves the controller through the list of positions with pauses
var
axis = new_axis(get_next_serial(
0
));
// Use first available controller
var
x;
// A helper variable, represents coordinate
var
ms;
// A helper variable, represents wait time in milliseconds
var
f = new_file(
"
./move_and_sleep.csv
"
);
// Choose a file name and path; this script uses a file from exam
ples in the installation directory
f.open();
// Open a file
while
( str = f.read(
4096
) ) {
// Read file contents string by string, assuming each string is less than 4
KiB long
var
ar = str.split(
"
,
"
);
// Split the string into substrings with comma as a separator; the result is an
array of strings
x = ar[
0
];
// Variable assignment
ms = ar[
1
];
// Variable assignment
log(
"
Moving to coordinate
"
+ x );
// Log the event
axis.command_move(x);
// Move to the position
axis.command_wait_for_stop(
100
);
// Wait until the movement is complete
log(
"
Waiting for
"
+ ms +
"
ms
"
);
// Log the event
msleep(ms);
// Wait for the specified amount of time
}
log (
"
The end.
"
);
f.close();
// Close the file
- a sample file for use with the above example
A script which enumerates all available axes and gets their coordinates
var
i =
0
;
// Declare loop iteration variable
var
serial =
0
;
// Declare serial number variable
var
axes = Array();
// Declare axes array
while
(
true
) {
// The loop
serial = get_next_serial(serial);
// Get next serial
if
(serial ==
0
)
// If there are no more controllers then...
break
;
// ...break out of the loop
var
a =
new
Object();
// Create an object
a.serial = serial;
// Assign serial number to its "serial" property
a.handle = new_axis(serial);
// Assign new axis object to its "handle" property
axes[i] = a;
// Add it to the array
i++;
// Increment counter
}
for
(
var
k=
0
; k < axes.length; k++) {
// Iterate through array elements
log (
"
Axis with S/N
"
+ axes[k].
"
is in position
"
+ axes[k].handle.get_status().CurPosition );
// For each element print saved axis serial and call a get_status() function
}
Page 272 / 345
Page 272 / 345
Summary of Contents for 8SMC5-USB
Page 30: ...Linux Page 30 345 Page 30 345 ...
Page 83: ...Connection of magnetic brake to one axis or two axis systems Page 83 345 Page 83 345 ...
Page 87: ...Scheme of buttons connection to the HDB 26 connector Page 87 345 Page 87 345 ...
Page 99: ...Page 99 345 Page 99 345 ...
Page 167: ...Vertical load capacity the maximum vertical load on the stage Page 167 345 Page 167 345 ...
Page 186: ...Click Next Click Continue anyway Page 186 345 Page 186 345 ...
Page 188: ...Page 188 345 Page 188 345 ...
Page 190: ...Page 190 345 Page 190 345 ...
Page 193: ...Page 193 345 Page 193 345 ...
Page 201: ...Select the XILab application in the Programs block Start it Page 201 345 Page 201 345 ...
Page 274: ...7 Files 1 Configuration files 2 Software Page 274 345 Page 274 345 ...
Page 331: ...Motorized Iris Diaphragms 8MID98 Motorized Iris Diaphragm Page 331 345 Page 331 345 ...
Page 338: ...8 Related products 1 Ethernet adapter Page 338 345 Page 338 345 ...
Page 339: ...8 1 Control via Ethernet 1 Overview 2 Administration Page 339 345 Page 339 345 ...