if I wanted to add a speed dro that read the spindle freq say 2 times / sec , are there any 'timers' or such available to schedule calls to dro update function
// Library SystemCallBacks
// Created Thursday, December 31, 2015
// Author Art -- Do not edit above this line
// Enter Global vars below this line.
// This script will be called
//whenever the system is going from
//Enabled to Disable. It is called after the
// system shuts down motion.
global OnDisable = function()
{
myser.Close(); // shut vfd port
print( "--System -- System Disabled.");
//shut off any spindle since I use one..
if( lookup("SpindleOff")) { SpindleOff(); };
//shut down any other Estop process here..
};
//This script is called whenever
//the system is going from disabled to
//enabled. It is called before removing Estop
//conditions.
global OnEnable = function()
{
Vfd_Open(); // open vfd port
print( "--System -- System enabling.");
};
//This script is called whenever
//the user presses RUN if the run was allowed
global OnRun = function()
{
print( "--System -- System about to run.");
};
//This script is called whenever
//the user zeroes an axis, axis is a bitfield
//value, bit 1 is axis 1, bit 2 is axis 2....
//do not change the zero here, that would
//cause an infinite loop
global OnZero = function( axis )
{
print( "--System -- User has zeroed an axis" );
};
//This script is called whenever
//the user homes an axis, axis is a bitfield
//value, bit 1 is axis 1, bit 2 is axis 2....
//called after homing and zeroing
global OnHome = function( axis )
{
print( "--System -- User has homed an axis" );
};
//This script is called whenever
//the user regens the toolpath
global OnRegen = function()
{
print( "--System -- User has Regened the toolpath.");
};
//This script is called whenever
//the Scripting system has reset and
// reloaded all scripts. You may do additional
// startup tasks here.
global OnAllScriptsLoaded = function()
{
print( "--System -- System has reset Scripting system.");
};
Well, when it comes to timers theres a couple of ways. Sleep releases the thread and uses no system resources, the thread
goes to sleep until the time set. So sleep(1); will return to the program and things run until at least 1 second has gone by, and it returns.
will run forever..updateing a dro every second.
if its a dro with motion, you can use blocks.
block("MotionUpdate"); is the same as saying sleep until an axis moves..but will be periodically called
every few seconds I believe even if axis dont move..just to keep things in sync.
or you can use your own blocks.
block("MyUpdate"); will put a script to sleep until some other script calls
signal("MyUpdate");
The combination of those two techniques handle almost any timing requirement..other than
reading time. I think theres a tick command in there.. Ill have to check..
first try at getting some data back from vfd ,although the the vfd accepts the cmd and replies accordingly
myser.ReadData( 8 ) returns nothing :-\
[the vfd takes at least 8mS to reply] see pic for cmd and response
I think, just as sending text is kinda special, so too is the difference between recieving text, and receiving data.
Ill change the code so that the myser.Table returns the data , itd be much easier to access.