DIM g%(16000) OPEN "record.dat" FOR OUTPUT AS #1 LEN = 4096 PRINT #1, "Data "; DATE$ ON TIMER(1) GOSUB sample TIMER ON offy = 50 DIM dout%(20) REDIM buf%(6000) pb% = 0 fb% = 1 CLS SCREEN 2 LINE (0, offy)-(639, offy), 1, , &H1111 soglia = 50 sogliamin = 45 datao% = &H378 datai% = &H379 'datao% = &H278 'datai% = &H279 'datao% = &H3bc 'datai% = &H3bd FOR i = 1 TO 20 READ dout%(i) NEXT i po% = 255 OUT datao%, po% WHILE a$ <> CHR$(27) a$ = INKEY$ ' ---- CAMPIONAMENTO po% = 0 di = 0 OUT datao%, po% ' cs=0 sdk=0 do=0 FOR i% = 1 TO 20 po% = po% AND 253 ' toglie eventuale dato po% = po% OR dout%(i%) * 2 ' immette il dato attuale OUT datao%, po% ' presenta dato in uscita OUT datao%, po% + 4 ' sdk=1 OUT datao%, po% ' sdk=0 IF i% >= 4 AND i% <= 19 THEN di = di * 2 IF INP(datai%) AND 64 THEN di = di + 1 END IF NEXT i% OUT datao%, 1 ' cs=1 v% = di / 256 flo = v% IF runa = 0 THEN runa = flo * 8: pv = flo runa = runa - pv runa = runa + flo vo = runa / 8 pv = vo vo = vo - 128 ' trim offset vo = vo c = c + 1 IF ABS(vo) > vmax THEN vmax = ABS(vo) LOCATE 1, 40 PRINT USING "####"; vo IF fb% = 1 THEN buf%(pb%) = vo pb% = pb% + 1 IF pb% > 500 THEN pb% = 0 END IF ' --- FINE CAMPIONAMENTO ' --- RAPPRESENTAZIONE GRAFICA vy = vo * .1 vx = vx + .1 LINE (px, pvy + offy)-(vx, vy + offy), 1 IF t = -1 THEN LINE (vx, offy - 10)-(vx, offy + 10), 1, , &H1111 t = 0 END IF IF vx > 639 THEN offy = offy + 25 vx = 0 IF offy > 190 THEN offy = 175 GET (0, 42)-(639, 199), g% LINE (0, 160)-(639, 199), 0, BF PUT (0, 17), g%, PSET END IF LINE (0, offy)-(639, offy), 1, , &H1111 END IF pvy = vy px = vx ' --- FINE RAPPRESENTAZIONE GRAFICA ' --- START AUTOMATICO REGISTRAZIONE IF ABS(vo) > soglia AND rec% = 0 THEN rec% = 1: BEEP PRINT #1, "START "; TIME$ ev$ = TIME$ LINE (vx - 10, offy - 10)-(vx, offy), 1 END IF ' --- FINE ANALISI START AUTOMATICO REGISTRAZIONE ' --- REGISTRAZIONE IF rec% = 1 THEN IF fb% = 1 THEN FOR i% = pb% TO 500 PRINT #1, buf%(i%) NEXT i% FOR i% = 0 TO pb% PRINT #1, buf%(i%) NEXT i% fb% = 0 pb% = 0 REDIM buf%(600) PRINT #1, "REALTIME" END IF LOCATE 1, 1: PRINT "R" PRINT #1, STR$(INT(vo)) ELSE LOCATE 1, 1: PRINT " " END IF ' --- FINE REGISTRAZIONE '--- ANALISI INTERRUZIONE REGISTRAZIONE IF rec% = 1 THEN IF ABS(vo) < sogliamin THEN LOCATE 1, 1: PRINT "s" INTERR = INTERR + 1 IF INTERR > 5000 THEN rec% = 0 fb% = 1 'flag buffer di nuovo da registrare PRINT #1, "STOP "; TIME$ count = count + 1 BEEP END IF ELSE INTERR = 0 END IF END IF WEND TIMER OFF CLOSE END sample: LOCATE 2, 1 PRINT USING "Ev: ##"; count LOCATE 1, 8 PRINT ev$ LOCATE 2, 8 c = c / 1 PRINT USING "S/s:##"; c c = 0 t = t + 10 IF t > 59 THEN t = -1 PSET (px, offy + 5) LOCATE 2, 20 PRINT USING "Bf:###"; pb% LOCATE 2, 30 PRINT USING "Vmax:####"; vmax LOCATE 2, 40 PRINT USING "Soglie:###"; soglia; PRINT USING "/###"; sogliamin LOCATE 1, 50 PRINT DATE$; " "; TIME$ LOCATE 1, 70 PRINT USING "#######"; LOF(1) IF LOF(1) > 1400000 THEN CLOSE END END IF LOCATE 2, 60: PRINT USING "###"; media NDATE$ = DATE$ IF precdate$ <> NDATE$ THEN PRINT #1, "Data "; DATE$ END IF precdate$ = NDATE$ RETURN DATA 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0