Hello Erich,

Thank you for your email.

The example I posted was the simplest I could think of that would
illustrate the what I was trying to achieve - the redirection of EMIT
within a task. What I actually have is various sensors attached to an
AVR. Rather than poll each of them in a loop I decided (as an
experiment) to put each of them in their own task. Each task would
then respond to (or poll) its sensor and also output the result. This
I could do by writing directly (not via EMIT) to their output medium
(display, leds, sound) for each sensor. I think doing this by
redirecting EMIT within the task would be a better solution - but not
one I achieved.

Kind regards,
Tristan


On 19Sep19 20:32, Erich Wälde wrote:
> 
> Hello Tristan,
> 
> I need to look into my stuff, but that won't happen before next
> week. If I understand you correctly, you want to "shut down the
> output of the task, no matter what." I think, I have done this
> somewhere ... but I do not remember the details. You need to
> place " ' drop " in the correct field in the task control block.
> Something like this ... I'll check this out next week. :-)
> 
> 
> Cheers,
> Erich
> 
> 
> Tristan Williams writes:
> 
> > Hello,
> >
> > I have been trying to redirect emit from within a task in a forth
> > multitasking setup. Redirection works perfectly for me in a word run
> > from the interpreter but when I try to do it from a task I fail to get
> > it to work. Below is a stripped down example which aims to redirect
> > emit to drop - so nothing should be output. The result of go! is
> > either a mcu reset or a hang. Without the redirection line, the task
> > runs and I can use the interpreter. Any ideas as to where I am going
> > wrong very gratefully received. 
> >
> > Regards,
> > Tristan
> >
> > \ include ms.frt             \ with pause  
> > \ include avr-values.frt
> > \ include multitask.frt
> >
> > ' emit  defer@ Evalue emit.amforth
> > ' emit? defer@ Evalue emit?amforth
> >
> > : +noop     ['] drop is emit ['] true is emit? ;
> > : -noop emit.amforth is emit emit?amforth is emit? ;
> >
> > $20 $20 0 task: task1
> >
> > : tx1.ex
> >     
> >     task1 tib>tcb activate
> >
> >     begin
> >       +buzz 1000 ms
> >       \ uncomment one of three lines below  
> >       \ 1 +noop . -noop  \ works in the interpreter 
> >         1 +noop . -noop  \ resets the mcu in task
> >       \ +noop  -noop     \ does not reset mcu in task  
> >       -buzz 1000 ms 
> >     again
> > ;
> >
> > : go!
> >
> >     buzz.init 
> >     
> >     task1 task-init
> >
> >     tx1.ex
> >
> >     onlytask
> >     task1 tib>tcb alsotask
> >     multi
> >
> > ;
> >
> >
> >
> >
> >
> > _______________________________________________
> > Amforth-devel mailing list for http://amforth.sf.net/
> > Amforth-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/amforth-devel
> 
> 
> -- 
> May the Forth be with you ...
> 
> 
> _______________________________________________
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
> 


_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to