home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug099.arc
/
LED.WSF
< prev
next >
Wrap
Text File
|
1979-12-31
|
4KB
|
107 lines
LED Flasher
by Simon Carter
The 8 LED flasher is a very simple circuit that you can get hours
of fun from. It consists of 8 identical blocks, each containing
two resistors, a LED and a transistor.
Component List
$2.80 8 x 5mm Red LEDs
$0.40 8 x 82R Resistors
$0.40 8 x 2K2 Resistors
$1.52 8 x NPN BC548 transistor
$3.15 1 x DB15 plug
-------------------------------
$8.27 (Without cicuit board)
-------------------------------
Diagram 1a shows the complete circuit in a circular form, 1b shows
the basic circuit. If you wish you can have a row of LEDs instead
of a circle, by repeating diagram 1b eight times. Diagram 2 shows
the parallel port pinouts as seen on the soldering lug side of the
DB15 plug.
(1) Each LED is numbered as shown. To light
(128) (2) that LED, output its number to the parallel
(64) (4) port with an OUTL#1:OUT 0,X statement. To
(32) (8) display more than one LED, add their values.
(16)
The following Basic program uses the LED flasher circuit to full
effect. A Machine Code subroutine is called which displays a
duplicate of the output on the screen as well as running the
flasher circuit, enabling those without the flasher circuit to
still use the program. A negative (-) number in the LED data
indicates speed. The higher the number, the slower the speed. A
-10000 indicates the end of the data. All data is read once to
determine how much there is, an array is set up to hold the data
and speed factor, and the data is then read into it. Three groups
of four PCGs are needed to maintain a circular effect on the
screen. The first two bytes of M/C data (line 00290) indicate the
upper left corner of the display, allowing you to move it around.
00100 REM LED flasher routine V3 by Simon Carter 7/5/1988
00110 RESTORE 240:S=-255:OUTL#1:CLS
00120 READ D:IF D=>0:C=C+1
00130 IF D<>-10000 THEN 120
00140 RESTORE 240:DIM G(C,1)
00150 FOR C=1 TO C:READ D
00160 IF D<0:S=D:READ D
00170 G(C,0)=D:G(C,1)=S:NEXT C
00180 RESTORE 290:FOR I=28659 TO 29051:READ D:POKE I,D:NEXT I
00190 U=USR(28661)
00200 FOR C=1 TO C:FOR S=G(C,1) TO 0:NEXT S
00210 U=USR(28672,G(C,0))
00220 NEXT C:GOTO 200
00230 REM Data for LED display
00240 DATA -125,1,2,4,8,-100,16,32,64,-75,128,1,2,-50,4,8,16,32
00250 DATA -25,64,128,1,2,4,-1,8,16,32,64,128,1,2,4,8,16,32,-25
00260 DATA 64,128,1,-50,2,4,8,-75,16,32,64,128
00270 DATA -10000
00280 REM Data for POKEing from 28659 to 29051 Decimal
00290 DATA 86,241,33,188,112,17,16,252,1,192
00300 DATA 0,237,176,221,42,243,111,121,211,0
00310 DATA 203,71,32,10,221,54,6,193,221,54
00320 DATA 7,194,24,8,221,54,6,195,221,54
00330 DATA 7,196,203,127,32,10,221,54,66,197
00340 DATA 221,54,67,198,24,8,221,54,66,199
00350 DATA 221,54,67,200,203,79,32,10,221,54
00360 DATA 74,197,221,54,75,198,24,8,221,54
00370 DATA 74,199,221,54,75,200,17,140,0,221
00380 DATA 25,203,119,32,10,221,54,244,193,221
00390 DATA 54,245,194,24,8,221,54,244,195,221
00400 DATA 54,245,196,203,87,32,10,221,54,0
00410 DATA 193,221,54,1,194,24,8,221,54,0
00420 DATA 195,221,54,1,196,203,111,32,10,221
00430 DATA 54,54,201,221,54,55,202,24,8,221
00440 DATA 54,54,203,221,54,55,204,203,95,32
00450 DATA 10,221,54,62,201,221,54,63,202,24
00460 DATA 8,221,54,62,203,221,54,63,204,203
00470 DATA 103,32,9,221,54,122,193,221,54,123
00480 DATA 194,201,221,54,122,195,221,54,123,196,201
00490 REM Pcg Data
00500 DATA 0,0,0,15,48,64,128,128,128,128,64,48,15,0,0,0
00510 DATA 0,0,0,240,12,2,1,1,1,1,2,12,240,0,0,0
00520 DATA 0,0,0,15,63,127,255,255,255,255,127,63,15,0,0,0
00530 DATA 0,0,0,240,252,254,255,255,255,255,254,252,240,0,0,0
00540 DATA 15,48,64,128,128,128,128,64,48,15,0,0,0,0,0,0
00550 DATA 240,12,2,1,1,1,1,2,12,240,0,0,0,0,0,0
00560 DATA 15,63,127,255,255,255,255,127,63,15,0,0,0,0,0,0
00570 DATA 240,252,254,255,255,255,255,254,252,240,0,0,0,0,0,0
00580 DATA 0,0,0,0,0,0,15,48,64,128,128,128,128,64,48,15
00590 DATA 0,0,0,0,0,0,240,12,2,1,1,1,1,2,12,240
00600 DATA 0,0,0,0,0,0,15,63,127,255,255,255,255,127,63,15
00610 DATA 0,0,0,0,0,0,240,252,254,255,255,255,255,254,252,240
0600 DATA 0,0,0,0,0,0,15,63,127,255,255,255,25