I assume you are trying to achieve something like this where the minutes/seconds remain at a fixed location regardless of the other formatted field widths in either lap mode or not
its quite simple if you use a frame buffer for the lcd line and designate a frame address for each element to show, the fixed elements [that never change] can be set once off at code startup. you then just need to update each changeable element according to the rules/mode that currently apply when necessary. the display is updated from the buffer when necessary. its not only much faster it uses considerably less code space
Code:LCDBUFF VAR BYTE[12] lsecD0 var byte ext lminD0 var byte ext lhrsD0 var byte ext lapdD0 var byte ext lsecD1 var byte ext lminD1 var byte ext lhrsD1 var byte ext lapdD1 var byte ext LapDisplay VAR BYTE Lap VAR BYTE clear asm lsecD1 = _LCDBUFF + 8 lsecD0 = _LCDBUFF + 9 lminD1 = _LCDBUFF + 5 lminD0 = _LCDBUFF + 6 lhrsD0 = _LCDBUFF + 3 lhrsD1 = _LCDBUFF + 4 lapdD1 = _LCDBUFF lapdD0 = _LCDBUFF + 1 endasm arraywrite LCDBUFF,["LL h:mm:ss",0] GOSUB ResetTime GOSUB StartTimer GOSUB update pause 2000 hserout [ "Ready",13,10] Minutes = 8 LapDisplay = 0 Seconds = 55 hours = 9 main: IF MinutesChanged THEN LapDisplay = !LapDisplay MinutesChanged =0 ENDIF IF SecondsChanged THEN lap=lap+1 led=!led GOSUB update LCDout $FE,2, str LCDBUFF ; SecondsChanged = 0 ENDIF goto main update: lsecD1 = seconds dig 1 + "0" ;leading zero lsecD0 = seconds dig 0 + "0" lminD1 = Minutes dig 1 + "0" ;leading zero lminD0 = Minutes dig 0 + "0" IF LapDisplay THEN if (lap dig 1 ) then ;two digits left justify lapdD1 = lap dig 1 + "0" lapdD0 = lap dig 0 + "0" else ;one digits left justify lapdD1 = lap dig 0 + "0" lapdD0 = " " endif lhrsD1 = " " lhrsD0 = " " IF lminD1 == "0" THEN lminD1 = " " ;NO leading zero ELSE lhrsD1 = ":" lhrsD0 = Hours dig 0 + "0" lapdD1 = " " lapdD0 = " " ENDIF return


Reply With Quote

Bookmarks