A very slow oscilloscope
Some of the projects on these pages - particularly the atomic clock
projects, work with very low frequency signals. It can be a devil of a
job to monitor these and detect interference spikes and other annoying
occurrences. I did not want to go to the expense of buying a storage
scope and decided to use the Velleman board as a standby. The result is
quite satisfactory.
The scope lays no claim to very high accuracy - it is simply a tool to
check slow waveforms. It can display about 5V -
which is the maximum the ADCs on the Velleman board can handle and in
the horizontal direction 10 divisions represent about 3 seconds at best.
|
|
10 REM K8055_slowscope 20 REM Log analogue data with the K8055 USB board 30 REM (c) Jochen Lueg 40 REM http://roevalley.com 50 REM Limavady, March 2012 60 REM Vers 2.1 70 80 90 Ch%=1 100 PROCK8055_init 110 PROCassemble 120 SYS K8055_CloseDevice%,0 130 SYS K8055_OpenDevice%,0 140 ON ERROR PROCerror 150 SYS K8055_ClearAllDigital%,1 160 PROCwindow(1600,400) 170 PROCinit 180 OFF 190 PROCdraw_grid 200 REPEAT 210 IF INKEY(-49)T%=1:T$="370ms/div":PROCupdate(T$) 220 IF INKEY(-50)T%=10:T$="500ms/div":PROCupdate(T$) 230 IF INKEY(-18)T%=20:T$="1s/div":PROCupdate(T$) 240 IF INKEY(-19)T%=41:T$="2s/div":PROCupdate(T$) 250 IF INKEY(-20)T%=60:T$="3s/div":PROCupdate(T$) 260 IF INKEY(-53)T%=80:T$="4s/div":PROCupdate(T$) 270 IF INKEY(-37)T%=120:T$="6s/div":PROCupdate(T$) 280 IF INKEY(-22)T%=161:T$="8s/div":PROCupdate(T$) 290 300 IF INKEY(-83) Mode$="Continuous":PROCupdate(T$) 310 IF INKEY(-82) Mode$="Single" :PROCupdate(T%) 320 MOUSE mx%,my%,Button% 330 IF Button%=4 THEN 340 REPEAT 350 MOUSE mx%,my%,Button% 360 UNTIL Button%=0 370 PROCplott_adc 380 ENDIF 390 UNTIL INKEY(-17) 400 410 SYS K8055_ClearAllDigital% 420 SYS K8055_ClearAllAnalog% 430 SYS K8055_CloseDevice%,0 440 SYS "FreeLibrary",K8055_Board% 450 *QUIT 460 END 470 480 490 500 DEFPROCupdate(Speed$) 510 GCOL12 520 RECTANGLEFILL 2150,560,400,-30 530 GCOL 0 540 MOVE 2200,600 550 PRINT "Speed Mode" 560 MOVE 2160,560 570 PRINTT$ 580 MOVE 2350,560 590 PRINT Mode$ 600 ENDPROC 610 620 630 DEFPROCplott_adc 640 LOCAL X%,Y%,mx%,my%,Button% 650 REPEAT 660 VDU 23,23,2;0;0;0;: REM Lines are in double thickness 670 GCOL 1 680 X%=1 690 SYS K8055_ReadAnalogChannel%,Ch% TO Y% 700 MOVE X%,Y%*2 710 TIME=0 720 REPEAT 730 SYS K8055_ReadAnalogChannel%,Ch% TO Y% 740 PLOT 5, X%*2,Y%*2 750 Count%=0:REPEAT UNTIL Count%>=T% 760 X%+=1 770 MOUSE mx%,my%,Button% 780 IF Button%=4 THEN 790 REM Start/Pause with left mouse button 800 REPEAT MOUSE mx%,my%,Button% : UNTIL Button%=0 810 REPEAT MOUSE mx%,my%,Button% : UNTIL Button%=4 OR Button%=1 820 REPEAT MOUSE mx%,my%,B% : UNTIL B%=0 830 ENDIF 840 UNTIL X%>1500 OR Button%=1 850 860 REMUNTIL X%>=500 870 REM PRINT TIME/1000 880 890 IF Button%=1 GOTO 950 900 IF Mode$="Single" THEN 910 REPEAT MOUSE mx%,my%,Button% : UNTIL Button%=0 920 REPEAT MOUSE mx%,my%,Button% :UNTIL Button%=4 OR Button%=1 930 REPEAT MOUSE mx%,my%,B% : UNTIL B%=0 940 ENDIF 950 GCOL 140 960 CLG 970 PROCdraw_grid 980 UNTIL Button%=1 990 REPEAT 1000 MOUSE mx%,my%,Button% 1010 UNTIL Button%=0 1020 ENDPROC 1030 1040 1050 DEFPROCdraw_grid 1060 LOCAL X%,Y% 1070 VDU 23,23,1;0;0;0; : REM Lines are in single thickness 1080 ORIGIN 100,100 1090 GCOL 0 1100 FOR Y%= 0 TO 500 STEP 100 1110 MOVE 0,Y% 1120 DRAW 3000,Y% 1130 NEXT 1140 1150 FOR X%=0 TO 3000 STEP 100 1160 MOVE X%,0 1170 DRAW X%,500 1180 NEXT 1190 1200 FOR X%=2 TO 3002 STEP 1000 1210 MOVE X%,0 1220 DRAW X%,500 1230 NEXT 1240 MOVE 0,-2 1250 DRAW 3002,-2 1260 MOVE 0,502 1270 DRAW 3002,502 1280 VDU 5 1290 FOR Y%= 0 TO 5 1300 MOVE -50,(Y%*100)+ 14 1310 PRINT;Y% 1320 NEXT 1330 1340 FOR X%=0 TO 30 1350 IF X%<10 MOVE(X%*100)-10,-20 1360 IF X%>9 MOVE(X%*100)-18,-20 1370 PRINT;X% 1380 NEXT 1390 1400 GCOL4 1410 MOVE 8, 600 1420 PRINT"Mouse Button" 1430 MOVE 8,560 1440 PRINT "Left - Right . . . Start/Pause - Stop" 1450 MOVE 700,600 1460 PRINT "Scanspeeds" 1470 MOVE 700,560 1480 PRINT "Fast - slow . . . 1 to 8" 1490 MOVE 1250,600 1500 PRINT "Scan mode" 1510 MOVE 1250,560 1520 PRINT "S - C . . . Single - Continuous" 1530 MOVE 1850,560 1540 PRINT "Q . . . . Quit" 1550 GCOL 0 1560 MOVE 2200,600 1570 PRINT "Speed Mode" 1580 MOVE 2160,560 1590 PRINT;T$ 1600 MOVE 2350,560 1610 PRINT Mode$ 1620 ENDPROC 1630 1640 1650 DEFPROCinit 1660 COLOUR 12,225,225,225 1670 GCOL 140 1680 CLG 1690 GCOL 0 1700 T$="370s3ms/div" 1710 T%=1 1720 PROCtimeloop 1730 Mode$="Single" 1740 MOUSE OFF 1750 ENDPROC 1760 1770 1780 DEFPROCwindow(WindowWidth%,WindowHeight%) 1790 MODE 30 1800 SYS "SetWindowPos",@hwnd%,0,0,0,WindowWidth%,WindowHeight%,6 1810 SYS "SetWindowText","Slowscope" 1820 VDU 26 1830 ENDPROC 1840 1850 1860 DEFPROCerror 1870 PRINT REPORT$;" at line ";ERL : 1880 SYS K8055_ClearAllDigital%,1 1890 SYS K8055_ClearAllAnalog%,1 1900 SYS K8055_CloseDevice%,1 1910 SYS "FreeLibrary",K8055_Board% 1920 END 1930 ENDPROC 1940 1950 1960 DEFPROCK8055_init 1970 REM Typing errors in routine name do not generate an error message - they just hang up the program. 1980 REM These are all the system calls in the order found in the manual 1990 SYS"LoadLibrary","K8055D.dll" TO K8055_Board% 2000 SYS"GetProcAddress",K8055_Board%,"OpenDevice" TO K8055_OpenDevice% 2010 SYS"GetProcAddress",K8055_Board%,"CloseDevice" TO K8055_CloseDevice% 2020 SYS"GetProcAddress",K8055_Board%,"ReadAnalogChannel" TO K8055_ReadAnalogChannel% 2030 SYS"GetProcAddress",K8055_Board%,"ReadAllAnalog" TO K8055_ReadAllAnalog% 2040 SYS"GetProcAddress",K8055_Board%,"OutputAnalogChannel" TO K8055_OutputAnalogChannel% 2050 SYS"GetProcAddress",K8055_Board%,"OutputAllAnalog" TO K8055_OutputAllAnalog% 2060 SYS"GetProcAddress",K8055_Board%,"ClearAnalogChannel" TO K8055_ClearAnalogChannel% 2070 SYS"GetProcAddress",K8055_Board%,"ClearAllAnalog" TO K8055_ClearAllAnalog% 2080 SYS"GetProcAddress",K8055_Board%,"SetAnalogChannel" TO K8055_SetAnalogChannel% 2090 SYS"GetProcAddress",K8055_Board%,"SetAllAnalog" TO K8055_SetAllAnalog% 2100 SYS"GetProcAddress",K8055_Board%,"WriteAllDigital" TO K8055_WriteAllDigital% 2110 SYS"GetProcAddress",K8055_Board%,"ClearDigitalChannel" TO K8055_ClearDigitalChannel% 2120 SYS"GetProcAddress",K8055_Board%,"ClearAllDigital" TO K8055_ClearAllDigital% 2130 SYS"GetProcAddress",K8055_Board%,"SetDigitalChannel" TO K8055_SetDigitalChannel% 2140 SYS"GetProcAddress",K8055_Board%,"SetAllDigital" TO K8055_SetAllDigital% 2150 SYS"GetProcAddress",K8055_Board%,"ReadDigitalChannel" TO K8055_ReadDigitalChannel% 2160 SYS"GetProcAddress",K8055_Board%,"ReadAllDigital" TO K8055_ReadAllDigital% 2170 SYS"GetProcAddress",K8055_Board%,"ResetCounter" TO K8055_ResetCounter% 2180 SYS"GetProcAddress",K8055_Board%,"ReadCounter" TO K8055_ReadCounter% 2190 SYS"GetProcAddress",K8055_Board%,"SedtCounterDebouceTime" TO K8055_SetCounterDebounceTime% 2200 ENDPROC 2210 2220 2230 DEFPROCtimeloop 2240 SYS"timeGetDevCaps",tc{},8 TO res% 2250 IF res% ERROR 100, "Multimedia timer not available" 2260 SYS "timeBeginPeriod", tc.PeriodMin% 2270 SYS "timeSetEvent", T%, tc.PeriodMin%,TimerProc,0,1 TO TimerID% 2280 IF TimerID%=0 ERROR 100, "Could not strt timer" 2290 ON CLOSE SYS "timeKillEvent",TimerID% : QUIT 2300 ON ERROR SYS "timeKillEvent",TimerID%: PRINT 'REPORT$ : END 2310 ENDPROC 2320 2330 2340 DEFPROCassemble 2350 DIM tc{PeriodMin%,PeriodMax%} 2360 DIM P% 10 2370 [.TimerProc 2380 inc dword [^Count%] 2390 ret 20 2400 ] 2410 ENDPROC |
|
Return
to the interfacing index Back to the Limavady home page
|