::
SaveSysFlags
BINT111
BINT2
CODE
SAVE
INTOFF
SKUB {
*start
!ARM
STMDB sp! { R4 R5 R6 R7 R8 LP }
MOV R2 $7C00000
ADD R2,R2 $0C
LDR R2,[R2]
STR R2,[R1 #2316]
LDMIA sp! { R4 R5 R6 R7 R8 PC }
!ASM
*end
}
C=RSTK D0=C
D1=80100
LC(5) end-start MOVEDN
LC 80100 ARMSAT
INTON
LC 003FF
A&C.A
GOSBVL PUSH#ALOOP
ENDCODE
* Edwin Cordoba's Excellent code
UNCOERCE
PTR 2F3C7
* Thanks to JYA for this ptr
* T = 50g F = 49g+
ITE
% .005859375
* % 6. % 1024. %/
% .00439453125
* % 4.5 % 1024. %/
%*
BINT2
DOFIX
DO>STR
CHR_V
>T$
$>grob
XYGROBDISP
SetDA1Temp
RestoreSysFlags
;
@
Edwin Córdoba.
On 8 nov, 15:44, "CRushton" <c.rush...@earthlink.net> wrote:
> The following program is an attempt to display the voltage for either the
> 49g+ or 50g.
>
> It uses Edwin Cordoba's code from BatStatus 1.3http://www.hpcalc.org/details.php?id=6400
> and detects which model based on a pointer posted by JYA.
>
> With new alkaline batteries, it displays 4.49V or 5.99V initially.
>
> With recently charged NiMH such as I use, it starts at ~4.2 or ~5.5.
>
> In addition it displays 0.00V if the 50g is powered by the USB cable.
>
> BTW, it works best with header = 2.
>
> ::
> SaveSysFlags
> BINT111
> BINT2
> CODE 00079
> 8FB9760808F70300F14D29EF1520A3EC002282E0002295EC092185E0F18DB8E071341F00108340300080B60340010880BFF808034FF3000EF68FC7530
> * Edwin Cordoba's Excellent code
> UNCOERCE
> PTR 2F3C7
> * Thanks to JYA for this ptr
> * T = 50g F = 49g+
> ITE
> % .005859375
> * % 6. % 1024. %/
> % .00439453125
> * % 4.5 % 1024. %/
> %*
> BINT2
> DOFIX
> DO>STR
> CHR_V
> >T$
> $>grob
> XYGROBDISP
> SetDA1Temp
> RestoreSysFlags
> ;
> @
>
> 131.5 bytes # 275Ch
>
> A shorter version can return just a real number to the stack. Enjoy.
>
> Chuck Rushton
www.hpcalc.org
***************
> < Edwin's code ob >
> UNCOERCE
> PTR 2F3C7
> ITE
> % .005859375
> % .00439453125
> %*
>
> (101.5 bytes # E281h)
>
> Chuck
>
made some measurements on a 50g (running the POWER factory-test):
hex V Message
----------------------------------
#3D1h 5.99 BATTERY NORMAL
#3D0h 5.97 ...
#3B8h 5.83 ...
#3B4h 5.82 ...
#37Dh 5.48
#376h 5.44
#345h 5.15
#333h 5.03
#310h 4.82 ...
#30Fh 4.82 BATTERY NORMAL
#30Eh 4.81 BATTERY WARNING
#302h 4.74 ...
#2FEh 4.72
#2F5h 4.68
#2C4h 4.36
#299h 4.10
#288h 4.00
#262h 3.69 (sporadic TTRM...)
lin-reg: y = .00614247*x ( -> ą.02V;-) compared to 1024/6 = .005859375
BTW: #3FEh is the max. value that is displayed even on 6.75V...