CountDown Timer 3 Digit 7 Segment reusing an axe133 Board with (18m2)
Have been wanting to try driving a multiplexed display using an 18m2.
and using hardware TIME seems very accurate for seconds.
In this example our selected time is 120 seconds displayed at start.
output1 is OFF.
Push the button too start countdown.
output1 ON.
When counting down push the button to pause or continue at anytime.
output1 remains ON.
If we hold the button and release or if our countdown reaches zero.
it will reset and display 120
output1 will be OFF.
Added output2 will be HIGH for the last 10 seconds of countdown.
The RevEd Product code AXE132 is a standalone serialdriver board marked(axe133) complete with 18m2 and components
which we can reuse to make a great project board its well priced ! just dont tell no one lol !
http://www.techsupplies.co.uk/epages/Store.sf/en_GB/?ObjectPath=/Shops/Store.TechSupplies/Products/AXE132
It is also included with other products like
Product code AXE133 (serialdriverboard + budget LCD Display)
Product code AXE133Y(serialdriverboard + OLED Display)
I'll proberly be banned for advertising lol!
I still cant wait for product code AXE133B to appear.
I like a nice smooth supply for my picaxe and prefer to use a 47uf in place of vr1 see drawing .
Have been wanting to try driving a multiplexed display using an 18m2.
and using hardware TIME seems very accurate for seconds.
In this example our selected time is 120 seconds displayed at start.
output1 is OFF.
Push the button too start countdown.
output1 ON.
When counting down push the button to pause or continue at anytime.
output1 remains ON.
If we hold the button and release or if our countdown reaches zero.
it will reset and display 120
output1 will be OFF.
Added output2 will be HIGH for the last 10 seconds of countdown.
Code:
#picaxe 18m2 'version 2.D
' -- -- -- -- -- --
' B0-A | | | | | |
' B1-B
' B2-C | | | | | |
' B3-D -- -- -- -- -- -- MarkS
' B4-E | | | | | |
' B5-F
' B6-G | | | | | |
' B7-dp -- -- -- -- -- --
'
'Display 1 2 3
'Common anode C.2 C.1 C.0
SETFREQ M16
eeprom 0,(192,249,164,176,153,146,130,248,128,144,255) 'Display (0,1,2,3,4,5,6,7,8,9,blank)
SYMBOL pushbutton = PINC.5
SYMBOL output1 = C.7
SYMBOL output2 = C.6
SYMBOL display1 = C.2
SYMBOL display2 = C.1
SYMBOL display3 = C.0
SYMBOL push = B10
SYMBOL number = B11
SYMBOL secs = W6 'b12,b13
SYMBOL timer = W7 'b14,b15
LET dirsb = %11111111
LET dirsc = %11001111
ENABLETIME
Zero:
timer = 120 ' * timer = our selected secs to countdown ie (10-999) *
push = 0 ' reset menu
TIME = 0 ' reset Hardware M2 timer
Start:
secs=Timer-TIME
Control:
IF secs = Timer then low output1
else high output1 'output1 high when countingdown
endif
IF secs > 10 then low output2
else high output2 'output2 high when countingdown from 10 seconds
endif
Display:
number = 10 : IF secs < 100 THEN Dig1 'Display1 Zero blanking
LET number = secs /100
Dig1: READ number,pinsb : LOW display1 : PAUSE 1 : HIGH display1
IF secs < 10 THEN Dig2 'Display2 Zero blanking
LET number = secs //100/10
Dig2: READ number,pinsb : LOW display2 : PAUSE 1 : HIGH display2
LET number = secs //100//10
Dig3: READ number,pinsb : LOW display3 : PAUSE 1 : HIGH display3
IF pushbutton = 1 THEN Selection 'start or pause with a single press
IF secs = 0 THEN Zero 'once 0 is reached resets to our timer value
ON push GOTO Zero,Start,Display
Selection:
IF push = 2 THEN StopAndPause 'if we pause output1 remains high
Selection1:
INC push : PAUSE 1000 'at M16 1000ms/4
IF pushbutton = 1 THEN Selection1
ON push GOTO Zero,Start,Display
IF push > 2 THEN Zero 'if we hold our pusbutton resets to our timer value
StopAndPause:
push = 0
TIME = timer-secs
GOTO Start
which we can reuse to make a great project board its well priced ! just dont tell no one lol !
http://www.techsupplies.co.uk/epages/Store.sf/en_GB/?ObjectPath=/Shops/Store.TechSupplies/Products/AXE132
It is also included with other products like
Product code AXE133 (serialdriverboard + budget LCD Display)
Product code AXE133Y(serialdriverboard + OLED Display)
I'll proberly be banned for advertising lol!
I still cant wait for product code AXE133B to appear.
I like a nice smooth supply for my picaxe and prefer to use a 47uf in place of vr1 see drawing .
Attachments
-
270.7 KB Views: 223
Last edited: