ATtiny Balancer program is now !!!!!!!
It's just 2Uhr55-Gäääääähhhhhhhhhhn!
for a few minutes makes the ATtiny13
finally do what I want him to do it .......
thought (at least I, but quite as wars then
but not as yet a slight error was in it, which is
but now fixed and here already corrected.
now working port B0 so shall he, the serial
interface released but not yet programmed
.... Take it easy!)
was somehow not quite as easy as I very
thought at the beginning.
In the basic programming of the
learning package two of the five ports already for
registered the serial port (PB1 and PB2)
another (PB0) is related to the supply
I wanted to take as a balancer output
, but somehow hats not worked out, although
should go there actually.
(which I have yet had the opportunity
at times to get the serial port
that could again be very valuable
)
(Note 16.11. !!!!!!!) Problem is resolved
There's a kind of boot program on it, so that the
ATtiny always reprogram
can delete without long
and having to reset.
A so-called boot loader support, and
just the serial port on the
one example might read the battery voltage.
That would be the icing on the cake! And
basic requirement of due
display with power indicator, etc. Because I do not
Port PB0 persuaded to work
, I took hold Port PB1 as we went.
But now is not the serial line, but this has to be
create too.
Now you have to stop programming new classic
-who cares .......
Port PB0 is probably some way from
boot loader used. What is odd is that I
the Port by pulse-pause control
can use without problems, but not as
switching output. Other
overclock the balancer output
anyway, but I see no need for larger batteries
this.
(100Ah to)
I think the problem is solved
sein.Ich the block have now been programmed
anyway without a boot loader
, perhaps
would have been already, but the
I test some other time. been
(Note 16.11.
!!!!!!! issue is resolved, it really seems the boot loader to be
! there's a lot of
program is for an interface,
and used the port as
pulse breaks out, drum was the
initialized as such and to use for anything else
)
Current Status:
be ATtiny13 (must be replaced even by a
ATtiny13V because that is also specified for 1.8 V
, but otherwise identical)
The block is conceived as autonomous
running Balancers.
to Powers from the monitored cell.
Serial Spannungsauslesung provides
but have not.
A status LED or opto
can already be controlled.
Current switching limits:
Alarm below 2.5V or above 3.6V (pin2 high)
balancer switches at 3.5 V (pin 5 high)
This Values can be
0.0173 V steps change
The PIC uses its internal reference
of 1.1 V with 255-step analog to digital conversion
0.0043 V steps here at the ADC input. With the 4:1 voltage divider
(10k or 1k k3 +3 +330 R 0.1%)
arising 0.0173 V max at the "terminal"
with a measurement range up to 4.43 volts.
Here is the source:
(Note: corrected version as of 16:11:09)
; Regler1.asm, Balancer V 2.5 3.5 V 3.6 V 1.1 Ref;
; values for input or divider 4:1 10k/3k3 1k/330R 0.1%
; ADC to PIN3 (PB4): Ref: 1.1 V/255 V = 0.00431 is 0.0174 per unit
V, 2.5 V 0.62 V 144 3.5 V: 0 , 87:201 3.6 V: 0,89:207
; fault of PIN2 (PB3)
; balancer PIN5 (PB0)
include "tn13def.inc"
def A = r16; reading ADC
def B = r17;... ... GWU
def C = r18; GWbal
def D = r19; Gwo
def Delay = r20
def count = r21
rjmp start
Start: DDRB
sbi, 0, data direction PB0
sbi DDRB, 3; data direction. PB3
rcall AdcInit
powered1:
ldi A, 2; ADC2 to PB4
rcall RdADC
ldi B, 144, GWU: 0.62 V / 1.1 V * 255 = 144
ldi C, 207; Bal: 0.89 V / 1.1 V * 255 = 207
ldi D, 219; Gwo: 0.94 V / 1.1 V * 255 = 219
cp A, B; comparison GWU
brlo PB3ein
cp C, A; comparison Balancerspg
brlo PB0ein
cp A, C; comparison Balancerspg
brlo PB0aus
Schleife2:
cp D, A; comparison Gwo
brlo PB3ein
allesok: cbi PORTB
, 3; port3 disturbance from
rjmp powered1; next measurement
PB3ein:
sbi PORTB, 3; a disturbance
rjmp powered1; next measurement
PB0ein:
sbi PORTB, 0; Balancer
rjmp Schleife2, in comparison Gwo
PB0aus: cbi PORTB
, 0; Balancer
rjmp Schleife2, in comparison Gwo
AdcInit:
ldi A, 3; Clock / 4
out ADCSRA, A
sbi ADCSRA, ADEN, ret turn AD
RdADC:
out ADMUX, A
sbi ADMUX, ADLARES; adjust Left
sbi ADMUX, REFS0 , Use 1.1 VRef
sbi ADCSRA, ADSC; start conversion
ADrdy:
sbic ADCSRA, ADSC
rjmp ADrdy
sbi ADCSRA, ADSC
ADrdyb:
sbic ADCSRA, ADSC
rjmp ADrdyb
in A, ADCH
ret
That's it!
This is my very first ATtiny program!
Now that the worst errors are corrected
and the pins for the serial interface
are now free again,
I am very happy with it for now.
And with the serial data output for voltage monitoring
sure I'll get even
running, but not today ......
..... and probably not in the next
few days ..... I need some other things in order to bring
.... Father obligations offices .... .... Home renovation
tax return, clean up shop,
winter tires, garbage disposal, and so many other unpleasant
action ... there has accumulated quite what!
I shall probably an adapter tinker
where I can watch all off and inputs,
or five LED with series resistor
and switches and a potentiometer
for voltage setting,
then comes the test easier
probably the same with the programming
and read lines
A programming guide gives
another time. There must
Your request containing someone can
DERS already. Or make yourself smart. A bit of googling ........
On the homepage of the author of the learning package gives
the required software as an update to
Download!
www.b-kainka.de/lpmikros.htm
there is also the circuit diagram of the adapter
found, are just a few parts!
Here is the HEX data: (as of 16:11:09)
: 020000020000FC
: 1000000000C0B89ABB9A15D002E017D010E92FECC7
: 100010003BED011740F0201740F0021740F0301779
: 1000200010F0C398F1CFC39AEFCFC09AF8CFC09821
: 10003000F6CF03E006B9379A089507B93D9A3E9A7C
: 10004000369A3699FECF369A3699FECF05B1089585
: save 00000001FF
as BMS.HEX (only Tex)
and transferred to the ATTiny.
much fun!
This is unfortunately not yet at 2.5 v
be off then because the change
to the control limits must be adjusted and new
the source code compiled.
The reading of the values I imagine
currently preparing such a way that it happened in a kind
master-slave mode.
would have given but each module has a specially programmed PIC
have it, would
with special command for the answer, but addressing
then easier. Working software
this are in the learning package also at it,
long as the problem with port 0 not
is solved, you could use two PIC,
but as I said already, the go, and when I
the balancer off point!
A computer (if necessary terminal program)
sends the same number at all.
The addressed responds with its
ADC value-ready!
The conversion to readable values
(value x 0.0173 V) should not also
still in the PIC may be, at least as mV
would go straight.
This could all be connected in parallel, and the electronics
effort would be low.
Tensions should really only be interested if
does not fit.
The alarm when I over-and under-
Spannug together I
occur because not both can
, or explains the mistakes of the
situation.
Laden: Surge,
or failure of a balancer.
trip: may only be lower voltage.
For now, a PC could be connected
, but for the future, it
should already be a decent display.
(a new task .............)
up soon!
mfG
Franz
0 comments:
Post a Comment