BryanSw
- 23rd April 2015, 17:33
I know he passed away, but I'm looking for a file he had for using his Elasped timer for counting down rather then
counting up.
This is the demo code for it but it needs Elasped_DN.bas
' Define LCD connections
DEFINE LCD_DREG PORTC ' Set LCD Data port
DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTC ' Set LCD Register Select port
DEFINE LCD_RSBIT 2 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTC ' Set LCD Enable port
DEFINE LCD_EBIT 3 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us
DEFINE OSC 4
INCLUDE "Elapsed_DN.bas" ; Elapsed Timer Routines
ZERO_LED VAR PORTB.3
ANSEL = 0 ' All Digital
ANSELH = 0
LOW ZERO_LED ' start with LED OFF
OPTION_REG.7 = 0 ' enable PORTB pull-ups
PAUSE 250
LCDOUT $FE,1 ' Initialize LCD
PAUSE 250
Days = 1 ' set initial time
Hours = 1
Minutes = 3
Seconds = 10
GOSUB StartTimer ' Start the Elapsed Timer
Main:
CountDown = !PORTB.0
IF SecondsChanged = 1 THEN
SecondsChanged = 0
LCDOUT $FE,2, DEC Days,"d-",DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds
ENDIF
IF ZERO_LED != ZERO THEN ZERO_LED = ZERO
GOTO Main
If would be greatly appreciated is someone has this file they can share.
Thank you
counting up.
This is the demo code for it but it needs Elasped_DN.bas
' Define LCD connections
DEFINE LCD_DREG PORTC ' Set LCD Data port
DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTC ' Set LCD Register Select port
DEFINE LCD_RSBIT 2 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTC ' Set LCD Enable port
DEFINE LCD_EBIT 3 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us
DEFINE OSC 4
INCLUDE "Elapsed_DN.bas" ; Elapsed Timer Routines
ZERO_LED VAR PORTB.3
ANSEL = 0 ' All Digital
ANSELH = 0
LOW ZERO_LED ' start with LED OFF
OPTION_REG.7 = 0 ' enable PORTB pull-ups
PAUSE 250
LCDOUT $FE,1 ' Initialize LCD
PAUSE 250
Days = 1 ' set initial time
Hours = 1
Minutes = 3
Seconds = 10
GOSUB StartTimer ' Start the Elapsed Timer
Main:
CountDown = !PORTB.0
IF SecondsChanged = 1 THEN
SecondsChanged = 0
LCDOUT $FE,2, DEC Days,"d-",DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds
ENDIF
IF ZERO_LED != ZERO THEN ZERO_LED = ZERO
GOTO Main
If would be greatly appreciated is someone has this file they can share.
Thank you