;the only changes needed are calling the main program to set/get the variables [_MAKE_DT] ; assigns the reserved variables TIME$ and DATE$ $EXTERNAL _Byte2Str _Make_dt: call Getdatetime ; THIS IS IN THE MAIN PROG Loadadr Date$ , X ; get address of date$ Loadadr _month , Z ; get address of _month byte Ld r24,Z ; get first byte is month Rcall _byte2Str ; add to date string Ldi r24,47 ; add / St x+,r24 ; store Ld r24, -z ; get day rcall _byte2Str ; add to date string ldi r24,47 ; add / st x+,r24 ; store adiw zl,2 ; point to year ld r24,z ; get year rcall _byte2Str ; add to date string clr r24 ; string terminator st x+,r24 ; store tring terminator ;now do the time time$ must be dimmed after date$ ;this is handled by the compiler sbiw zl,2 ; go back ld r24,-z ; get hour rcall _byte2Str ; add to date string ldi r24,58 ; add : st x+,r24 ; store ld r24,-z ; get minutes rcall _byte2Str ; add to date string ldi r24,58 ; add : st x+,r24 ; store ld r24,-z ; get secs rcall _byte2Str ; add to date string clr r24 st x,r24 ; add null terminator Ret [END] [_SET_DATE] $EXTERNAL _Str2Byte ; assigns the date$ variable to the date bytes _set_date: Loadadr _month , X ; address of month byte Loadadr Date$ , Z ; point to date$ variable ld r24,z+ ; get month MSB ld r25,z+ ; get month LSB rcall _str2byte ; convert st x,r16 ; save month adiw zl,1 ; skip / ld r24,z+ ; get day MSB ld r25,z+ ; get day LSB rcall _str2byte ; convert st -x,r16 ; save day adiw zl,1 ; skip / ld r24,z+ ; get year MSB ld r25,z ; get year LSB rcall _str2byte ; convert adiw xl,2 ; point to year st x,r16 ; save year call SetDate ; calls the main program Ret [END] [_SET_TIME] $EXTERNAL _Str2Byte ;assigns the time$ variable to the time bytes of the clock _set_time: Loadadr _hour , X ; load address of hour Loadadr Time$ , Z ; point to time$ ld r24,z+ ; get hour MSB ld r25,z+ ; get hour LSB rcall _str2byte ; convert st x,r16 ; save hour adiw zl,1 ; skip : ld r24,z+ ; get minute MSB ld r25,z+ ; get minute LSB rcall _str2byte ; convert st -x,r16 ; save minutes adiw zl,1 ; skip : ld r24,z+ ; get seconds MSB ld r25,z ; get seconds LSB rcall _str2byte ; convert st -x,r16 ; save seconds call setTime Ret [END]