Thanks, David. I much appreciate your quick response.
I'm working with your code, and the garbage seems to be gone. But I'm still not getting what the factory-flashed code used to display.
In the demo source, bat_test() calls read_battery_millivolts_sv168() and displays "165mV".
The "hold key while powering on" battery test calls analog_read_average(6, 10), and then to_millivolts(), and displays " VBAT ", "495 mV m".
With the original shipping code, both displayed approximately "5998 mV" for the 6V supply I'm using.
So there are a couple of things going on. I thought the trailing " m" is due to the uninitialized char array, but it is consistent from build to build. I removed the trailing space from print(" mV ") to see if more garbage would appear, but then the display read "-9115 mV".
I'll take a closer look at the source and try to improve my understanding of the different analog read facilities. Since I'm using a sv328, I'm wondering if bat_test() is calling the wrong lib routine.
Also, I should mention that this is my first exploration of AVR Studio, etc., and the Orang line. So I may be doing something supremely stupid...
Is there any way to obtain the actual code that's flashed in the current batch of sv328's? Comparing that code with what I've taken from the demo folder would be very informative.