fl { Dog Life Clock PropForth 5.5 2015/09/30 15:08:57 P0 ----- 150ohm -- SinglePhaseSteppMotor Coil -- P1 P2 ------- 10kohm ------3.3V | <----- Shorted when Dog is dead | GND Dog life(Shiba-inu) Human terms Dog Time/Human 1month 1year 83msec/1sec 2months 3years 42msec/1sec 3months 5years 42msec/1sec 6months 10years 50msec/1sec 1year 17years 71msec/1sec 1.5years 20years 167msec/1sec 2years 24years 125msec/1sec 3years 28years 250msec/1sec 4years 32years same as above 5years 36years same as above 6years 40years same as above 7years 44years same as above 8years 48years same as above 9years 52years same as above 10years 56years same as above 11years 60years same as above 12years 64years same as above 13years 70years same as above 14years 74years same as above 15years 78years same as above 16years 82years same as above 17years 86years same as above 18years 90years same as above RTC:DS1337 charLCD(controller:ST7032i) 2Line16Character Do 'saveforth' after loading this code. } : DOGLIFECLOCK ; \ =========================================================================== \ Constants \ =========================================================================== 0 wconstant out1 1 wconstant out2 2 wconstant contact contact >m constant Dead d220 wconstant cw_pulse \ 22msec (unit 100usec) { d6666666 constant 83msec d3333333 constant 42msec d4000000 constant 50msec d5714285 constant 71msec d13333333 constant 167msec d10000000 constant 125msec d20000000 constant 250msec } \ clockList/dogLifeList are for Shiba-inu variable clockList -4 allot d6666666 l, d3333333 l, d3333333 l, d4000000 l, d5714285 l, d13333333 l, d10000000 l, d20000000 l, variable dogLifeList -4 allot d31 w, d62 w, d93 w, d186 w, d365 w, d545 w, d730 w, d65535 w, variable Birthday -4 allot d2004 w, 1 w, 2 w, 5 w, \ 2004.1.2 Fri wvariable common_year -2 allot 0 w, d31 w, d59 w, d90 w, d120 w, d151 w, d181 w, d212 w, d243 w, d273 w, d304 w, d334 w, d365 w, wvariable leap_year -2 allot 0 w, d31 w, d60 w, d91 w, d121 w, d152 w, d182 w, d213 w, d244 w, d274 w, d305 w, d335 w, d366 w, \ =========================================================================== \ Variables \ =========================================================================== variable flag \ singleStepMotor pulse's polar variable dogTimeBase \ second-needle's speed variable Deadday 2 allot 0 w, 0 w, 0 w, variable livingDays \ Dog's livingdays from birthday to today[or Dethday] wvariable year wvariable month wvariable day wvariable weekday wvariable selList \ index for dogLifeList and clockList wvariable dogLifeBase \ index for second-needle's speed wvariable upperLine d25 allot \ 1st Line buffer on charLCD wvariable lowerLine d25 allot \ 2nd Line buffer on charLCD wvariable curDay \ today wvariable buffer \ Using when copying string \ Using when displaying string in upperLine/lowerLine to charLCD wvariable upStart wvariable upEnd wvariable upAddr wvariable lowStart wvariable lowEnd wvariable lowAddr wvariable LCD_pos \ =========================================================================== \ I2C \ =========================================================================== : err_msg ." I2C error" ; \ If error, print message \ ( n1 -- ) n1:t/f : err? if err_msg cr then ; : clr_bit_dira dira COG@ and dira COG! ; : set_bit_dira dira COG@ or dira COG! ; \ Start i2c-commnication \ This also can use SMBus device. \ ( -- ) lockdict create _eestart forthentry $C_a_lxasm w, h122 h113 1- tuck - h9 lshift or here W@ alignl h10 lshift or l, z1[ixnW l, z1[ixnX l, z2WyP[U l, z20iPak l, z3ryPW0 l, z1bixnW l, z2WyP[V l, z20iPak l, z3ryPW0 l, z1bixnX l, z1SV01X l, zl0 l, zCW l, zW0000 l, zG0000 l, freedict \ Re-defined RepeatedStart \ ( -- ) : Sr _eestart ; \ Stop i2c-commnication \ ( -- ) : _eestop _scli \ Release scl _sdai \ Release sda ; \ Fast-mode(400kHz) i2c \ =========================================================================== \ _eewrite ( c1 -- t/f ) write c1 to the eeprom, true if there was an error \ Received acknowledge from i2c-device during scl is high \ scl/sda use pull-up resistor at hi \ clock:400kHz lockdict create _eewrite forthentry $C_a_lxasm w, h12C h113 1- tuck - h9 lshift or here W@ alignl h10 lshift or l, z2WyPW8 l, z1YVPQ0 l, z1rixnd l, z1Sy\C] l, z1[ixne l, z1Sy\C] l, z1bixne l, zfyPO1 l, z3[yP[K l, z1[ixnd l, z1Sy\C] l, z1[ixne l, z1Sy\C] l, z1YF\Nl l, z1viPR6 l, z1bixne l, z1Sy\C] l, z1bixnd l, z1SV01X l, z2WyPc7 l, z20iPik l, z3ryPb0 l, z1SV000 l, zW0000 l, zG0000 l, freedict \ _eeread ( t/f -- c1 ) flag should be true is this is the last read \ scl/sda use pull-up resistor at hi \ clock:400kHz lockdict create _eeread forthentry $C_a_lxasm w, h12D h113 1- tuck - h9 lshift or here W@ alignl h10 lshift or l, z2WiPZB l, z2WyPO0 l, z1[ixne l, z2WyPj8 l, z1Sy\Ka l, z1[ixnf l, z1Sy\Ka l, z1XF\Vl l, znyPO1 l, z1bixnf l, z3[yPnN l, z26VPW0 l, z1rixne l, z1Sy\Ka l, z1[ixnf l, z1Sy\Ka l, z1bixnf l, z1bixne l, z1Sy\Ka l, z1SV01X l, z2WyPc9 l, z20iPik l, z3ryPb0 l, z1SV000 l, zW0000 l, zG0000 l, freedict \ Write series data to register in i2c_device \ ( n1..nn n2 n3 n4 -- t/f ) n1..nn:data n2:number n3:register n4:slave_address t/f:true if there was an error : i2c_wr_multi \ Start I2C _eestart \ Write slave address[wr], then receive Acknowledge-bit(ACK:Lo NACK:Hi) _eewrite \ ( n1..nn n2 n3 t/f ) \ Write register swap _eewrite or \ ( n1..nn n2 t/f ) swap \ ( n1..nn t/f n2 ) \ Read n2 byte dup 1 > if \ ( n1..nn t/f n2 ) 0 do \ ( n1..nn t/f ) swap _eewrite or \ ( n1.. nn t/f ) loop else \ ( n1 t/f n2 ) drop swap _eewrite or \ ( t/f ) then \ Stop I2C _eestop err? ; \ Read data from register in i2c_device \ ( n1 n2 -- n3 t/f ) n1:register n2:slave_address n3:data t/f:true if there was an error : i2c_rd \ Start I2C _eestart \ Write slave address[wr], then receive Acknowledge-bit(ACK:Lo NACK:Hi) tuck _eewrite \ ( n2 n1 t/f ) \ Write register swap _eewrite or \ ( n2 t/f ) swap \ ( t/f n2 ) \ Start read_process Sr \ Write slave address[rd], then receive Acknowledge-bit(ACK:Lo NACK:Hi) 1 or _eewrite or \ ( t/f ) \ Read 1byte ,then set sda to Hi(NACK:master->slave) -1 _eeread \ Stop I2C _eestop swap \ (n3 t/f ) err? \ ( n3 ) ; \ Read sereis data from series register in i2c_device \ ( n1 n2 n3 -- n4 . . nn t/f ) n1:number n2:register n3:slave_address n4..nn:series data t/f:true if there was an error : i2c_rd_multi \ Start I2C _eestart \ Write slave address[wr], then receive Acknowledge-bit(ACK:Lo NACK:Hi) tuck _eewrite \ ( n1 n3 n2 t/f ) \ Write register swap _eewrite or \ ( n1 n3 t/f ) swap \ ( n1 t/f n3 ) \ Repeated Start read_process Sr \ Write slave address[rd], then receive Acknowledge-bit(ACK:Lo NACK:Hi) 1 or _eewrite or \ ( n1 t/f ) \ Read (n1-1)bytes >r \ Push flag ( n1 ) dup 1 > if 1 - 0 do 0 _eeread \ ( n4..nn-1 ) loop else drop then \ Read 1byte ,then set sda to Hi(NACK:master->slave) -1 _eeread \ ( n4..nn ) r> \ Pop flag ( n4..nn t/f ) \ Stop I2C _eestop err? \ ( n4..nn ) ; \ =========================================================================== \ DS1337 \ =========================================================================== \ Slave addres[h68] for DS1337 hD0 wconstant DS1337 \ bcd> ( n1 -- n2 ) convert bcd byte n1 to hex byte n2 : bcd> dup hF and swap hF0 and 1 rshift dup 2 rshift + + ; \ >bcd ( n1 -- n2 ) convert hex byte n1 to bcd byte n2 : >bcd d10 u/mod 4 lshift + ; \ Get current time \ Read/Convert current time from DS1337 \ ( -- n1 n2 n3 n4 n5 n6 n7 ) \ n1 - second (00 - 59) \ n2 - minute (00 - 59) \ n3 - hour (00 - 23) \ n4 - day of week (Mon:1 Tue:2 Wed:3 Thur:4 Fri:5 Sat:6 San:7) \ n5 - date (01 - 31) \ n6 - month (01 - 12) \ n7 - yesr (2000 - 2099) : rd_current \ Read from Seconds to Year 7 0 DS1337 i2c_rd_multi ; \ Set current-time to DS1337 (24Hour mode) \ Set second to 0 \ ( n1 n2 n3 n4 n5 n6 -- ) \ n1 - yesr (00 - 99) \ n2 - month (01 - 12) \ n3 - date (01 - 31) \ n4 - day-of-week (Mon:1 Tue:2 Wed:3 Thur:4 Fri:5 Sat:6 San:7) \ n4 - hour (00 - 23) \ n5 - minute (00 - 59) : set_current \ Write 0 to status register 0 1 hF DS1337 i2c_wr_multi \ Clear OSF >bcd >r \ minute >bcd >r \ hour >r \ day-of-week >bcd >r \ day >bcd >r \ month d2000 - >bcd \ year r> r> r> r> r> 0 7 0 DS1337 i2c_wr_multi ; \ =========================================================================== \ i2c CharacterLCD(ST7032i) \ =========================================================================== \ Slave addres h3E for ST7032i h7C wconstant ST7032i h80 wconstant Co \ Co is added when not last command id sent h40 wconstant RS \ RS is added when data is sent wvariable char \ character number for using LCD [1,2,.. 16] wvariable line \ line number for using LCD [1,2] wvariable cur_line \ current line number [1,2] \ Used on word'lcd_dec' variable tmp wvariable result \ Send command to ST7032i \ ( n1 -- n2 ) n:command n2:t/f If there is error,true : lcd_com \ Start I2C _eestart \ Slave address ST7032i _eewrite \ ControlByte 0 _eewrite or \ DataByte swap _eewrite or \ Stop i2c _eestop err? ; \ Initialize ST7032i \ ( -- ) : lcd_init d50 delms \ Function set DL:8bit mode N:2-line DH:not double height font IS:normal instruction h38 lcd_com 1 delms \ Function set DL:8bit mode N:2-line DH:not double height font IS:extent instruction h39 lcd_com 1 delms \ Bias selection/internal OSC frequency adjust BS:bias=1/5 OSC:183Hz(3V) h14 lcd_com 1 delms \ Contrast set h73 lcd_com 1 delms \ Power/ICON control ICON:display off Bon:booster on Contrast HiByte:2 h56 lcd_com 1 delms \ Follow control Fon:internal foler curcuit on h6C lcd_com d200 delms \ Function set DL:8bit mode N:2-line DH:not double height font IS:normal instruction h38 lcd_com 1 delms \ Clear display 1 lcd_com 1 delms \ Display on/off D:display on C:cursol off B:blinl off hC lcd_com 1 delms ; \ Display character \ ( c -- ) c:character code : lcd_char \ Start I2C _eestart \ Slave address ST7032i _eewrite \ ControlByte RS _eewrite or \ DataByte swap _eewrite or \ Stop i2c _eestop err? ; \ Display string \ ( cstr -- ) cstr:string addr : lcd_str C@++ \ ( c-addr+1 c1 ) c-addr+1: string's first char addr c1:string length dup if bounds do i C@ lcd_char loop \ Print string else 2drop then ; \ Clear LCD-screen \ ( -- ) : lcd_clr 1 lcd_com d10 delms \ If no wait, next displayment is strange ; \ Adjust contrast \ ( n1 -- ) n1 contrast[0 to 64] : contrast \ Separate highByte and lowByte dup hFF and swap 4 rshift \ Function set h39 lcd_com 1 delms \ Set contrast highByte h54 or lcd_com 1 delms \ Set contrast lowByte h70 or lcd_com 1 delms \ Function set h38 lcd_com 1 delms ; \ Set position to (x,y) \ x -- horizontal pos : 1 to 16Characters \ y -- line number : 1 to 2Lines) \ DDRAM addres of 16X2 CHaracter-LCD \ 1Line [h00 ------ h0F] \ 2Line [h40 ------ h4F] \ ( x y -- ) : lcd_pos 2 / 1 = if h40 + then \ 2-line 1- \ x-1 h80 or lcd_com \ Set DDRAM Addr command ; \ =========================================================================== \ Main \ =========================================================================== lockdict create a_delay100us forthentry $C_a_lxasm w, h11C h113 1- tuck - h9 lshift or here W@ alignl h10 lshift or l, z1SyZKN l, z3[yPSJ l, z1SyLI[ l, z1SV01X l, z2WiP[R l, z20iPak l, z3ryPW0 l, z1SV000 l, z1vi l, freedict \ Move second needle \ ( -- ) : second \ Initial setting out1 pinout out2 pinout -1 flag L! dogTimeBase L@ cnt COG@ + begin \ Swiching output port to rotate second-needle toward cw flag L@ invert dup flag L! if out1 pinhi cw_pulse a_delay100us out1 pinlo else out2 pinhi cw_pulse a_delay100us out2 pinlo then dogTimeBase L@ waitcnt 0 until ; \ Check leap \ ( n1 -- n2 ) n1:year n2:1[leap] 0[normal] : leap? dup 4 u/mod drop 0= if 1 else 0 then ; \ Accumlate days \ ( n1 n2 n3 -- n1+n3 n2 ) n1:days n2:year n3:days : accumulate rot + swap ; \ --- Get days until today --- \ ( n1 n2 -- n1 n2 n3 ) n1:dys n2:year n3:days until today : daysUntilToday month W@ 1- 2* \ ( n1 n2 [month-1]*2 ) over leap? nip \ ( n1 n2 [month-1]*2 1/0 ) if leap_year + W@ \ Get days until today_month-1 else common_year + W@ \ Get days until today_month-1 then day W@ + \ ( n1 n2 n3 ) ; \ --- Get days until birthday --- \ ( n1 n2 -- n1 n2 n3 ) n1:dys n2:year n3:days-1 until birthday : daysUntilBirthday Birthday 2+ W@ 1- 2* \ ( n1 n2 [birthday_month-1]*2 ) 2 ST@ leap? nip \ ( n1 n2 [birthday_month-1]*2 1/0 ) if leap_year + W@ \ Get days until birthday_month-1 else common_year + W@ \ Get days until birthday_month-1 then Birthday 4 + W@ + 1- \ ( n1 n2 n3 ) ; : calc_living_days rd_current bcd> d2000 + year W! bcd> month W! bcd> day W! 3drop drop 0 Birthday W@ \ ( 0 birthday_year ) year W@ 1+ Birthday W@ - 0 do \ Check if birthday_year i 0 = if \ Check if this year is same as birthday year dup year W@ = if \ this year is same as birthday year daysUntilToday daysUntilBirthday else \ this year is different from birthday year leap? if d366 else d365 then daysUntilBirthday then - accumulate \ ( days birthday_year ) else \ Check if this year lasti? if \ this year daysUntilToday else \ Birthday_year < n < this year leap? \ ( days birthday_year 1/0 ) if d366 else 365 then \ ( days birthday_year 365/366 ) then accumulate \ ( days birthday_year ) then 1+ \ ( days birthday_year+1 ) loop drop ; \ Save character to buffer and increment address inside buffer \ ( c -- ) c:character code : buf_char buffer W@ C! 1 buffer W+! ; \ Save string to buffer \ ( cstr -- ) : buf_str C@++ \ ( c-addr+1 c1 ) c-addr+1: string's first char addr c1:string length dup if bounds do i C@ buf_char loop \ Print string else 2drop then ; \ Copy 4digit-number to buffer \ ( n1 -- ) n1:number : buf_dec4 0 result W! d1000 tmp W! 4 0 do dup tmp W@ >= \ Check if n is bigger than tmp if tmp W@ u/mod h30 + buf_char 1 result W! \ Print number-char else result W@ tmp W@ 1 = or if h30 else h20 then \ Print "0" or space buf_char then tmp L@ d10 u/ tmp W! \ Divide tmp by d10 loop drop ; \ Copy 2digit-number to buffer \ ( n1 -- ) n1:number : buf_dec2 dup d10 >= if d10 u/mod h30 + else h20 then buf_char h30 + buf_char ; \ Copy weekday to buffer \ ( n1 -- ) n1:weekday code : buf_weekday 7 and c" MONTUEWEDTHUFRISATSUN" 1+ swap 1 max 1- 3 u* + 3 0 do dup C@ buf_char 1+ loop drop ; \ Compare day from RTC and saved curDay \ ( n1 n2 -- n3 ) n1:day from RTC n2:previous saved day n3:1[both are same] 0[both are different] : dayCheck? = if 0 else 1 then ; \ Update current date and time on upper line of charLCD \ ( -- ) : updateDate rd_current \ Save date and time to upperLine buffer bcd> d2000 + upperLine buffer W! buf_dec4 \ year bcd> upperLine 5 + buffer W! buf_dec2 \ month bcd> dup curDay W@ dayCheck? if \ Update livingDays, curDay and dogLifeBase 1 livingDays W+! dup curDay W! dogLifeBase W@ 1- dogLifeBase W! then upperLine 8 + buffer W! buf_dec2 \ day upperLine d11 + buffer W! buf_weekday \ weekday bcd> upperLine d16 + buffer W! buf_dec2 \ hour bcd> upperLine d19 + buffer W! buf_dec2 \ minute bcd> upperLine d22 + buffer W! buf_dec2 \ sec ; \ Update living days \ ( -- ) : updateLivingdays \ Save livingDays to lowerLine buffer lowerLine d16 + buffer W! livingDays W@ buf_dec4 ; \ Save Birthday and char'(','')',':' to charLCD buffer \ ( -- ) : copyBirthday upperLine buffer W! c" . . ( ) : : " buf_str lowerLine buffer W! c" . . ( ) days " buf_str Birthday W@ lowerLine buffer W! buf_dec4 \ year Birthday 2+ W@ lowerLine 5 + buffer W! buf_dec2 \ month Birthday 4+ W@ lowerLine 8 + buffer W! buf_dec2 \ day Birthday 6 + W@ lowerLine d11 + buffer W! buf_weekday \ weekday ; \ Display low line on charLCD \ ( -- ) : scanLowLine \ Scan lowerLine lowerLine lowStart W! lowerLine d26 + lowEnd W! lowStart W@ lowAddr W! 1 2 lcd_pos \ Set position[1 2] on charLCD \ Set top position inside buffer LCD_pos W@ d27 = if lowStart W@ else lowStart W@ LCD_pos W@ + then lowAddr W! \ 16characterr d16 0 do lowAddr W@ C@ lcd_char \ Display 1char lowAddr W@ 1+ lowEnd W@ > \ Check if lowAddr > lowEnd if lowStart W@ lowAddr W! \ Set lowStart else 1 lowAddr W+! \ Increment lowAddr then loop ; \ Display charLCD \ ( -- ) : disp_charLCD \ Scan upperLine upperLine upStart W! upperLine d26 + upEnd W! upStart W@ upAddr W! 1 1 lcd_pos \ Set position[1 2] on charLCD \ Set top position inside buffer LCD_pos W@ d27 = if upStart W@ else upStart W@ LCD_pos W@ + then upAddr W! \ 16characterr d16 0 do upAddr W@ C@ lcd_char \ Display 1char upAddr W@ 1+ upEnd W@ > \ Check if upAddr > upEnd if upStart W@ upAddr W! \ Set upStart else 1 upAddr W+! \ Increment upAddr then loop \ Scan lowerLine scanLowLine ; \ Start text \ ( -- ) : startText 14 DS1337 i2c_rd drop \ Clean i2c-line because of not causing i2c_error by ST7032i \ Init charLCD lcd_init \ Extention mode h3D lcd_com 1 delms \ --- First statement --- c" DogLifeClock" lcd_str d3000 delms \ Normal mode h38 lcd_com 1 delms lcd_clr copyBirthday ; \ Check data in eeprom \ ( -- ) : eepromChk d32758 5 0 do dup EW@ swap 2+ loop drop \ Read year/month/day/livingdays dup 0 <> if 0 outa COG! \ Clear outa \ Save data livingDays W! weekday W! day W! month W! year W! \ Display Dog's birthday, Deathday and livingdays [inifinity loop] \ Display upper line [Birthday] Birthday W@ upperLine buffer W! buf_dec4 \ year Birthday 2+ W@ upperLine 5 + buffer W! buf_dec2 \ month Birthday 4+ W@ upperLine 8 + buffer W! buf_dec2 \ day Birthday 6 + W@ upperLine d11 + buffer W! buf_weekday \ weekday 1 1 lcd_pos upperLine d16 0 do dup C@ lcd_char 1+ loop drop \ Death day and livingdays year W@ bcd> d2000 + lowerLine buffer W! buf_dec4 \ year month W@ bcd> lowerLine 5 + buffer W! buf_dec2 \ month day W@ bcd> lowerLine 8 + buffer W! buf_dec2 \ day weekday W@ bcd> lowerLine d11 + buffer W! buf_weekday \ weekday lowerLine d16 + buffer W! livingDays W@ buf_dec4 \ livingdays startText begin d28 0 do i LCD_pos W! scanLowLine 1000 delms loop 0 until else 0 outa COG! \ Clear outa 3drop 2drop then ; \ **************************************************************** \ Analog clock indicate Dog's Time-stream. \ Upper on charLCD display current date and Time. \ Lower on charLCD display Dog's birthday and livingdays. \ \ I will connect pins of Dead_SW when Dog is dead. \ Analog clock stop and never moved. \ CharLCD display Dog's birthday and dead date and livingdays. \ **************************************************************** \ ( -- ) : DogLifeClock \ Check if Dog was dead eepromChk startText \ Select clock base calc_living_days dup livingDays W! 7 selList W! \ 7 is for Shiba-inu, another dog type is different value dogLifeList \ ( living_days doglife_list ) 7 0 do 2dup \ ( living_days doglife_list living_days doglife_list ) i 2 * + W@ <= if i selList W! 6 seti then loop 2drop \ Set dogTimeBase clockList selList W@ 4 * + L@ dogTimeBase L! \ --- Start clock-needle --- c" second" 0 cogx \ Set dogLifeBase dogLifeList selList W@ 2 * + W@ \ Get item of dogLifeList livingDays W@ - 1+ dogLifeBase W! \ Save current day 4 DS1337 i2c_rd bcd> curDay W! updateDate updateLivingdays begin d28 0 do \ Update year/month/day and living days updateDate updateLivingdays dogLifeBase W@ 0= if \ Update dogLifeBase, dogTimeBase dogLifeList selList W@ 1+ 2 * + W@ \ Get item of dogLifeList livingDays W@ - 1+ dogLifeBase W! clockList selList W@ 1+ 4 * + L@ \ Get item of clockList dogTimeBase L! then \ Check Dead contact ina COG@ Dead and 0= if \ Write dead day to eeprom whwn Dog is dead rd_current 32758 EW! 32760 EW! 32762 EW! 32764 EW! \ Write year/month/day/weekday to eeprom livingDays W@ 32766 EW! \ Write livingdays to eeprom d100 delms reboot then \ Display data on charLCD i LCD_pos W! disp_charLCD d500 delms loop \ fkey? swap drop \ until 0 until \ 0 cogreset ; \ Automatic operating at power-on : onreset1 onreset DogLifeClock ; { \ Delay word for unit 100usec \ ( n1 -- ) Delay time = n1 x 100usec \ $C_stTOS:n1 \ $C_treg1: fl build_BootOpt :rasm __1 jmpret __100usret , # __100us djnz $C_stTOS , # __1 spop jexit __100us mov $C_treg1 , __100usec add $C_treg1 , cnt waitcnt $C_treg1 , # 0 __100usret ret \ 5+(7996-18)=7983 __100usec d7983 ;asm a_delay100us } { \ Display time \ ( -- ) : test clkfreq cnt COG@ + begin rd_current bcd> . bcd> . bcd> . . bcd> . bcd> . bcd> . cr clkfreq waitcnt fkey? swap drop until drop ; \ Clear data in eeprom \ Using when writing data to eeprom by mistake \ ( -- ) : eepromClr d32758 5 0 do dup 0 swap EW! 2+ loop drop ; \ Read data from eeprom \ ( -- n1 n2 n3 n4 n5 ) : eepromRD d32758 5 0 do dup EW@ . 2+ loop drop ; }