0 BEGIN PGM 8150-en MM 1 ;********************************** 2 ;A maschine parameter will be read 3 ;and stored in Q1. 4 ;The Q1 then contains a decimal 5 ;value which should be converted 6 ;to a binary value. 7 ;In the table BIT.tab the 8 ;corresponding bit will be set and 9 ;can then be read separatly. 10 ;********************************** 11 ;***Read maschine parameter 12 ;********************************** 13 FN 18: SYSREAD Q1 = ID1000 NR730 14 ;********************************** 15 ;***Set Q-parameters Q1 and Q100 16 ;********************************** 17 Q10 = - 1 ;Reset counter 18 Q100 = 1 ;Number of table entry 19 ;********************************** 20 ;Copy table 21 FUNCTION FILECOPY "8150-1-en.tab" TO "BIT.tab" 22 FN 26: TABOPEN BIT.tab 23 LBL 1 24 Q10 = Q10 + 1 ;Redefine counter 25 Q1 = Q1 / 2 ;Divide decimal value 26 Q2 = FRAC Q1 ;Separate decimals 27 Q1 = INT Q1 ;Separate digits 28 Q3 = Q1 + Q2 29 ;Control wheter further calculations are necessary 30 FN 9: IF +Q3 EQU +0 GOTO LBL "END" 31 FN 9: IF +Q2 EQU +0 GOTO LBL 1 32 ;Convert Q10 to string QS1 33 QS1 = TOCHAR( DAT+Q10 ) 34 ;Write value of parameter Q100 (1) in the table 35 FN 27: TABWRITE 0 / QS1 = Q100 36 ;Return to LBL1 37 FN 9: IF +0 EQU +0 GOTO LBL 1 38 LBL "END" 39 END PGM 8150-en MM