#pragma rtGlobals=1 // Use modern global access method. Function MakeFrame(Screenshot, D0,D1,CLOCK,HSYNC,VSYNC) Wave Screenshot, D0,D1,CLOCK,HSYNC,VSYNC variable ii, CLOCK_laststate, VSYNC_laststate, HSYNC_laststate variable CLOCK_numedges=0, VSYNC_numedges=0, HSYNC_numedges=0 variable CurrentLine=0 variable CurrentPixel=0 CLOCK_laststate=CLOCK(0) VSYNC_laststate=VSYNC(0); HSYNC_laststate=HSYNC(0); wavestats/Q CLOCK for(ii=0;ii< V_npnts;ii=ii+1) if(HSYNC_laststate==0 && HSYNC(ii)==1) // Rising edge - seems to work just as well HSYNC_laststate= HSYNC(ii) CurrentLine=CurrentLine+1 CurrentPixel=0 HSYNC_numedges=HSYNC_numedges+1; endif if(HSYNC_laststate==1 && HSYNC(ii)==0) // Falling edge HSYNC_laststate= HSYNC(ii) endif if(VSYNC_laststate==0 && VSYNC(ii)==1) // Rising edge VSYNC_numedges=VSYNC_numedges+1; VSYNC_laststate= VSYNC(ii) endif if(VSYNC_laststate==0 && VSYNC(ii)==1) // Falling edge VSYNC_laststate= VSYNC(ii) endif if(CLOCK_laststate==0 && CLOCK(ii)==1) // Rising edge CLOCK_laststate= CLOCK(ii) endif if(CLOCK_laststate==1 && CLOCK(ii)==0) // Falling edge CurrentPixel=CurrentPixel+1 Screenshot[CurrentPixel][CurrentLine]=(D0(ii))+(D1(ii)*2); CLOCK_numedges=CLOCK_numedges+1; CLOCK_laststate= CLOCK(ii) endif endfor print HSYNC_numedges print VSYNC_numedges print CLOCK_numedges End