diff --git a/ADbasic_program_buffered.bas b/ADbasic_program_buffered.bas index a15477fcdf456904868fd9c58ad6712e49cfad40..097b59d94fc84e0a586c13ff16854fb487c5b34b 100644 --- a/ADbasic_program_buffered.bas +++ b/ADbasic_program_buffered.bas @@ -158,12 +158,18 @@ init: NEXT i '=========================== INITIALIZE AOUTS ========================== - 'Initialize set values of all output channels + ' Initialize set values of all output channels FOR i=1 TO AOUTNO - set_target[i]=DATA_3[i] 'The initial output values are always given for all channels + set_target[i]=ZERO set_pid[i]=0 'At beginning all PIDs off NEXT i - + ' Set outputs to values at t=0, if given + FOR i=1 TO AOUTNO + IF (DATA_1[i]=0) THEN + set_target[DATA_2[i]] = DATA_3[i] + ENDIF + NEXT i + 'Write analog out values P2_Write_DAC8(AOUT1,set_target,1) P2_Write_DAC8(AOUT2,set_target,9) @@ -317,11 +323,11 @@ EVENT: IF(nextPidTime <= processIdx) Then DO inc pidIdx - i = DATA_5[pidIdx] + i = DATA_5[pidIdx] ' output channel index set_pid[i] = DATA_6[pidIdx] pid_sum[i] = 0 'act_values[DATA_6[pidIdx]]-N pid_prev_dError[i] = 0 - i = DATA_6[pidIdx] + i = DATA_6[pidIdx] ' input/PID channel index pid_P[i] = DATA_25[pidIdx] pid_I[i] = DATA_26[pidIdx] pid_D[i] = DATA_27[pidIdx] @@ -361,9 +367,9 @@ FINISH: P2_TiCo_Stop_Process(PTR_TICO2,1) 'Set values of all output channels to 0V - for i=1 to AOUTNO - set_output[i]=ZERO - next i + 'for i=1 to AOUTNO + ' set_output[i]=ZERO + 'next i 'Write analog out values P2_Write_DAC8(AOUT1,set_output,1)