I'm still not comfortable with passing character arrays, and I think this is the problem with this code:
It seems to return a blank string. If I substitute the last line with return "123456" ; then that displays OK, so I guess the fault is in the above.
This formatHours() function is called within a nested call, like this:
I have successfully used strLCD5XY() with string arguments, viz:
Code:
char * formatHours(int decimin) { // convert integer deci-mins (6 seconds) to string: "XXhYYm" byte hrs, mins ; char time[7] ; // global scratch variable txt4 is also char [7] hrs = decimin / (60 * 10) ; // convert 1/10s of a minute into hours mins = decimin % (60 * 10) ; // remainder of same division is minutes ByteToStr(hrs, txt4) ; time[0] = txt4[2] ; time[1] = txt4[3] ; time[2] = "h" ; ByteToStr(mins, txt4) ; time[3] = txt4[2] ; time[4] = txt4[3] ; time[5] = "m" ; return time ; }
It seems to return a blank string. If I substitute the last line with return "123456" ; then that displays OK, so I guess the fault is in the above.
This formatHours() function is called within a nested call, like this:
Code:
strLCD5XY(formatHours(resDeciMin), 48 , 5) ; // display on LCD in small font
Code:
char txt4[4] ; // do something to txt4 here ... strLCD5XY(txt4, 66, 2) ; // display on LCD in small font
Comment