system aterm global sm order ack x pw1 pw2 pw3 xc exec reccom acknowledge analogin analogut 0/nil/pwm/steppa ------------------------------------- process reccom begin ( 26 , 27 , )morse.init -- s r :loop )morse.rec ->order A:loop load from(Morse.mpo) *morse.init *morse.rec \ ---------------------------- process acknowledge ackL begin ( 26 , 27 , )morse.init ?noack ->ack :loop ack ->ackL if(ackL =?noack):loop if(ackL =?adcget){ x ->ackL } if(ackL =?touchget){ x ->ackL } ( ackL )morse.senda ?noack ->ack A:loop load from (Morse.mpo) *morse.init *morse.senda \ ----------------------------------- process analogin comm arg begin :loop if(order =0):loop order &$3F ->comm order >>6 ->arg if(comm =?adcinit){ )adc.init A:cmn } if(comm =?adcget){ ( arg )adc.get ->x A:cmn } if(comm =?touchinit){ )touch.init A:cmn } if(comm =?touchget){ )touch.get ->x A:cmn } A:loop :cmn 0 ->order comm ->ack A:loop load from (TermI.mpo) *defs load from (adc.mpo) *adc.init *adc.get load from (Touch.mpo) *touch.init *touch.get \ ----------------------------------- process analogut comm arg begin :loop if(order =0):loop order &$3F ->comm order >>6 ->arg if(comm =?dacinit){ )dac.init A:cmn } if(comm =?dacsend){ ( arg )dac.send A:cmn } if(comm =?dacsend2){ ( arg )dac.send2 A:cmn } if(comm =?pwminit){ 1 ->sm A:cmn } if(comm =?pwmx){ arg ->pw1 A:cmn } if(comm =?pwmy){ arg ->pw2 A:cmn } if(comm =?pwmz){ arg ->pw3 A:cmn } if(comm =?stepinit){ 2 ->sm A:cmn } if(comm =?steppos){ arg ->xc A:cmn } A:loop :cmn 0 ->order comm ->ack A:loop load from (DAC.mpo) *dac.init *dac.send *dac.send2 \ ------------------------------- process nil begin :hold A:hold \ ------------------------------ process pwm mask = $3F0000 fmask = $2A0000 mask1 = $030000 bwd1 = $010000 mask2 = $0C0000 bwd2 = $040000 mask3 = $300000 bwd3 = $100000 ttot = 4096 tfwd1 tfwd2 tfwd3 t0 begin ( mask )setdir ( 0 , mask , )outpins :loop pw1 ->tfwd1 pw2 ->tfwd2 pw3 ->tfwd3 ( fmask , mask , )outpins now ->t0 :tloop if(now -t0 >tfwd1){ ( bwd1 , mask1 , )outpins now +ttot ->tfwd1 } if(now -t0 >tfwd2){ ( bwd2 , mask2 , )outpins now +ttot ->tfwd2 } if(now -t0 >tfwd3){ ( bwd3 , mask3 , )outpins now +ttot ->tfwd3 } if(now -t0 >ttot){ ( 0 , mask , )outpins A:loop } A:tloop load from (std.mpo) *setdir *outpins \ ------------------------------ process steppa xcl x dt = 80000 mask = $F0000 patt = 8,2,4,1 begin ( mask )setdir xc ->x :loop xc ->xcl if( x xcl){ -1,x< } ( x &3 [] patt <<16 , mask , )outpins dt wait A:loop load from (std.mpo) *setdir *outpins \