Driving four 7-segment array by using multiplexingThis project uses a LIM-5652G 4 X 7-segment array which
was rescued from an old satellite receiver. Any similar array will do
as long as
|
![]() |
![]() |
The arrangement is shown above. The only pin of the
7-segment display not connected drives the decimal points. A suggested
PCB layout is shown on the right above. The PCB made from this negative
was used for the circuit board in the photograph.
|
|
10 REM K8055_7-seg_x4 20 REM Multiplex four 7-segment displays 30 REM Jochen Lueg 40 REM http://roevalley.com 50 REM Limavady, May 2012 60 REM Version 1.0 70 80 90 ON ERROR PROCerror 100 PROCK8055_init 110 PROCinit 120 SYS K8055_CloseDevice%,Board% 130 SYS K8055_OpenDevice%,Board% 140 PROCscreen(700,280) 150 OFF 160 ON CLOSE PROCclose 170 *FONT Lucida Console,14,2 180 PRINT 190 PRINT " Select from the following:" 200 PRINT 210 PRINT " 1 . . . . . . . . Display 1 counts from 0 to 9" 220 PRINT " 2 . . . . . . . . Display 2 counts from 0 to 9" 230 PRINT " 3 . . . . . . . . Display 3 counts from 0 to 9" 240 PRINT " 4 . . . . . . . . Display 4 counts from 0 to 9" 250 PRINT " 5 . . . . . . . . Multiplex" 260 PRINT 270 PRINT " Q . . . . . . . . Return to this menu" 280 PRINT 290 REPEAT 300 REPEAT 310 Key$=INKEY$(0) 320 IF Key$="1" PROCcount_display(1) 330 IF Key$="2" PROCcount_display(2) 340 IF Key$="3" PROCcount_display(3) 350 IF Key$="4" PROCcount_display(4) 360 IF Key$="5" PROCmultiplex 370 UNTIL FALSE 380 PROCclose 390 END 400 410 420 430 DEFPROCcount_display(d%) 440 LOCAL Num% 450 Stop$="Run" 460 REPEAT 470 Num%=Dis%(d%)OR N%(Zahl%) 480 SYS K8055_WriteAllDigital%,Num% 490 Zahl%+=1:IF Zahl%=10 Zahl%=0 500 Key$=INKEY$(30) 510 IF ASC(Key$)<>-1 Stop$="Stop" 520 UNTIL Stop$="Stop" 530 ENDPROC 540 550 560 DEFPROCmultiplex 570 LOCAL A%,B%,C%,D% 580 FOR A%=0 TO 9 590 FOR B%=0 TO 9 600 FOR C%=0 TO 9 610 FOR D%=0 TO 9 620 TIME=0 630 REPEAT 640 PROCscan(D%,C%,B%,A%) 650 UNTIL TIME>5 660 IF INKEY(-17) SYS K8055_ClearAllDigital%:ENDPROC 670 NEXT 680 NEXT 690 NEXT 700 NEXT 710 SYS K8055_ClearAllDigital% 720 ENDPROC 730 740 750 DEFPROCscan(D1%,D2%,D3%,D4%) 760 SYS K8055_WriteAllDigital%,N%(D1%) OR Dis%(1) 770 SYS K8055_WriteAllDigital%,N%(D2%) OR Dis%(2) 780 SYS K8055_WriteAllDigital%,N%(D3%) OR Dis%(3) 790 SYS K8055_WriteAllDigital%,N%(D4%) OR Dis%(4) 800 ENDPROC 810 820 830 DEFPROCclose 840 SYS K8055_ClearAllDigital%,1 850 SYS K8055_CloseDevice%,1 860 SYS "FreeLibrary",K8055_Board% 870 QUIT 880 ENDPROC 890 900 910 DEFPROCscreen(ScreenWidth%,ScreenHeight%) 920 SYS "SetWindowPos",@hwnd%,0,0,0,ScreenWidth%,ScreenHeight%,6 930 VDU 26 940 COLOUR 128 950 CLS 960 COLOUR 15 970 ENDPROC 980 990 1000 DEFPROCerror 1010 PRINT REPORT$;" at line ";ERL : 1020 SYS K8055_ClearAllDigital%,1 1030 SYS K8055_ClearAllAnalog%,1 1040 SYS K8055_CloseDevice%,1 1050 SYS "FreeLibrary",K8055_Board% 1060 END 1070 ENDPROC 1080 1090 1100 DEFPROCinit 1110 Board%=0 1120 T%=-3 1130 Zahl%=0 1140 DIM N%(11) : REM Pattern for numerals 1150 N%(0)=%1111 1160 N%(1)=%1110 1170 N%(2)=%0111 1180 N%(3)=%0110 1190 N%(4)=%1011 1200 N%(5)=%1010 1210 N%(6)=%0011 1220 N%(7)=%0010 1230 N%(8)=%1101 1240 N%(9)=%1100 1250 N%(10)=%0000 : REM segments All OFF 1260 1270 DIM Dis%(4) 1280 Dis%(0)=%11110000 : REM All four arrays OFF 1290 Dis%(1)=%01110000 1300 Dis%(2)=%10110000 1310 Dis%(3)=%11100000 1320 Dis%(4)=%11010000 1330 ENDPROC 1340 1350 1360 DEFPROCK8055_init 1370 REM Typing errors in routine name do not generate an error message - they just hang up the program. 1380 REM These are all the system calls in the order found in the manual 1390 SYS"LoadLibrary","K8055D.dll" TO K8055_Board% 1400 SYS"GetProcAddress",K8055_Board%,"OpenDevice" TO K8055_OpenDevice% 1410 SYS"GetProcAddress",K8055_Board%,"CloseDevice" TO K8055_CloseDevice% 1420 SYS"GetProcAddress",K8055_Board%,"ReadAnalogChannel" TO K8055_ReadAnalogChannel% 1430 SYS"GetProcAddress",K8055_Board%,"ReadAllAnalog" TO K8055_ReadAllAnalog% 1440 SYS"GetProcAddress",K8055_Board%,"OutputAnalogChannel" TO K8055_OutputAnalogChannel% 1450 SYS"GetProcAddress",K8055_Board%,"OutputAllAnalog" TO K8055_OutputAllAnalog% 1460 SYS"GetProcAddress",K8055_Board%,"ClearAnalogChannel" TO K8055_ClearAnalogChannel% 1470 SYS"GetProcAddress",K8055_Board%,"ClearAllAnalog" TO K8055_ClearAllAnalog% 1480 SYS"GetProcAddress",K8055_Board%,"SetAnalogChannel" TO K8055_SetAnalogChannel% 1490 SYS"GetProcAddress",K8055_Board%,"SetAllAnalog" TO K8055_SetAllAnalog% 1500 SYS"GetProcAddress",K8055_Board%,"WriteAllDigital" TO K8055_WriteAllDigital% 1510 SYS"GetProcAddress",K8055_Board%,"ClearDigitalChannel" TO K8055_ClearDigitalChannel% 1520 SYS"GetProcAddress",K8055_Board%,"ClearAllDigital" TO K8055_ClearAllDigital% 1530 SYS"GetProcAddress",K8055_Board%,"SetDigitalChannel" TO K8055_SetDigitalChannel% 1540 SYS"GetProcAddress",K8055_Board%,"SetAllDigital" TO K8055_SetAllDigital% 1550 SYS"GetProcAddress",K8055_Board%,"ReadDigitalChannel" TO K8055_ReadDigitalChannel% 1560 SYS"GetProcAddress",K8055_Board%,"ReadAllDigital" TO K8055_ReadAllDigital% 1570 SYS"GetProcAddress",K8055_Board%,"ResetCounter" TO K8055_ResetCounter% 1580 SYS"GetProcAddress",K8055_Board%,"ReadCounter" TO K8055_ReadCounter% 1590 SYS"GetProcAddress",K8055_Board%,"SedtCounterDebouceTime" TO K8055_SetCounterDebounceTime% 1600 ENDPROC |
Return to the interfacing index
|