1 :ATforward{
2 delay(3)
3 IFOUTPOT(8,GT,tempATposition) jump ATforward ;
loop until proper position
4 }
5 :ATbackward{
6 delay(3)
7 IFOUTPOT(8,LT,tempATposition) jump ATbackward ;
loop until proper position
8 }
9 :AutoThrottle{
10 clearflag(ATNotBusy) ;
flag to prevent runnning this routine twice
11 ifvar(ATposition,LT,10){setvar(ATposition,10)};
prevent over-run(full-throttle )
12 ifvar(ATposition,GT,120){setvar(ATposition,120)};prevent over-run(idle
position)
13 setvar(tempATposition,ATposition)
14 subvar(tempATposition,10) ; range for allowance
15 IFOUTPOT(8,LT,tempATposition){
;compare with analog input 8 (No.1 throttle)
16 setpoint(MThrottleR) ;
reverse relayr ON
17 setpoint(MThrottleOn)
motor ON
18 call(ATbackward) ;
19 clearpoint(MThrottleOn) ; motor
OFF
20 clearpoint(MThrottleR) ; reverse
relay OFF
21 }else{
22 addvar(tempATposition,20) ;range
for allowance
23 IFOUTPOT(8,GT,tempATposition){ ; ;compare
with analog input 8 (No.1 throttle)
24 setpoint(MThrottleOn) ; motor
ON
25 call(ATforward) ;
26 clearpoint(MThrottleOn) ; motor
OFF
27 }
28 }
29 setflag(ATNotBusy) ;release this routine
30 }
31 :Update_SPD_Mode{ ;0 =off, 1=ARM, 2=N1 (THR), 3=MCP SPD, 4=RETARD,
5=THR HLD
32 setvar(OldSPD_mode,SPD_mode)
33 #expand getPH8(SPD_Mode,0x0045) ;PH69
34 if(fThrottleMotorize){
35 ifvar(SPD_Mode,EQU,2){ ;TOGA,THR mode
36 setvar(ATposition,10)
37 jump(AutoThrottle)
38 }
39 ifvar(SPD_Mode,EQU,4){ ; REATARD
mode
40 setvar(ATposition,120)
41 jump(AutoThrottle)
42 }
43 }
44 }
45 :Update_Engine1_N1{
46 #expand getPH8(vEngine1_N1,0x0064) ; N1
value of Engine No.1
47 if(fThrottleMotorize){
48 ifvar(SPD_Mode,equ,3){
49 if(ATNotBusy){
50 setvar(ATposition,140)
51 subvar(ATposition,vEngine1_N1)
52 jump(AutoThrottle)
53 }
54 }
55 }
56 }
57 DefinePH(69, Update_SPD_mode, 0,0,0,0) ; call
when the MODE was changed
58 definePH(100, Update_Engine1_N1, 0,0,0,0)
call when N1 of engine No.1 was changed
59 ;