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

Reply via email to