CAD CAM EDM DRO - Yahoo Group Archive

Re: EMC: delay fucntion in TCL/TK ?

Posted by Asim Khan
on 2003-11-16 07:20:27 UTC
Ray, Thanks for help!
Yes i am editing the the tkio.tcl file. I want to implement tool
changer in a machining center. I would like to just signal out the
tool changer information via single bit. I am doing this using some of
the unused/free input and output bits of the printer port
The external 8051 compatible controller will handle the actual
tool changer task. the EMC will only signal this external controller
via single bit. Another input on lpt will be used for EMC to get the
status that the tool has successfully changed and now it can go
further to execute next command block.
The protocol i have roughly designed is as follows:
Protocol:
1. Machine axes go to home or tool changer location
2. EMC Sends 1 second low pulse
3. Toggle the output for specified number of tool number times
4. EMC waits for input low signal from external controller that tool
has been successfully changed
5. If external controller fails to load tool it activates the
Emergency stop signal.

i've started writing code for the tool change in tkio. but at one
place i needed to generate some delays. I dont need these delays to be
very precise.
and i'll always look forward for your help whenever i get in trouble
lets hope i get this all succesfully done!! ! !
thanks and best regards
Asim


--- In CAD_CAM_EDM_DRO@yahoogroups.com, Ray Henry <rehenry@u...>
wrote:
>
> 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:
> > Message: 22
> > Date: Sat, 15 Nov 2003 04:58:13 -0000
> > From: "Asim Khan" <asimtec@y...>
> > 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 ?