LOBAT, a more reliable low-batteries test for programmers, by Joe Horn CAUTION! Load the version for your machine only! LOBAT.SX --> HP48 S or SX only. LOBAT.GX --> HP48 G or GX only. The 'ALERT' program by Preston Brown on Goodies Disk #1 checks the status of the "alert annunciator" (the low-battery and past-due alarm indicator). Although it is reliable for testing the annunciator, it is not a reliable method for testing the batteries, because the alert annunciator is only updated occasionally. Merely testing the annunciator itself does not actually perform the internal battery test. LOBAT does. The System-RPL version is short and fast: 17.5 bytes, 4 milliseconds. INSTRUCTIONS: INPUT: None. OUTPUT: 0 --> all 5 batteries are okay 1 --> main batteries (AAA) are low 2 --> Slot 2 RAM card battery is low 4 --> Slot 1 RAM card battery is low Multiple low-battery indications are added together; for example, if LOBAT returns 5, that would mean that the main batts *and* slot 1 are both low (because 5=1+4). Thus LOBAT can return any number from 0 to 7, with 1 through 7 indicating low batt(s). 'LOBAT' can therefore be used as a true/false test in programs. For example, DO ... UNTIL LOBAT END would exit a loop as soon as a low battery condition is detected. << DO IF LOBAT THEN 1400 .01 BEEP END UNTIL 0 END >> is silent for healthy batteries, but it begins to chirp when the main battery voltage gets down to about 3.2 volts, and soon begins to sound like a Geiger counter, and finally emits a non-stop noise when the voltage drops below about 3.15 volts. Values vary slightly from machine to machine. LOBAT ignores empty card slots. If a card slot has no RAM card installed, LOBAT will NOT give a low-battery indication for it. Note regarding I/O: The LOBAT program checks the low-batt condition *now*, not the low-batt condition that *will* happen *if* you start doing I/O. When the batteries are just barely above low-batt level, the LOBAT program returns a 0 (as it should), but then if you attempt I/O (which causes an immediate, heavy power drain) the batteries quickly fall below the low-batt threshold, and I/O is aborted. Often as not, the battery level just as quickly recovers (alkalines recover VERY quickly), and the low-batt condition disappears. This creates the illusion that I/O is detecting a low-batt condition that doesn't exist, or conversely that LOBAT is failing to detect a low-batt condition that does exist. The low-batt condition *did* exist, but only at the moment of attempted I/O. It's a threshold dilemma.