Re: EMC: delay fucntion in TCL/TK ?
Posted by
Ray Henry
on 2003-11-15 09:03:40 UTC
Hi Asim
I'm guessing here that you are working with emcio but using one of the GUI
or script files. The file emcio is written in C++ and I havn't a clue
how to put a timing loop in one of those. In Tickle you would most
likely use the following form of the after command
"after ms ?script script script ...?
In this form the command returns immediately, but it arranges for a Tcl
command to be executed ms milliseconds later as an event handler. The
command will be executed exactly once, at the given time. The delayed
command is formed by concatenating all the script arguments in the same
fashion as the concat command. The command will be executed at global
level (outside the context of any Tcl procedure). If an error occurs
while executing the delayed command then the bgerror mechanism is used to
report the error. The after command returns an identifier that can be
used to cancel the delayed command using after cancel. " (Taken from a
page on the activestate website)
There are loops in all of the GUIs and many of the scripts. These tend to
take the form
proc updateloop () (
global triggervariable
if {$triggervariable == 1} {
set triggervariable 0
} else {
set triggervariable 1
}
after 1 updateloop
}
This would make a square wave signal at triggervariable. This is pretty
sloppy coding but it will work for you. If you were using iosh and emcio
you would be able to directly flip flop a parport pin.
There are several cautions when using something like this. If the guts of
the process take longer than the after value you will dig a hole it will
not come out of. After is not a precise timing function, at least not
like the real-time stuff.
Good luck. Contact me off list if you wish more info.
Ray
On Friday 14 November 2003 11:34 pm, CAD_CAM_EDM_DRO@yahoogroups.com
wrote:
I'm guessing here that you are working with emcio but using one of the GUI
or script files. The file emcio is written in C++ and I havn't a clue
how to put a timing loop in one of those. In Tickle you would most
likely use the following form of the after command
"after ms ?script script script ...?
In this form the command returns immediately, but it arranges for a Tcl
command to be executed ms milliseconds later as an event handler. The
command will be executed exactly once, at the given time. The delayed
command is formed by concatenating all the script arguments in the same
fashion as the concat command. The command will be executed at global
level (outside the context of any Tcl procedure). If an error occurs
while executing the delayed command then the bgerror mechanism is used to
report the error. The after command returns an identifier that can be
used to cancel the delayed command using after cancel. " (Taken from a
page on the activestate website)
There are loops in all of the GUIs and many of the scripts. These tend to
take the form
proc updateloop () (
global triggervariable
if {$triggervariable == 1} {
set triggervariable 0
} else {
set triggervariable 1
}
after 1 updateloop
}
This would make a square wave signal at triggervariable. This is pretty
sloppy coding but it will work for you. If you were using iosh and emcio
you would be able to directly flip flop a parport pin.
There are several cautions when using something like this. If the guts of
the process take longer than the after value you will dig a hole it will
not come out of. After is not a precise timing function, at least not
like the real-time stuff.
Good luck. Contact me off list if you wish more info.
Ray
On Friday 14 November 2003 11:34 pm, CAD_CAM_EDM_DRO@yahoogroups.com
wrote:
> Message: 22
> Date: Sat, 15 Nov 2003 04:58:13 -0000
> From: "Asim Khan" <asimtec@...>
> Subject: EMC: delay fucntion in TCL/TK ?
>
> Hi group!
> I am editing emcio source code written in tcl/tk. i want to produce
> delays in milli second. please tell me how to do this in tcl/tk?
> regards
> asim
Discussion Thread
Asim Khan
2003-11-14 20:58:16 UTC
EMC: delay fucntion in TCL/TK ?
Ray Henry
2003-11-15 09:03:40 UTC
Re: EMC: delay fucntion in TCL/TK ?
Asim Khan
2003-11-16 07:20:27 UTC
Re: EMC: delay fucntion in TCL/TK ?