A dual LED circus

After working on the dual 7-segment display board, it occurred to me that multiplexing could be used to drive sixteen LEDs rather than just eight. The result of this thought is this little display toy.

The cathodes of the two groups of 8 LEDs are switched in parallel and connected to the output ports of the Velleman board via the current limiting resistors. The anodes of each group of eight are then connected together and supplied with current by the driver transistors. The bases of the transistors are connected to the two

analogue outputs of the Velleman board. Below is the project connected to the K8055.

  The 16 LED dissplay project

The circuit diagram and PCB layout is below. Note that the PCB view is  looking through the board from above. To transfer it to copper you have to turn the printout over.

The circuit diagram
The pcb layout

Programming the board

The program offers various choices and no doubt lots of other options could be included.
The system call

SYS OutputAnalogChannnel%,Channel%,Value%

is used to switch between one circle and the other. When both circles are supposed to be on at once, multiplexing is used, but see my remarks about this in the 7 segment project. The response of the Velleman board is to slow to make this trick completely successful.

As usual I supply a zip archive with the program file and the ready to run executable file.

 BBC K8055_times-two.zip
here is the video of the project

 Below are the same two files for the K8061 board K8061_times-two.zip

  10 REM LED-times_two
   20 REM Drive 16 LEDs with the K8055
   30 REM (c) Jochen Lueg
   40 REM
   50 REM Limavady, January 2012
   60 REM Vers 1.0
   70
   80 COLOUR 128
   90 CLS
  100 COLOUR 15
  110 ON ERROR PROCerror
  120 PROCK8055_init
  130 PROCinit
  140 SYS K8055_OpenDevice%,Board%
  150 REM PROCsay_hello
  160
  170 PRINT
  180 PRINT "   Select from the following:"
  190 PRINT
  200 PRINT "   O . . . . . . . . Rotate one"
  210 PRINT "   T . . . . . . . . Rotate t'other"
  220 PRINT "   B . . . . . . . . Rotate both"
  230 PRINT "   L . . . . . . . . Loop the loop"
  240 PRINT "   S . . . . . . . . Sine wave"
  250 PRINT "   < > . . . . . . . Change speed"
  260 PRINT
  270 PRINT "   R . . . . . . . . Return to this menu"
  280 PRINT "   S . . . . . . . . Leave this program"
  290 PRINT
  300
  310 REPEAT
  320   Key$=INKEY$(0)
  330   IF Key$="o" OR Key$="O" PROCrotate(1)
  340   IF Key$="T" OR Key$="t" PROCrotate(2)
  350   IF Key$="L" OR Key$="l" PROCloop_the_loop
  360   IF Key$="S" OR Key$="s" PROCsine
  370   IF Key$="B" OR Key$="b" PROCrotate_both
  380  
  390 UNTIL Key$="S" OR Key$="s"
  400
  410 SYS K8055_ClearAllDigital%
  420 SYS K8055_ClearAllAnalog%
  430 SYS K8055_CloseDevice%
  440 END
  450
  460
  470 DEFPROCrotate_both
  480 REPEAT
  490   FOR J%=1 TO 8
  500     TIME=0
  510     SYS K8055_WriteAllDigital%,Both%(J%)
  520     REPEAT
  530       SYS K8055_OutputAnalogChannel%,1,255
  540       SYS K8055_ClearAnalogChannel%,2
  550       SYS K8055_OutputAnalogChannel%,2,255
  560       SYS K8055_ClearAnalogChannel%,1
  570     UNTIL TIME>Delay%
  580     Key$ =INKEY$(Delay%)
  590     IF Key$="," OR Key$="<" Delay%+=1:IF Delay%>100 Delay%=100
  600     IF Key$="." OR Key$=">" Delay%-=1:IF Delay%<0 Delay%=0
  610   NEXT
  620 UNTIL Key$="R" OR Key$="r"
  630 SYS K8055_ClearAllDigital%
  640 SYS K8055_ClearAllAnalog%
  650 ENDPROC
  660
  670
  680 DEFPROCsine
  690 Delay%=2
  700 SYS K8055_ClearAllDigital%
  710 SYS K8055_ClearAllAnalog%
  720 SYS K8055_OutputAnalogChannel%,1,255
  730 REPEAT
  740   FOR J%= 1 TO 9
  750     IF J%=1 THEN
  760       SYS K8055_OutputAnalogChannel%,1,255
  770       SYS K8055_ClearAnalogChannel%,2
  780     ENDIF
  790     IF J%=5 THEN
  800       SYS K8055_OutputAnalogChannel%,2,255
  810       SYS K8055_ClearAnalogChannel%,1
  820     ENDIF
  830     SYS K8055_SetDigitalChannel%,S%(J%)
  840     Key$ =INKEY$(Delay%)
  850     IF Key$="," OR Key$="<" Delay%+=1:IF Delay%>100 Delay%=100
  860     IF Key$="." OR Key$=">" Delay%-=1:IF Delay%<0 Delay%=0
  870    
  880     SYS K8055_ClearDigitalChannel%,S%(J%)
  890   NEXT
  900   SYS K8055_ClearAllDigital%
  910   SYS K8055_ClearAllAnalog%
  920 UNTIL Key$="R" OR Key$="r" OR Key$="S" OR Key$="s"
  930
  940 ENDPROC
  950
  960 DEFPROCloop_the_loop
  970 SYS K8055_ClearAllDigital%
  980 SYS K8055_ClearAllAnalog%
  990 REPEAT
 1000   SYS K8055_OutputAnalogChannel%,1,255
 1010   FOR J%=1 TO 8
 1020     SYS K8055_SetDigitalChannel%,O%(J%)
 1030     Key$ =INKEY$(Delay%)
 1040     SYS K8055_ClearDigitalChannel%,O%(J%)
 1050     IF Key$="," OR Key$="<" Delay%+=1:IF Delay%>100 Delay%=100
 1060     IF Key$="." OR Key$=">" Delay%-=1:IF Delay%<0 Delay%=0
 1070    
 1080   NEXT
 1090   SYS K8055_ClearAnalogChannel%,1
 1100   SYS K8055_OutputAnalogChannel%,2,255
 1110   FOR J%=1 TO 8
 1120     SYS K8055_SetDigitalChannel%,T%(J%)
 1130     Key$ =INKEY$(Delay%)
 1140     IF Key$="," OR Key$="<" Delay%+=1:IF Delay%>100 Delay%=100
 1150     IF Key$="." OR Key$=">" Delay%-=1:IF Delay%<0 Delay%=0
 1160    
 1170     SYS K8055_ClearDigitalChannel%,T%(J%)
 1180   NEXT
 1190   SYS K8055_ClearAllDigital%
 1200   SYS K8055_ClearAllAnalog%
 1210 UNTIL Key$="R" OR Key$="r" OR Key$="S" OR Key$="s"
 1220 ENDPROC
 1230
 1240
 




1250 DEFPROCrotate(d%)
 1260 SYS K8055_ClearAllDigital%
 1270 SYS K8055_ClearAllAnalog%
 1280 SYS K8055_OutputAnalogChannel%,d%,255
 1290 REPEAT
 1300   FOR J%=1 TO 8
 1310     SYS K8055_SetDigitalChannel%,J%
 1320     Key$ =INKEY$(Delay%)
 1330    
 1340     IF Key$="," OR Key$="<" Delay%+=1:IF Delay%>100 Delay%=100
 1350     IF Key$="." OR Key$=">" Delay%-=1:IF Delay%<0 Delay%=0
 1360    
 1370     SYS K8055_ClearDigitalChannel%,J%
 1380   NEXT
 1390 UNTIL Key$="R" OR Key$="r" OR Key$="S" OR Key$="s"
 1400 SYS K8055_ClearAllAnalog%
 1410 SYS K8055_ClearAllDigital%
 1420 ENDPROC
 1430
 1440
 1450 DEFPROCsay_hello
 1460 LOCAL T%
 1470 T%=20
 1480 SYS K8055_ClearAllAnalog%
 1490 SYS K8055_OutputAnalogChannel%,1,255
 1500 FOR J%=1 TO 3
 1510   SYS K8055_WriteAllDigital%,255
 1520   TIME=0:REPEAT UNTIL TIME>T%
 1530   SYS K8055_ClearAllDigital%
 1540   TIME=0:REPEAT UNTIL TIME>T%
 1550 NEXT
 1560 SYS K8055_ClearAllAnalog%
 1570 SYS K8055_OutputAnalogChannel%,2,255
 1580 FOR J%=1 TO 3
 1590   SYS K8055_WriteAllDigital%,255
 1600   TIME=0:REPEAT UNTIL TIME>T%
 1610   SYS K8055_ClearAllDigital%
 1620   TIME=0:REPEAT UNTIL TIME>T%
 1630 NEXT
 1640 SYS K8055_ClearAllAnalog%
 1650 ENDPROC
 1660
 1670
 1680 DEFPROCerror
 1690 PRINT REPORT$;" at line ";ERL  : END
 1700 SYS K8055_ClearAllDigital%
 1710 SYS ClearAllAnalog%
 1720 STOP
 1730 ENDPROC
 1740
 1750
 1760 DEFPROCinit
 1770 Board%=0
 1780 Delay%=10
 1790
 1800 DIM Both%(8)
 1810 Both%(1)=%00000001
 1820 Both%(2)=%00000010
 1830 Both%(3)=%00000100
 1840 Both%(4)=%00001000
 1850 Both%(5)=%00010000
 1860 Both%(6)=%00100000
 1870 Both%(7)=%01000000
 1880 Both%(8)=%10000000
 1890
 1900
 1910 DIM O%(8)
 1920 O%(1)=7
 1930 O%(2)=8
 1940 O%(3)=1
 1950 O%(4)=2
 1960 O%(5)=3
 1970 O%(6)=4
 1980 O%(7)=5
 1990 O%(8)=6
 2000
 2010
 2020
 2030 DIM T%(8)
 2040 T%(1)=3
 2050 T%(2)=2
 2060 T%(3)=1
 2070 T%(4)=8
 2080 T%(5)=7
 2090 T%(6)=6
 2100 T%(7)=5
 2110 T%(8)=4
 2120
 2130 DIM S%(9)
 2140 S%(1)= 3
 2150 S%(2)= 4
 2160 S%(3)= 5
 2170 S%(4)= 6
 2180 S%(5)= 3
 2190 S%(6)= 2
 2200 S%(7)= 1
 2210 S%(8)= 8
 2220 S%(9)= 7
 2230
 2240
 2250 ENDPROC
 2260
 2270
 2280 DEFPROCK8055_init
 2290 REM  Typing errors in routine name do not generate an error message - they just hang up the program.
 2300 SYS"LoadLibrary","K8055D.dll" TO K8055_Board%
 2310 SYS"GetProcAddress",K8055_Board%,"OpenDevice" TO K8055_OpenDevice%
 2320 SYS"GetProcAddress",K8055_Board%,"ReadAnalogChannel" TO K8055_ReadAnalogue%
 2330 SYS"GetProcAddress",K8055_Board%,"SetAllDigital"  TO K8055_SetAllDigital%
 2340 SYS"GetProcAddress",K8055_Board%,"CloseDevice" TO K8055_CloseDevice%
 2350 SYS"GetProcAddress",K8055_Board%,"ClearAllDigital" TO K8055_ClearAllDigital%
 2360 SYS"GetProcAddress",K8055_Board%,"ClearDigitalChannel" TO K8055_ClearDigitalChannel%
 2370 SYS"GetProcAddress",K8055_Board%,"SetDigitalChannel" TO K8055_SetDigitalChannel%
 2380 SYS"GetProcAddress",K8055_Board%,"OutputAnalogChannel" TO K8055_OutputAnalogChannel%
 2390 SYS"GetProcAddress",K8055_Board%,"ClearAnalogChannel" TO K8055_ClearAnalogChannel%
 2400 SYS"GetProcAddress",K8055_Board%,"ClearAllAnalog" TO K8055_ClearAllAnalog%
 2410 SYS"GetProcAddress",K8055_Board%,"WriteAllDigital" TO K8055_WriteAllDigital%
 2420 ENDPROC




Return to the interfacing index
Back to the Limavady home page

Tudor with sign