20X2 4 Digit 7 Segment LED Counter
Oh No another Counter
Every one seems to love doing them.
push the button will count from 1 to 9999
and then reset
if your finger can go the distance.
Oh No another Counter
Every one seems to love doing them.
push the button will count from 1 to 9999
and then reset
if your finger can go the distance.
Code:
' -- -- -- -- -- -- -- --
' B0-A | | | | | | | |
' B1-B
' B2-C | | | | | | | |
' B3-D -- -- -- -- -- -- -- --
' B4-E | | | | | | | |
' B5-F
' B6-G | | | | | | | |
' B7- -- -- -- -- -- -- -- --
'
'Display 1 2 3 4
'Common anode C.3 C.2 C.1 c.0
main:
let dirsb = %11111111
let dirsc = %10111111
w0=0
start:w1=0
Display:
let b10 = w0 dig 3
if w0 < 1000 then bl10 'Zero blanking
lookup b10, (192,249,164,176,153,146,130,248,128,144),b10 '(0,1,2,3,4,5,6,7,8,9)
Dig1: high c.0 : let pinsb = b10 : low c.3 : pause 1 'Display1
let b11 = w0 dig 2
if w0 < 100 then bl11 'Zero blanking
lookup b11, (192,249,164,176,153,146,130,248,128,144),b11 '(0,1,2,3,4,5,6,7,8,9)
Dig2: high c.3 : let pinsb = b11 : low c.2 : pause 1 'Display2
let b12 = w0 dig 1
if w0 < 10 then bl12 'Zero blanking
lookup b12, (192,249,164,176,153,146,130,248,128,144),b12 '(0,1,2,3,4,5,6,7,8,9)
Dig3: high c.2 : let pinsb = b12 : low c.1 : pause 1 'Display3
let b13 = w0 dig 0
lookup b13, (192,249,164,176,153,146,130,248,128,144),b13 '(0,1,2,3,4,5,6,7,8,9)
Dig4: high c.1 : let pinsb = b13 : low c.0 : pause 1 'Display4
if pinc.6=0 then start 'reset ready for next count
s1:let w1=w1+1 'ignores button bounce
if w1>1 then display
if w0>9998 then main 'Reset after 9999 reached
let w0=w0+1 goto display 'Add count by 1
bl10: let b10 =255 goto Dig1
bl11: let b11 =255 goto Dig2
bl12: let b12 =255 goto Dig3
Attachments
-
115.8 KB Views: 166
-
170.2 KB Views: 261
Last edited: