ok ill give that a go , the array that have been defined were existing sdc_buffer of 255bytes that i use for data transfer to spi chips so all this is about building the buffers ready to write the records for this section

i have the time in sec / laps count = lap time avg (result + remander) in sec

this then needs to be placed in to the record as days/hour/mins/sec/100th

here is the fisrt attempt in nbit math for this

Code:

'------- NbIT Math 32bit length get lap average time value -------------
glc_s = SDC_buffer[24] ' get the current lap count into tmp var ( Nmath wont allow indexed var)
@ MOVE?BP _glc_s,_Tmp32bit_1 ' copy lap value into tmp1
@ MATH_DIV _Tmp32bit_3,_Tmp32bit_1,_Result_32bit ' Tmp32bit_3 hold last lap time div total laps = lap time in secs , REg_Z holds remainder sec
@ MOVE?PB REG_Z, _glc_s ' copy sec remainder to tmp pbp var ( non indexed)
SDC_buffer[44] = glc_s ' copy remainder to AVG lap time 1/100th buffer
@ MOVE?CP 60,_Tmp32bit_1 ' copy 60 value into tmp1 for minutes div
@ MATH_DIV _Result_32bit,_Tmp32bit_1,_Tmp32bit_3 ' Result_32bit ( laps in sec div 60 = minutes Reg_Z holds remainder sec
@ MOVE?PB REG_Z, _glc_s ' copy min remainder to tmp pbp var ( non indexed)
SDC_buffer[45] = glc_s ' copy min remainder to AVG lap time secs buffer
@ MATH_DIV _Tmp32bit_3,_Tmp32bit_1,_Result_32bit ' _Tmp32bit_3 (laps in mins div 60 = hours ,Reg_Z holds remainder mins
@ MOVE?PB REG_Z, _glc_s ' copy hour remainder to tmp pbp var ( non indexed)
SDC_buffer[46] = glc_s ' copy hour remainder to AVG lap time mins buffer
@ MOVE?CP 24,_Tmp32bit_1 ' copy 24 value into tmp1 for days div
@ MATH_DIV _Result_32bit,_Tmp32bit_1,_Tmp32bit_3 ' Result_32bit ( laps in hours div 24 = days Reg_Z holds remainder hours
@ MOVE?PB REG_Z, _glc_s ' copy days remainder to tmp pbp var ( non indexed)
SDC_buffer[47] = glc_s ' copy days remainder to AVG lap time hours buffer
@ MOVE?PW _Tmp32bit_3,_glc_s ' copy days result to tmp pbp var ( byte size max value = 7)
glc_s = glc_s << 5 ' move day value to bit7-5 from bit2-0
SDC_buffer[47] = glc_s + SDC_buffer[47] ' assemble days + hours to AVG lap time day/hours buffer

## Bookmarks