Modelism - RHC Forum: Masurator de temperatura si tensiune - Modelism - RHC Forum

Salt la continut

Pagina 1 din 1

Masurator de temperatura si tensiune pentru orice model...

#1 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 08 December 2007 - 12:35 PM

Salut.

Din cand in cand apar probleme care trebuie rezolvate. Asadar si cand a aparut problema de a stii la ce tensiune ajunge pack-ul in sarcina si cat de tare se incalzeste motorul in zbor a trebuit gasita o rezolvare. Pentru asta am construit ce vedeti mai jos:

Imagini atasate

  • Imagine atasata: post-8-1197110105.jpg

0

#2 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 08 December 2007 - 12:37 PM

...cateva explicatii in plus...

Imagini atasate

  • Imagine atasata: post-8-1197110234.jpg

0

#3 Useril este offline   HESS 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 955
  • Inregistrat: 08-October 07

Postat 08 December 2007 - 12:39 PM

Misto, dar:
Ce iti raman inregistrate? (``maximul`` temp atinse de motor ); si care tensiune in sarcina? ( minima)
GAZ PE APA- sentiment de nedescris!
0

#4 Useril este offline   HESS 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 955
  • Inregistrat: 08-October 07

Postat 08 December 2007 - 12:40 PM

Scuze, am scris inainte de a posta tu a doua chestie....
Cate grame are dracia, si pe ce o pui?

Aceasta postare a fost editata de HESS: 08 December 2007 - 12:41 PM

GAZ PE APA- sentiment de nedescris!
0

#5 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 08 December 2007 - 12:53 PM

Se fac 10 citiri pe secunda si se memoreaza mareu valorile Umin, Tmin, Tmax, etc.
Device-ul se insereaza cu mufe Dean's pe firul care vine de la acumulatori catre electronica de pe avion si consuma 32mA cand masoara si 27 cand afiseaza.

Citirea si afisarea se face in inel adica timp de cateva secunde se afiseaza valoarea tensiunii si a temperaturii instantanee dupa care se afiseaza pentru scurt timp valoare Umin, apoi valoare Tmax si apoi valoarea Tmin dupa care ciclul se repeta iar se afiseaza valorile instantanee U si T apoi iat maximele si minimele.
Asadar cand veniti cu avionul sau Heli-ul jos puteti afla daca tensiunea de pe pack-ul vostru a ajuns vreodata la valori foarte mici ca sa va puna in pericol modelul.

Temperatura senzorului poate fi maxim 150 de grade dar motoarele termice nu trebuie sa depaseasca oricum 100-110 grade pe capul motorului.

Eu am unu montat pe un Heli Trex600 de cava timp si am facut o gramada de zboruri cu el in care am aflat ca sus, in sarcina, temperatura motorului urca destul de mult peste valoarea pe care o masori cand vii cu el jos dupa 20-secunde de hover.

Tensiunea maxima pe care o poate masura este de 25.6V dar nu se strica daca este conectat si la 40V.

Cantareste 27 grame echipat ca in prima poza.

Firmware-ul se poate upgrada pe conectorul lateral. Are 3 LED-uri pe spate din care cel verde indica fiecare masuratoare efectuata. Celelalte 2 LED-uri sunt pentru dezvoltari ulterioare.

Imagini atasate

  • Imagine atasata: post-8-1197111227.jpg

0

#6 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 08 December 2007 - 12:55 PM

Ba da' rapizi sunteti nici nu terminai sa pun toate trei pozele ca au si venit intrebari...bravo frate inseamna ca lumea citeste totsi acest forum... :(
0

#7 Useril este offline   HESS 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 955
  • Inregistrat: 08-October 07

Postat 08 December 2007 - 12:58 PM

:(

Pai ...logic ca citim!!! Zici ca l-ai facut tu, sau e cumparat???
GAZ PE APA- sentiment de nedescris!
0

#8 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 08 December 2007 - 01:00 PM

Home made... :(
0

#9 Useril este offline   HESS 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 955
  • Inregistrat: 08-October 07

Postat 08 December 2007 - 01:46 PM

Felicitari! Ti-a iesit! :(
GAZ PE APA- sentiment de nedescris!
0

#10 Useril este offline   OldMann 

  • MEGA Membru
  • PipPipPipPipPipPipPip
  • Grup: Members
  • Postari: 1762
  • Inregistrat: 01-September 06
  • Gender:Male
  • Location:Bucovina

Postat 08 December 2007 - 01:59 PM

pentru LCD ce procesor folosesti? legatura dintre procesor si LCD pe ce o faci ?
o documentatie, o schema de aplicatie?
la ATMEGA mergi pe clok intern sau extern?
...cablajul seamana a industrial.
...cum ai facut sa apara indicatiile de pe display ca nu e conectat la nimic.

Aceasta postare a fost editata de OldMann: 08 December 2007 - 02:05 PM

If the boat doesnt fly, dont buy!!!

0

#11 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 08 December 2007 - 02:25 PM

LCD-ul este bazat pe HD4470 Hitachi si are propriul lui procesor. AVR-ul doar ii spune ce sa afiseze. Legatura dintre ele se face pe magistrala display-ului, pe 4 biti ca sa fie mai putine trasee pe clablaj.

AVR-ul merge pe clock extern, ca sa merga mai repede. Intern merge la 1Mhz extern este la 10MHz, cu cristal. Poate ca am procedat asa si pentru ca aveam o gramada de rutine scrise pentru ciclu masina de 100ns si nu am vrut sa ma muncesc sa mai scriu pentru 1000ns adica 1us (1MHZ).

...cablajul este facut la comanda industrial. Motiv pentru care mai am inca 5 bucati pentru ca la fabrica mi-au facut 6 cablaje. Deci cine vrea putem discuta.

Cand apar indicatiile montajul este alimentat. Nu se vede poate in poza dar are un lipo de 2 celule conectat tocmai ca sa pot arata cum functioneaza.

Sper sa va placa si poate sa va si ajute.

Aceasta postare a fost editata de charlie: 08 December 2007 - 02:26 PM

0

#12 Useril este offline   OldMann 

  • MEGA Membru
  • PipPipPipPipPipPipPip
  • Grup: Members
  • Postari: 1762
  • Inregistrat: 01-September 06
  • Gender:Male
  • Location:Bucovina

Postat 09 December 2007 - 10:31 AM

o schema poate, ar fi de folos, eventual daca nu e secret un hexa.
If the boat doesnt fly, dont buy!!!

0

#13 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 09 December 2007 - 11:24 AM

Asa arata schema...

Imagini atasate

  • Imagine atasata: post-8-1197192246.jpg

0

#14 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 09 December 2007 - 11:50 AM

Si ASM-ul...prima parte


;*******************************************************************************
; File: pwr_mtr.asm
; Title: ATmega8 LCD in 4-bit mode (HD44780) temp Max and Min stored
; Assembler: AVR assembler/AVR Studio
; Version: 2.0
; Created: 28 now 2006
; Target uP: ATmega8
; Quartz: 10MHz 100ns for each instruction
; Autor: Corin
;_______________________________________________________________________________
____________
;Pin assignment ___________ ___________
; --PC6 =|1 U 28|= PC5-- --(RESET) PC6 =|1 U 28|= PC5-- (ADC5/SCL) ;

--PD0 =|2 27|= PC4-- --(RXD) PD0 =|2 27|= PC4-- (ADC4/SDA)
; --PD1 =|3 A 26|= PC3-- --(TXD) PD1 =|3 A 26|= PC3-- (ADC3)
; --PD2 =|4 T 25|= PC2-- --(INT0) PD2 =|4 T 25|= PC2-- (ADC2)
; --PD3 =|5 24|= PC1-- --(INT1) PD3 =|5 24|= PC1-- (ADC1)
; --PD4 =|6 M 23|= PC0-- --(XCK/T0) PD4 =|6 M 23|= PC0-- (ADC0)
; --VCC =|7 e 22|= GND-- -- VCC =|7 e 22|= GND--
; --GND =|8 g 21|= AREF-- -- GND =|8 g 21|= AREF--
; --PB6 =|9 a 20|= AVCC-- --(XTAL1) PB6 =|9 a 20|= AVCC--
; --PB7 =|10 19|= PB5-- --(XTAL2) PB7 =|10 19|= PB5-- (SCK)
; --PD5 =|11 8 18|= PB4-- --(T1) PD5 =|11 8 18|= PB4-- (MISO)
; --PD6 =|12 17|= PB3-- --(AIN0) PD6 =|12 17|= PB3-- (MOSI/OC2)
; --PD7 =|13 16|= PB2-- --(AIN1) PD7 =|13 16|= PB2-- (SS/OC1B)
; --PB0 =|14__ __15|= PB1-- --(ICP1) PB0 =|14__ __15|= PB1-- (OC1A)
; ___________ _____
; RST RST --PC6 =|1 U 28|= PC5-- | L | LCD_Pin 1 VSS
; RS RS --PD0 =|2 27|= PC4-- | C | LCD_Pin 2 VDD +5Vmax
; RW --PD1 =|3 A 26|= PC3--ADC3 | D | LCD_Pin 3 VO for LCD
; RW E --PD2 =|4 T 25|= PC2--ADC2 | | LCD_Pin 4 RS
; E D4 --PD3 =|5 24|= PC1--ADC1 | D | LCD_Pin 5 R/W
; D4 D5 --PD4 =|6 M 23|= PC0--ADC0 | I | LCD_Pin 6 ENA
; --VCC =|7 e 22|= GND-- | S | LCD_Pin 7 D0 Pin 15 Backlite -
; --GND =|8 g 21|= AREF-- | P | LCD_Pin 8 D1 Pin 15 Backlite + 5V
; --PB6 =|9 a 20|= AVCC-- | L | LCD_Pin 9 D2
; --PB7 =|10 19|= PB5--STST | A | LCD_Pin 10 D3
; D5 Fin --PD5 =|11 8 18|= PB4--UP | Y | LCD_Pin 11 D4
; D6 D6 --PD6 =|12 17|= PB3--DW | | LCD_Pin 12 D5
; D7 D7 --PD7 =|13 16|= PB2--PWM | | LCD_Pin 13 D6
; TACHO --PB0 =|14__ __15|= PB1--PWM |___| LCD_Pin 14 D7
;
; ________________________________________________________________________________
__________
;| Definitions |
;|___________________________________________________________________________
_______________|
.include "c:\program files\atmel\avr Tools\AVRAssembler\appnotes\m8def.inc"

; VARIABLES
;low registers
.DEF counter0 = R0
.DEF KL = R1
.DEF KM = R2
.DEF KH = R3
.DEF compareL = R4
.DEF compareH = R5
.DEF TminL = R6 ;TempLow_L low byte
.DEF TminH = R7 ;TempLow_H high byte
.DEF VbatL = R8 ;
.DEF VbatH = R9
.DEF TmaxL = R10 ;Temp_high_L low byte
.DEF TmaxH = R11 ;Temp_high_H high byte
.DEF tBCD0 = R12 ;BCD value digits 1 and 0
.DEF tBCD1 = R13 ;BCD value digits 3 and 2
.DEF tBCD2 = R14 ;BCD value digits 4 and 5
.DEF tBCD3 = R15 ;BCD value digits 6 and 7

;high registers
.DEF tempL = R16 ;temporary working register Low part
.DEF tempH = R17 ;temporary working register High part
.DEF argL = R18 ;argument for calling subrutines Low part
.DEF argH = R19 ;argument for calling subrutines High part
.DEF counter = R20
.DEF return = R21 ;return value from subroutines
.DEF fbinL = R22
.DEF fbinM = R23
.DEF fbinH = R24
.DEF Pwidth = R25
.DEF contor = R26
.DEF rxbyte = R27
;.DEF XL = R26 ;X register pair LO byte
;.DEF XH = R27 ;X register pair HI byte
;.DEF YLO = R28 ;Y register pair LO byte
;.DEF YHI = R29 ;Y register pair HI byte
;.DEF ZL = R30 ;Z register pair LO byte m8def.inc
;.DEF ZH = R31 ;Z register pair HI byte m8def.inc


.equ AtBCD0 =12 ;address of tBCD0
.equ AtBCD1 =13 ;address of tBCD1
.equ AtBCD2 =14 ;address of tBCD2
.equ AtBCD3 =15 ;address of tBCD3

.equ LCD_RS = 0
.equ LCD_RW = 2
.equ LCD_E = 3
.equ TACHO = 0


;_______________________________________________________________________________
________
.CSEG ; Code-Segment starts here
.ORG 0x00 ;Start of program code is 0x0000 in FRAM
rjmp reset
nop

reset:
ldi tempL, low(RAMEND)
out SPL, tempL
ldi tempL, high(RAMEND)
out SPH, tempL

;_________ Kill the watchdog __________________________________________________________

ldi tempL, 0x1F ;set WD to longest delay, and set WDTOE high
out WDTCR, tempL
ldi tempL, 0x17 ;to turn off WDE
out WDTCR, tempL ;and kill the watchdog
;
;_________ Initialize registers ________________________________________________________

clr Pwidth
clr argL
clr tempL

out TCCR1A, tempL
out TCCR1B, tempL
out TCNT1H, tempL
out TCNT1L, tempL
out OCR1AH, tempL
out OCR1AL, tempL

;_________ Set the TIMER 1 _____________________________________________________________
; ___________________________________________________________________
;TCCR1A | COM1A1 | COM1A0 | COM1B1 | COM1B0 | FOC1A | FOC1B | WGM11 | WGM10 |
; |___B7___|___B6___|___B5___|___B4___|___B3__|___B2__|___B1__|___B0__|
; 1 0 1 1 0 0 0 1 =0x91

; ldi tempL, 0xB1 ;Set PWM Mode=5, , OC1=0 on Compare Match, OC2=1 on Compare Match.
ldi tempL, 0x00 ;Normal port operation, no PWM.No output compare.
out TCCR1A, tempL
; ___________________________________________________________________
;TCCR1B | ICNC1 | ICES1 | - 0| WGM13 | WGM12 | CS12 | CS11 | CS10 |
; |___B7___|___B6___|___B5___|___B4___|___B3__|___B2__|___B1__|___B0__|
; 0 0 0 0 1 0 0 1 =0x0B9
;
; ldi tempL, 0x09 ;for PWM operation
ldi tempL, 0x00 ;CS10=0 no clock source
out TCCR1B, tempL
;
;B7-B4 overides the normal function of OC1A & OC1B pins in PORT B
; TCCR1B Bits 7 6 5 4 3 2 1 0
; x x x x x 0 0 0 ;No Clock Q=16MHz Q=10MHz :256
; x x x x x 0 0 1 ;cK IO / 1 16MHz 10MHz 39062Hz
; x x x x x 0 1 0 ;cK IO / 8 2MHz 1.2MHz 4882Hz
; x x x x x 0 1 1 ;cK IO / 64 250KHz 156250Hz 610Hz
; x x x x x 1 0 0 ;cK IO / 256 62.5KHz 39062.5Hz
; x x x x x 1 0 1 ;cK IO / 1024 15.625KHz 9765.625Hz
; x x x x x 1 1 0 ;cK IO / External clock on T1 pin. Falling edge.
; x x x x x 1 1 1 ;cK IO / External clock on T1 pin. Rising edge
;
; ____________________________________________________________________
;TIMSK | OCIE2 | TOIE2 | TICIE1 | OCIE1A | OCIE1B | TOIE1 | - | TOIE0 |
; |___B7___|___B6___|___B5___|___B4___|___B3___|___B2__|___B1__|___B0__|
; 0 0 0 0 0 0 0 0 =0x00
ldi tempL, 0x00
out TIMSK, tempL
;
;Cazul nostru TIMER 1 va functiona in FAST PWM MODE 5 folosind doar 8biti
;Counterul numara de la BOTTOM pana la TOP si apoi sare la BOTTOM in mod continuu.
;OC1A devine 0 la fiecare Comapare Match si devine 1 cand se atinge TOP.
;OC1B devine 1 la fiecare Comapare Match si devine 0 cand se atinge TOP.(invers A)

;Setting the OC1A & OC1B pins in PORT B (PB1 & PB2)
;Set Port B
; ;76543210
ldi tempL, 0x06 ;00000110, setting bits for OC1A, OC1B
out DDRB, tempL ;set Port B direction as output and input
ldi tempL, 0x00 ;00000000, seting OC1B low, OC1A low, all to zero for no pullup
out PORTB, tempL ;set Port B as output

;Load OCR1A=Pwidth initial value
;OCR1B=Pwidth initial value
ldi tempL, 10
mov Pwidth, tempL ;PWidth=10
clr tempL
out OCR1AH, tempL
out OCR1AL, Pwidth ;Now we have Pwidth in OCR1A
out OCR1BH, tempL
out OCR1BL, Pwidth ;Now we have Pwidth in OCR1B

;_________ USART configuration _______________________________________________________
;.def tmp = r16
;.def txbyte = r17
;.def rxbyte = r18
;.equ fclock = 11059200
.equ fclock = 10000000
.equ baud_rate = 9600
.equ ubbr_value = (fclock/(16*baud_rate)) - 1


;_________ Set ADC configuration _____________________________________________________
;
; ___________________________________________________________________
;ADCSRA | ADEN | ADSC | ADFR | ADIF | ADIE | ADPS2 | ADPS1 | ADPS0 |
; |___B7___|___B6___|___B5___|___B4___|___B3__|___B2__|___B1__|___B0__|
; 1 0 0 0 0 1 1 1 =0x87
; ADCSRA Bits 7 6 5 4 3 2 1 0
; x x x x x 0 0 0 ;ck / 2 Q=16MHz Q=10MHz
; x x x x x 0 0 1 ;cK / 2 8MHz 5MHz to big
; x x x x x 0 1 0 ;cK / 4 8MHz 5MHz to big
; x x x x x 0 1 1 ;cK / 8 4MHz 2.5MHz to big
; x x x x x 1 0 0 ;cK / 16 2MHz 1.25MHz to big
; x x x x x 1 0 1 ;cK / 32 1MHz 0.625MHz to big
; x x x x x 1 1 0 ;cK / 64 0.5MHz 312.5KHz to big
; x x x x x 1 1 1 ;cK / 128 0.25MHz 156.25KHz OK

ldi tempL, 0x87 ;set ADC status. Set ADEN=1, ADSC=0, prescale=2, ADC one shoot
out ADCSR, tempL ;conversion will start when ADSC will be set to 1
; ___________________________________________________________________
;ADMUX | REFS1 | REFS0 | ADLAR | - | MUX3 | MUX2 | MUX1 | MUX0 |
; |___B7___|___B6___|___B5___|___B4___|___B3__|___B2__|___B1__|___B0__|
; 1 1 0 0 0 0 0 0 =0xC0
; 1 1 0 0 1 1 1

0 =0xCE for 1,23 Voltage reference
ldi tempL, 0xC0 ;set Reference to internal 2.56V voltage with external capacitor
out ADMUX, tempL ;and select the MUX input to be the first chanel ADC0.


clr tempL ;00000000 - all tristate inputs. Also see ADSR register
out DDRC, tempL ;set Port C direction to inputs
ldi tempL, 0x00 ;all to zero for no pullup on input
out PORTC, tempL ;set Port C

ldi tempL,0b00000111;00000111 - "1" is output.
out DDRB, tempL ;set Port C direction
ldi tempL, 0x00 ;all to zero for no pullup on input
out PORTB, tempL ;set Port B

;*******************************************************************************
*****************************************
;*******************************************************************************
*****************************************
;***************************** ****************************
;***************************** M A I N

**************************** *
;***************************** ****************************
;*******************************************************************************
*****************************************
;*******************************************************************************
*****************************************
main:
clr R0
clr R1
clr R2
clr R3
clr R4
clr R5
clr R6
clr R7
clr R8
clr R9
clr R10
clr R11
clr R12
clr R13
clr R14
clr R15
clr R16
clr R17
clr R18
clr R19
clr R20
clr R21
clr R22
clr R23
clr R24
clr R25
clr R26
clr R27
clr R28
clr R29
clr R30
clr R31


test_LED:
cbi PORTB,0
rcall tau100ms
sbi PORTB,0
rcall tau100ms
rcall tau100ms

cbi PORTB,1
rcall tau100ms
sbi PORTB,1
rcall tau100ms
rcall tau100ms

cbi PORTB,2
rcall tau100ms
sbi PORTB,2
rcall tau100ms
rcall tau100ms


rcall LCD_init ;Display initialize

ldi argL,0x0C ;Cursor OFF
rcall LCD_command

ldi argL,0x01 ;Set the argument with the ERASE Byte 01hex
rcall LCD_command ;ERASE DISPLAY

;Display Mesaj1='Welcome'
ldi argL,0x80 ;pun in argL adresa unde vreau sa afisez
rcall LCD_command ;am setat deja adresa de afisare
ldi ZH,high(2*Mesaj1) ;pun in XL adresa lui Mesaj1 si inmultesc cu 2
ldi ZL,low(2*Mesaj1) ;pentru ca Z lucreaza cu cei 15 biti de sus din ZH:ZL
rcall DY_Msg ;chem rutina cu care afisez Mesaj1='Welcome'
rcall tau500ms


;Save initial values of Temp and Vbat for the first comparision
rcall Get_U1 ;Get Vbat In ADCH,ADCL voi avea rezultatul
rcall Get_U1 ;dece trebuie citit de doua ori nu am reusit sa ma prind
in fbinL,ADCL ;
in fbinM,ADCH ;
mov VbatL,fbinL ;save ADCH:ADCL to VbatH:VbatL
mov VbatH,fbinM

rcall Get_U7 ;Get Temp In ADCH,ADCL voi avea rezultatul
rcall Get_U7 ;dece trebuie citit de doua ori nu am reusit sa ma prind
in fbinL,ADCL ;
in fbinM,ADCH ;
mov TmaxL,fbinL ;save ADCH:ADCL to maximum value register
mov TmaxH,fbinM
mov TminL,fbinL ;save ADCH:ADCL to minimum value registers
mov TminH,fbinM

go_again:

ldi contor,40 ;cat arata acest numar de atatea ori citesc dupa care afisez Tmax si Umin
run:
ldi argL,0x01 ;Set the argument with the ERASE Byte 01hex
rcall LCD_command ;ERASE DISPLAY

;T_______T_______T_______T_______T_______T_______T_______T_______T_______T______
_T_______T_______T_______T_______T_______T_____

__
;Validate "compare" with Tmax
rcall Get_U7 ;Get Temp In ADCH,ADCL voi avea rezultatul
in fbinL,ADCL ;
in fbinM,ADCH ;
mov compareL,fbinL ;save ADCH:ADCL to compareH:compareL
mov compareH,fbinM
;compare ACTUAL versus STORED temperature
cp compareL,TmaxL ;Compare low byte. Note: The contents of "compareL" will be overwritten.
cpc compareH,TmaxH ;Compare high byte with carry from previous operation
brne noteq_Tmax ;
rjmp fix_eq_Tmax ;
noteq_Tmax:
brcc bigger_Tmax ;sar la bigger_T daca ACTUAL > STORED
;otherwise compareH:L is LESS then the actual measured value
rjmp less_Tmax
bigger_Tmax:
;ACTUAL >= STORED TH:TL we have to store the new Tmax
in fbinL,ADCL ;Get Temp si in ADCH,ADCL voi avea rezultatul
in fbinM,ADCH ;
mov TmaxL,fbinL ;save ADCH:ADCL into compareH:compareL
mov TmaxH,fbinM ;now the new bigger value is stored in TH:TL
fix_eq_Tmax:
less_Tmax: ;continue
rcall ADC_to_DY ;pregatesc valoarea pentru afisare
rcall DY_U7 ;display TEMP

;Validate "compare" with Tmin
rcall Get_U7 ;Get Temp In ADCH,ADCL voi avea rezultatul
in fbinL,ADCL ;
in fbinM,ADCH ;
mov compareL,fbinL ;save ADCH:ADCL to compareH:compareL
mov compareH,fbinM
;compare ACTUAL versus STORED temperature
cp compareL,TminL ;Compare low byte. Note: The contents of "compareL" will be overwritten.
cpc compareH,TminH ;Compare high byte with carry from previous operation
brne noteq_Tmin ;
rjmp fix_eq_Tmin ;
noteq_Tmin:
brcc bigger_Tmin ;sar la bigger_T daca ACTUAL > STORED
;otherwise compareH:L is LESS then the actual measured value
rjmp less_Tmin
less_Tmin:
;ACTUAL <= STORED TminH:TminL we have to store the new Tmin
in fbinL,ADCL ;Get Temp si in ADCH,ADCL voi avea rezultatul
in fbinM,ADCH ;
mov TminL,fbinL ;save ADCH:ADCL into compareH:compareL
mov TminH,fbinM ;now the new bigger value is stored in TH:TL

bigger_Tmin:
fix_eq_Tmin: ;continue
rcall ADC_to_DY ;pregatesc valoarea pentru afisare
rcall DY_U7


;VBAT_____VBAT_____VBAT_____VBAT_____VBAT_____VBAT_____VBAT_____VBAT_____VBAT___
__VBAT_____VBAT_____VBAT_____VBAT_____VBAT_____
rcall Get_U1 ;Get Vbat In ADCH,ADCL voi avea rezultatul
rcall Get_U1
in fbinL,ADCL ;
in fbinM,ADCH ;
mov compareL,fbinL ;save ADCH:ADCL to compareH:compareL
mov compareH,fbinM
;compare ACTUAL versus STORED battery voltage
cp compareL,VbatL ;Compare low byte. Note: The contents of "compareL" will be overwritten.
cpc compareH,VbatH ;Compare high byte with carry from previous operation
brne noteq_Vbat ;
rjmp fix_eq_Vbat ;
noteq_Vbat:
brcc bigger_Vbat ;sar la bigger_T daca ACTUAL > STORED
;ACTUAL =< STORED VbatH:VbatL we have to store the new values for TH:TL
less_Vbat:
in fbinL,ADCL ;Get Temp In ADCH,ADCL voi avea rezultatul
in fbinM,ADCH ;
mov VbatL,fbinL ;save ADCH:ADCL into compareH:compareL
mov VbatH,fbinM ;now the new bigger value is stored in TH:TL
bigger_Vbat:
fix_eq_Vbat:
continue_Vbat: ;continue
rcall ADC_to_DY ;pregatesc valoarea pentru afisare
rcall DY_U1 ;display VBAT

rcall blink_LED_Green


dec contor
brne run


;Min___Max___Min___Max___Min___Max___Min___Max___Min___Max___Min___Max___Min___M
ax___Min___Max___Min___Max___Min___Max___Min___

ldi argL,0x80 ;setez argL=80h
rcall LCD_command
rcall STORED_Vbat_to_DY
call DY_Umin
rcall tau500ms
rcall tau500ms


ldi argL,0x80 ;setez argL=80h
rcall LCD_command
rcall STORED_Tmax_to_DY
rcall DY_Tmax
rcall tau500ms
rcall tau500ms


ldi argL,0x80 ;setez argL=80h
rcall LCD_command
rcall STORED_Tmin_to_DY
rcall DY_Tmin
rcall tau500ms
rcall tau500ms


rjmp go_again
0

#15 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 09 December 2007 - 11:51 AM

si ASM-ul partea a doua...rutinele:


;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
;@@@@@@@@@@@@@@@@@@@@@@@ ROUTINES @@@@@@@@@@@@@@@@@@@@@@@
;@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;_______________________________________________________________________________
__________________________________
;STORED_Vbat_to_DY| -rutina preia valoarea din registrii de stocare temporara VbatH:VbatL si o pregateste pentru

afisare
;_________________| -ADCH:ADCL contin argumentul
; -fbinH:fbinM:fbinL contin rezultaul inmultirii cu 26.26 (corectia ADC-ului)
; -se cheama rutina bin3BCD24 pentru conversie in BCD
; -in tBCD3_tBCD2_tBCD1_tBCD0 voi avea rezultatul. tBCD3 este MSB, tBCD0 este LSB.
; -se folosesc registrii R23:R22:R21:R20:R19:R18:R17:R16
STORED_Vbat_to_DY:
;pregatesc inmultirea cu 26.26 pentru corectia ADC-ului
;r23:r22 * r21:r20 = R19:R18:R17:R16 (argH:argL:tempH:tempL)
;in R23:R22 am deja fbinM:fbinL adica ADCH:L
;in R21:R20 voi pune 2626 (0A42) cifra cu care inmultesc ADC-ul
mov fbinL,VbatL ;pun in fbinL(R22) ADCL, ADCL trebuie citit primul
mov fbinM,VbatH ;pun si fbinH(R23) ce am in ADCH
; ldi R21,0x0A
; ldi R20,0x42 ;inmultesc cu 26.26 (corectia ADC-ului)(2.626mV este pasul de incrementare al ADC-ului)
ldi R21,0x09
ldi R20,0xF6 ;inmultesc cu 25.50 (adica corectia este 25.5)
rcall mul16x16_32 ;in argH:L tempH:L (R19-R16) am deja rezultatul
;rezultatul inmultirii trebuie mutat in registrii folositi pentru conversie
;R19 este gol pentru ca nu am depasit 24 de biti la inmultire asa ca il voi discarda
;continui cu R18-R17-R16 care trebuie pusi in fbinH:fbinM:fbinL
mov fbinH,R18
mov fbinM,R17
mov fbinL,R16 ;am ce trebuie in fbibH_fbinM_fbinL pot trece la conversie
rcall bin3BCD24 ;chem rutina de conversie si in tBCD3_tBCD2_tBCD1_tBCD0 voi avea rezultatul in format

BCD
ret
;_______________________________________________________________________________
__________________________________
;STORED_Tmin_to_DY| -rutina preia valoarea din registrii de stocare temporara TH:TL si o pregateste pentru afisare
;______________| -ADCH:ADCL contin argumentul
; -fbinH:fbinM:fbinL contin rezultaul inmultirii cu 26.26 (corectia ADC-ului)
; -se cheama rutina bin3BCD24 pentru conversie in BCD
; -in tBCD3_tBCD2_tBCD1_tBCD0 voi avea rezultatul. tBCD3 este MSB, tBCD0 este LSB.
; -se folosesc registrii R23:R22:R21:R20:R19:R18:R17:R16
STORED_Tmin_to_DY:
;pregatesc inmultirea cu 26.26 pentru corectia ADC-ului
;r23:r22 * r21:r20 = R19:R18:R17:R16 (argH:argL:tempH:tempL)
;in R23:R22 am deja fbinM:fbinL adica ADCH:L
;in R21:R20 voi pune 2626 (0A42) cifra cu care inmultesc ADC-ul
mov fbinL,TminL ;pun in fbinL(R22) ADCL, ADCL trebuie citit primul
mov fbinM,TminH ;pun si fbinH(R23) ce am in ADCH
; ldi R21,0x0A
; ldi R20,0x42 ;inmultesc cu 26.26 (corectia ADC-ului)(2.626mV este pasul de incrementare al ADC-ului)
ldi R21,0x09
ldi R20,0xF6 ;inmultesc cu 25.50 (adica corectia este 25.5)
rcall mul16x16_32 ;in argH:L tempH:L (R19-R16) am deja rezultatul
;rezultatul inmultirii trebuie mutat in registrii folositi pentru conversie
;R19 este gol pentru ca nu am depasit 24 de biti la inmultire asa ca il voi discarda
;continui cu R18-R17-R16 care trebuie pusi in fbinH:fbinM:fbinL
mov fbinH,R18
mov fbinM,R17
mov fbinL,R16 ;am ce trebuie in fbibH_fbinM_fbinL pot trece la conversie
rcall bin3BCD24 ;chem rutina de conversie si in tBCD3_tBCD2_tBCD1_tBCD0 voi avea rezultatul in format

BCD
ret
;_______________________________________________________________________________
__________________________________
;STORED_Tmax_to_DY| -rutina preia valoarea din registrii de stocare temporara TH:TL si o pregateste pentru afisare
;______________| -ADCH:ADCL contin argumentul
; -fbinH:fbinM:fbinL contin rezultaul inmultirii cu 26.26 (corectia ADC-ului)
; -se cheama rutina bin3BCD24 pentru conversie in BCD
; -in tBCD3_tBCD2_tBCD1_tBCD0 voi avea rezultatul. tBCD3 este MSB, tBCD0 este LSB.
; -se folosesc registrii R23:R22:R21:R20:R19:R18:R17:R16
STORED_Tmax_to_DY:
;pregatesc inmultirea cu 26.26 pentru corectia ADC-ului
;r23:r22 * r21:r20 = R19:R18:R17:R16 (argH:argL:tempH:tempL)
;in R23:R22 am deja fbinM:fbinL adica ADCH:L
;in R21:R20 voi pune 2626 (0A42) cifra cu care inmultesc ADC-ul
mov fbinL,TmaxL ;pun in fbinL(R22) ADCL, ADCL trebuie citit primul
mov fbinM,TmaxH ;pun si fbinH(R23) ce am in ADCH
; ldi R21,0x0A
; ldi R20,0x42 ;inmultesc cu 26.26 (corectia ADC-ului)(2.626mV este pasul de incrementare al ADC-ului)
ldi R21,0x09
ldi R20,0xF6 ;inmultesc cu 25.50 (adica corectia este 25.5)
rcall mul16x16_32 ;in argH:L tempH:L (R19-R16) am deja rezultatul
;rezultatul inmultirii trebuie mutat in registrii folositi pentru conversie
;R19 este gol pentru ca nu am depasit 24 de biti la inmultire asa ca il voi discarda
;continui cu R18-R17-R16 care trebuie pusi in fbinH:fbinM:fbinL
mov fbinH,R18
mov fbinM,R17
mov fbinL,R16 ;am ce trebuie in fbibH_fbinM_fbinL pot trece la conversie
rcall bin3BCD24 ;chem rutina de conversie si in tBCD3_tBCD2_tBCD1_tBCD0 voi avea rezultatul in format

BCD
ret
;_______________________________________________________________________________
__________________________________
;ADC_to_DY| -rutina preia valoarea citita de ADC din reg ADCH:ADCL si o converteste in format BCD
;_________| -ADCH:ADCL contin argumentul
; -fbinH:fbinM:fbinL contin rezultaul inmultirii cu 26.26 (corectia ADC-ului)
; -se cheama rutina bin3BCD24 pentru conversie in BCD
; -in tBCD3_tBCD2_tBCD1_tBCD0 voi avea rezultatul. tBCD3 este MSB, tBCD0 este LSB.
; -se folosesc registrii R23:R22:R21:R20:R19:R18:R17:R16
ADC_to_DY:
;pregatesc inmultirea cu 26.26 pentru corectia ADC-ului
;r23:r22 * r21:r20 = R19:R18:R17:R16 (argH:argL:tempH:tempL)
;in R23:R22 am deja fbinM:fbinL adica ADCH:L
;in R21:R20 voi pune 2626 (0A42) cifra cu care inmultesc ADC-ul
in fbinL,ADCL ;pun in fbinL(R22) ADCL, ADCL trebuie citit primul
in fbinM,ADCH ;pun si fbinH(R23) ce am in ADCH
; ldi R21,0x0A
; ldi R20,0x42 ;inmultesc cu 26.26 (corectia ADC-ului)(2.626mV este pasul de incrementare al ADC-ului)
ldi R21,0x09
ldi R20,0xF6 ;inmultesc cu 25.50 (adica corectia este 25.5)

rcall mul16x16_32 ;in argH:L tempH:L (R19-R16) am deja rezultatul

;rezultatul inmultirii trebuie mutat in registrii folositi pentru conversie
;R19 este gol pentru ca nu am depasit 24 de biti la inmultire asa ca il voi discarda
;continui cu R18-R17-R16 care trebuie pusi in fbinH:fbinM:fbinL

mov fbinH,R18
mov fbinM,R17
mov fbinL,R16 ;am ce trebuie in fbibH_fbinM_fbinL pot trece la conversie

rcall bin3BCD24 ;chem rutina de conversie si in tBCD3_tBCD2_tBCD1_tBCD0 voi avea rezultatul in format

BCD
ret

;_______________________________________________________________________________
__________________________________
;blink LED green| -
;_______________| -
blink_LED_Green:
cbi PORTB,1
rcall tau10ms
rcall tau10ms
rcall tau10ms
rcall tau10ms


sbi PORTB,1
rcall tau10ms
rcall tau10ms
rcall tau10ms
rcall tau10ms

ret

;_______________________________________________________________________________
__________________________________
;blink LED red | -
;_______________| -
blink_LED_Red:
cbi PORTB,0
rcall tau10ms
rcall tau10ms
rcall tau10ms
rcall tau10ms

sbi PORTB,0
rcall tau10ms
rcall tau10ms
rcall tau10ms
rcall tau10ms

ret
;_______________________________________________________________________________
__________________________________
;DY_Tmax | -
;_________| -
DY_Tmax:
;_______________
;|Tmax= |
;|______________|
ldi argL,0x80 ;setez argL=80h
rcall LCD_command
ldi argL, 'T' ;scriu T
rcall LCD_putchar
ldi argL, 'm' ;scriu m
rcall LCD_putchar
ldi argL, 'a' ;scriu a
rcall LCD_putchar
ldi argL, 'x' ;scriu x
rcall LCD_putchar
ldi argL, ' ' ;scriu =
rcall LCD_putchar

;|x_|__|__|__| tBCD3____________________________________________________________
; mov tempH,tBCD3 ;pun in "tempH" |xx|__|__|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; tst tempH ;este =0?
; brne not0_Tmax ;daca nu sar la not0_1 si tratez normal
; ldi argL,' ' ;scriu " "
; rcall LCD_putchar
; rjmp cont_tmax
;not0_Tmax:
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
;
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;cont_Tmax:
;|_x|__|__|__| tBCD3
mov tempH,tBCD3 ;pun in "tempH"|xx|__|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
tst tempH ;este =0?
brne not0_Tmax_5 ;daca nu sar la not0_1 si tratez normal
ldi argL,' ' ;scriu " "
rcall LCD_putchar
rjmp cont_Tmax_5
not0_Tmax_5:
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar

cont_Tmax_5:
;|__|x_|__|__| tBCD2
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
swap tempH ;niblul superior trece in niblul inferior
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
;|__|_x|__|__| tBCD2
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
;|__|__|x_|__| tBCD1
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|_x|__| tBCD1
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|x_| tBCD0
; mov tempH,tBCD0 ;pun in "tempH" |__|__|__|xx|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|_x| tBCD0
; mov tempH,tBCD0 ;pun in "tempH"|__|__|__|xx|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar


ret
;_______________________________________________________________________________
__________________________________
;DY_Tmax | -
;_________| -
DY_Tmin:
;_______________
;|Tmax= |
;|______________|
ldi argL,0x80 ;setez argL=80h
rcall LCD_command
ldi argL, 'T' ;scriu T
rcall LCD_putchar
ldi argL, 'm' ;scriu m
rcall LCD_putchar
ldi argL, 'i' ;scriu i
rcall LCD_putchar
ldi argL, 'n' ;scriu n
rcall LCD_putchar
ldi argL, ' ' ;scriu =
rcall LCD_putchar

;|x_|__|__|__| tBCD3____________________________________________________________
; mov tempH,tBCD3 ;pun in "tempH" |xx|__|__|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; tst tempH ;este =0?
; brne not0_Tmax ;daca nu sar la not0_1 si tratez normal
; ldi argL,' ' ;scriu " "
; rcall LCD_putchar
; rjmp cont_tmax
;not0_Tmax:
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
;
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;cont_Tmax:
;|_x|__|__|__| tBCD3
mov tempH,tBCD3 ;pun in "tempH"|xx|__|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
tst tempH ;este =0?
brne not0_Tmin_5 ;daca nu sar la not0_1 si tratez normal
ldi argL,' ' ;scriu " "
rcall LCD_putchar
rjmp cont_Tmin_5
not0_Tmin_5:
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar

cont_Tmin_5:
;|__|x_|__|__| tBCD2
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
swap tempH ;niblul superior trece in niblul inferior
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
;|__|_x|__|__| tBCD2
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
;|__|__|x_|__| tBCD1
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|_x|__| tBCD1
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|x_| tBCD0
; mov tempH,tBCD0 ;pun in "tempH" |__|__|__|xx|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|_x| tBCD0
; mov tempH,tBCD0 ;pun in "tempH"|__|__|__|xx|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
ret

;_______________________________________________________________________________
__________________________________
;DY_Umin | -
;_________| -
DY_Umin:
;_______________
;|Umin= |
;|______________|
ldi argL,0x80 ;setez argL=80h
rcall LCD_command
ldi argL, 'U' ;scriu U
rcall LCD_putchar
ldi argL, 'm' ;scriu m
rcall LCD_putchar
ldi argL, 'i' ;scriu i
rcall LCD_putchar
ldi argL, 'n' ;scriu n
rcall LCD_putchar
; ldi argL, '=' ;scriu =
; rcall LCD_putchar

;|x_|__|__|__| tBCD3
; mov tempH,tBCD3 ;pun in "tempH" |xx|__|__|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; tst tempH ;este =0?
; brne not0_Vbat ;daca nu sar la not0_1 si tratez normal
; ldi argL,' ' ;scriu " "
; rcall LCD_putchar
; rjmp cont_Vbat
;not0_Vbat:
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
cont_Vbat:
;|_x|__|__|__| tBCD3
mov tempH,tBCD3 ;pun in "tempH"|xx|__|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
tst tempH ;este =0?
brne not0_Vbat_5 ;daca nu sar la not0_1 si tratez normal
ldi argL,' ' ;scriu " "
rcall LCD_putchar
rjmp cont_Vbat_5
not0_Vbat_5:
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
cont_Vbat_5:
;|__|x_|__|__| tBCD2
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
swap tempH ;niblul superior trece in niblul inferior
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar

rcall LCD_wait
ldi argL, '.' ;scriu "."
rcall LCD_putchar
;|__|_x|__|__| tBCD2
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
;|__|__|x_|__| tBCD1
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|_x|__| tBCD1
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|x_| tBCD0
; mov tempH,tBCD0 ;pun in "tempH" |__|__|__|xx|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|_x| tBCD0
; mov tempH,tBCD0 ;pun in "tempH"|__|__|__|xx|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
ret
;_______________________________________________________________________________
__________________________________
;Get_U0 | -rutina citeste tensiunea pe senzorul de temperatura, intrarea ADC0.
;________| -rezultatul se va afla in ADCH,ADCL
;
Get_U0:
ldi tempL, 0xC0 ;set Reference to internal 2.56V voltage with external capacitor
out ADMUX, tempL ;and select the MUX input to be ADC0.

sbi ADCSRA,6 ;Set B6 in ADCSRA, start ADC,one shoot 40=01000000
rcall tau100 ;astept putin sa termine ADC-ul ca sa am date stabile in ADCH:L

ldi tempL, 0xC0 ;set Reference to internal 2.56V voltage with external capacitor
out ADMUX, tempL ;and select the MUX input to be ADC0.

sbi ADCSRA,6 ;Set B6 in ADCSRA, start ADC,one shoot 40=01000000
rcall tau100 ;astept putin sa termine ADC-ul ca sa am date stabile in ADCH:L
ret
;_______________________________________________________________________________
__________________________________|
;Get_U1 | -rutina citeste tensiunea de pe rezistenta shunt. Valoarea este chiar curentul IBAT, intrarea ADC1
;________| -rezultatul se va afla in ADCH,ADCL
;
Get_U1:
ldi tempL, 0xC1 ;set Reference to internal 2.56V voltage with external capacitor
out ADMUX, tempL ;and select the MUX input to be ADC1.

sbi ADCSRA,6 ;Set B6 in ADCSRA, start ADC,one shoot 40=01000000
rcall tau100 ;astept putin sa termine ADC-ul ca sa am date stabile in ADCH:L

ldi tempL, 0xC1 ;set Reference to internal 2.56V voltage with external capacitor
out ADMUX, tempL ;and select the MUX input to be ADC1.

sbi ADCSRA,6 ;Set B6 in ADCSRA, start ADC,one shoot 40=01000000
rcall tau100 ;astept putin sa termine ADC-ul ca sa am date stabile in ADCH:L
ret
;|___________________________________________________________________________
______________________________________|
;Get_U2 | -rutina citeste tensiunea sintetizata de sursa in comutartie, intrarea ADC2.
;________| -rezultatul se va afla in ADCH,ADCL
;
Get_U2:
ldi tempL, 0xC2 ;set Reference to internal 2.56V voltage with external capacitor
out ADMUX, tempL ;and select the MUX input to be ADC2.

sbi ADCSRA,6 ;Set B6 in ADCSRA, start ADC,one shoot 40=01000000
rcall tau100 ;astept putin sa termine ADC-ul ca sa am date stabile in ADCH:L

ldi tempL, 0xC2 ;set Reference to internal 2.56V voltage with external capacitor
out ADMUX, tempL ;and select the MUX input to be ADC2.

sbi ADCSRA,6 ;Set B6 in ADCSRA, start ADC,one shoot 40=01000000
rcall tau100 ;astept putin sa termine ADC-ul ca sa am date stabile in ADCH:L
ret
;_______________________________________________________________________________
___________________________________
;Get_U3 | -rutina citeste tensiunea aplicata la intrarea chargerului, intrarea ADC3.
;________| -rezultatul se va afla in ADCH,ADCL
;
Get_U3:
ldi tempL, 0xC3 ;set Reference to internal 2.56V voltage with external capacitor
out ADMUX, tempL ;and select the MUX input to be ADC3.

sbi ADCSRA,6 ;Set B6 in ADCSRA, start ADC,one shoot 40=01000000
rcall tau100 ;astept putin sa termine ADC-ul ca sa am date stabile in ADCH:L

ldi tempL, 0xC3 ;set Reference to internal 2.56V voltage with external capacitor
out ADMUX, tempL ;and select the MUX input to be ADC3.

sbi ADCSRA,6 ;Set B6 in ADCSRA, start ADC,one shoot 40=01000000
rcall tau100 ;astept putin sa termine ADC-ul ca sa am date stabile in ADCH:L
ret

;_______________________________________________________________________________
___________________________________
;Get_U7 | -rutina citeste tensiunea aplicata la intrarea chargerului, intrarea ADC3.
;________| -rezultatul se va afla in ADCH,ADCL
;
Get_U7:
ldi tempL, 0xC7 ;set Reference to internal 2.56V voltage with external capacitor
out ADMUX, tempL ;and select the MUX input to be ADC3.

sbi ADCSRA,6 ;Set B6 in ADCSRA, start ADC,one shoot 40=01000000
rcall tau100 ;astept putin sa termine ADC-ul ca sa am date stabile in ADCH:L

ldi tempL, 0xC7 ;set Reference to internal 2.56V voltage with external capacitor
out ADMUX, tempL ;and select the MUX input to be ADC3.

sbi ADCSRA,6 ;Set B6 in ADCSRA, start ADC,one shoot 40=01000000
rcall tau100 ;astept putin sa termine ADC-ul ca sa am date stabile in ADCH:L
ret
;_______________________________________________________________________________
____________
;DY_Msg | -Display a mesage
;________| -The display position must be set before calling this routine
; -In case of 4 line display ARGUMENTt must be:
;80h----8Fh 1line
;C0h----CF 2line
;90h----9F 3line
;D0h----DF 4line
;in XL:XH am adresa etichetei Mesaj_xx
;in tempL am adresa la care sa fac afisarea pe display
DY_Msg:
lpm R0,Z+ ;LPM fara argument foloseste implicit R0
tst R0 ;testez R0=0 daca da se face branch la finis in urmatoarea instructiune
breq finish
mov argL,R0 ;pun in argL continutul de la adresa catre care arata XL
rcall LCD_wait ;astept dupa afisor
rcall LCD_putchar ;si afisez caracterul
rjmp DY_Msg
finish:

ret


;_______________________________________________________________________________
__________________________________
;DY_U0 |
;__________|
DY_U0:
;_______________________________
;|U= | |
;| | |
;| | |
;|______________|_______________|
ldi argL,0x84 ;setez argL=80h
rcall LCD_command
ldi argL, 'U' ;scriu U
rcall LCD_putchar

;|x_|__|__|__| tBCD3____________________________________________________________
; mov tempH,tBCD3 ;pun in "tempH" |xx|__|__|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; tst tempH ;este =0?
; brne not0_U0 ;daca nu sar la not0_1 si tratez normal
; ldi argL,' ' ;scriu " "
; rcall LCD_putchar
; rjmp cont_U0
;not0_U0:
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
;
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;cont_U0:
;|_x|__|__|__| tBCD3
mov tempH,tBCD3 ;pun in "tempH"|xx|__|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
tst tempH ;este =0?
brne not0_U0_5 ;daca nu sar la not0_1 si tratez normal
ldi argL,' ' ;scriu " "
rcall LCD_putchar
rjmp cont_U0_5
not0_U0_5:
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar

cont_U0_5:
rcall LCD_wait
ldi argL, '.' ;scriu "."
rcall LCD_putchar

;|__|x_|__|__| tBCD2____________________________________________________________
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
swap tempH ;niblul superior trece in niblul inferior
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
;|__|_x|__|__| tBCD2
; mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|x_|__| tBCD1
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|_x|__| tBCD1____________________________________________________________
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|x_| tBCD0
; mov tempH,tBCD0 ;pun in "tempH" |__|__|__|xx|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|_x| tBCD0
; mov tempH,tBCD0 ;pun in "tempH"|__|__|__|xx|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|x_|__|__| tBCD2____________________________________________________________
; mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|_x|__|__| tBCD2
; mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
ret
;_______________________________________________________________________________
__________________________________
;DY_U1 VBAT |
;____________|
DY_U1:
;_______________________________
;|U= |
;|______________|
ldi argL,0x80 ;setez argL=84h
rcall LCD_command

; ldi argL, 'U' ;scriu U
; rcall LCD_putchar
;|x_|__|__|__| tBCD3____________________________________________________________
; mov tempH,tBCD3 ;pun in "tempH" |xx|__|__|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; tst tempH ;este =0?
; brne not0_U1 ;daca nu sar la not0_1 si tratez normal
; ldi argL,' ' ;scriu " "
; rcall LCD_putchar
; rjmp cont_U1
;not0_U1:
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;cont_U1:
;|_x|__|__|__| tBCD3
mov tempH,tBCD3 ;pun in "tempH"|xx|__|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
tst tempH ;este =0?
brne not0_U1_5 ;daca nu sar la not0_1 si tratez normal
ldi argL,' ' ;scriu " "
rcall LCD_putchar
rjmp cont_U1_5
not0_U1_5:
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
cont_U1_5:
;|__|x_|__|__| tBCD2____________________________________________________________
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
swap tempH ;niblul superior trece in niblul inferior
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar

rcall LCD_wait
ldi argL, '.' ;scriu "."
rcall LCD_putchar
;|__|_x|__|__| tBCD2
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
;|__|__|x_|__| tBCD1
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar

; rcall LCD_wait
; ldi argL, '.' ;scriu .
; rcall LCD_putchar
;|__|__|_x|__| tBCD1____________________________________________________________
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|x_| tBCD0
; mov tempH,tBCD0 ;pun in "tempH" |__|__|__|xx|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|_x| tBCD0
; mov tempH,tBCD0 ;pun in "tempH"|__|__|__|xx|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|x_|__|__| tBCD2____________________________________________________________
; mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|_x|__|__| tBCD2
; mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
ret
;_______________________________________________________________________________
__________________________________
;DY_U2 |
;__________|
DY_U2:
;_______________________________
;| | |
;| | |
;|U2= | |
;|______________|_______________|
ldi argL,0x90 ;setez argL=90h
rcall LCD_command
ldi argL, 'U' ;scriu U
rcall LCD_putchar
; ldi argL, '2' ;scriu 2
; rcall LCD_putchar
; ldi argL, '=' ;scriu =
; rcall LCD_putchar
;|x_|__|__|__| tBCD3____________________________________________________________
mov tempH,tBCD3 ;pun in "tempH" |xx|__|__|__|
andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
swap tempH ;niblul superior trece in niblul inferior
tst tempH ;este =0?
brne not0_U2 ;daca nu sar la not0_1 si tratez normal
ldi argL,' ' ;scriu " "
rcall LCD_putchar
rjmp cont_U2
not0_U2:
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit

mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
cont_U2:
;|_x|__|__|__| tBCD3
mov tempH,tBCD3 ;pun in "tempH"|xx|__|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
tst tempH ;este =0?
brne not0_U2_5 ;daca nu sar la not0_1 si tratez normal
ldi argL,' ' ;scriu " "
rcall LCD_putchar
rjmp cont_U2_5
not0_U2_5:
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar

cont_U2_5:
rcall LCD_wait
ldi argL, '.' ;scriu "."
rcall LCD_putchar

;|__|x_|__|__| tBCD2____________________________________________________________
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
swap tempH ;niblul superior trece in niblul inferior
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar

;|__|_x|__|__| tBCD2
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar

;|__|__|x_|__| tBCD1
mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
swap tempH ;niblul superior trece in niblul inferior
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
rcall LCD_wait
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
;|__|__|_x|__| tBCD1____________________________________________________________
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|x_| tBCD0
; mov tempH,tBCD0 ;pun in "tempH" |__|__|__|xx|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|_x| tBCD0
; mov tempH,tBCD0 ;pun in "tempH"|__|__|__|xx|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
ret
;_______________________________________________________________________________
__________________________________
;DY_U3 |
;__________|
DY_U3:
;_______________________________
;| | |
;| | |
;| | |
;|U3=___________|_______________|
ldi argL,0xD0 ;setez argL=D0h
rcall LCD_command
ldi argL, 'U' ;scriu U
rcall LCD_putchar
; ldi argL, '3' ;scriu 3
; rcall LCD_putchar
; ldi argL, '=' ;scriu =
; rcall LCD_putchar

;|x_|__|__|__| tBCD3____________________________________________________________
mov tempH,tBCD3 ;pun in "tempH" |xx|__|__|__|
andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
swap tempH ;niblul superior trece in niblul inferior
tst tempH ;este =0?
brne not0_U3 ;daca nu sar la not0_1 si tratez normal
ldi argL,' ' ;scriu " "
rcall LCD_putchar
rjmp cont_U3
not0_U3:
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit

mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
cont_U3:
;|_x|__|__|__| tBCD3
mov tempH,tBCD3 ;pun in "tempH"|xx|__|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
tst tempH ;este =0?
brne not0_U3_5 ;daca nu sar la not0_1 si tratez normal
ldi argL,' ' ;scriu " "
rcall LCD_putchar
rjmp cont_U3_5
not0_U3_5:
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar

cont_U3_5:
rcall LCD_wait
ldi argL, '.' ;scriu "."
rcall LCD_putchar

;|__|x_|__|__| tBCD2____________________________________________________________
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
swap tempH ;niblul superior trece in niblul inferior
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
;|__|_x|__|__| tBCD2
; mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|x_|__| tBCD1
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
; rcall LCD_wait
; ldi argL, '.' ;scriu .
; rcall LCD_putchar
;|__|__|_x|__| tBCD1____________________________________________________________
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|x_| tBCD0
; mov tempH,tBCD0 ;pun in "tempH" |__|__|__|xx|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|_x| tBCD0
; mov tempH,tBCD0 ;pun in "tempH"|__|__|__|xx|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
ret
;_______________________________________________________________________________
__________________________________
;DY_U7 Temp |
;______________|
DY_U7:
;_______________
;|U= T27 |
;|______________|
ldi argL,0x85 ;setez argL=80h
rcall LCD_command
; ldi argL, 'T' ;scriu T
; rcall LCD_putchar
; ldi argL, ' ' ;scriu " "
; rcall LCD_putchar
;|x_|__|__|__| tBCD3____________________________________________________________
; mov tempH,tBCD3 ;pun in "tempH" |xx|__|__|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; tst tempH ;este =0?
; brne not0_U7 ;daca nu sar la not0_1 si tratez normal
; ldi argL,' ' ;scriu " "
; rcall LCD_putchar
; rjmp cont_U7
;not0_U7:
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;cont_U7:
;|_x|__|__|__| tBCD3
mov tempH,tBCD3 ;pun in "tempH"|xx|__|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
tst tempH ;este =0?
brne not0_U7_5 ;daca nu sar la not0_1 si tratez normal
ldi argL,' ' ;scriu " "
rcall LCD_putchar
rjmp cont_U7_5
not0_U7_5:
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
cont_U7_5:
;|__|x_|__|__| tBCD2____________________________________________________________
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
swap tempH ;niblul superior trece in niblul inferior
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar
;|__|_x|__|__| tBCD2
mov tempH,tBCD2 ;pun in "tempH" |__|xx|__|__|
andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
ldi tempL,0x30
add tempH,tempL ;in "tempH" am deja caracterul de tiparit
mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
rcall LCD_putchar

; ldi argL, '.' ;scriu "."
; rcall LCD_putchar

;|__|__|x_|__| tBCD1
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar

; rcall LCD_wait
; ldi argL, '.' ;scriu .
; rcall LCD_putchar

;|__|__|_x|__| tBCD1____________________________________________________________
; mov tempH,tBCD1 ;pun in "tempH" |__|__|xx|__|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|x_| tBCD0
; mov tempH,tBCD0 ;pun in "tempH" |__|__|__|xx|
; andi tempH,0xF0 ;"AND with immediate" sterg niblul inferior din "tempH"
; swap tempH ;niblul superior trece in niblul inferior
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar
;|__|__|__|_x| tBCD0
; mov tempH,tBCD0 ;pun in "tempH"|__|__|__|xx|
; andi tempH,0x0F ;"AND with immediate" sterg niblul superior din "tempH"
; ldi tempL,0x30
; add tempH,tempL ;in "tempH" am deja caracterul de tiparit
; rcall LCD_wait
; mov argL,tempH ;scriu caracterul cu codul dat de ce am in "tempH"
; rcall LCD_putchar

; ldi argL, 'V' ;scriu V
; rcall LCD_putchar

ret
;_______________________________________________________________________________
____________
;tau100 | -rutina de intarziere de 100uS (real 100.3us)
;_______| -o instructiune dureaza 0.1uS deci este nevoie cam de 100 de cicli
;
tau100:
ldi tempL,250 ;0.1us + 0.1(RET)=0.2us
t100:
nop ;1us
dec tempL ;1us
brne t100 ;2us total 0.4us * 250=100us+0.1 (ultimul brne=1) =100.1+0.2=100.3us
ret

;_______________________________________________________________________________
____________
;tau1ms | -rutina de intarziere de 1ms (real 1002.3us)
;________| -o instructiune dureaza 0.1us deci este nevoie cam de 1000 de cicli
;
tau1ms:
ldi tempH,13 ;0,1us
ldi tempL,0x00 ;0,1us si cu RET=0,3us
t1ms:
dec tempL ;0.1us
brne t1ms ;0.2 or 0.1us 0.3us*256 + 0.1=76.8us
dec tempH ;0.1us
brne t1ms ;0.2 or 0.1us (76.8us+0.3us)*12+(76.8us+0.3us)=925.2+77.1+0.3=1002,3us
ret

;_______________________________________________________________________________
____________
;tau10ms | -rutina de intarziere de 10ms (real 10023us)
;________| -o instructiune dureaza 0.1us deci este nevoie cam de 10000 de cicli
;
tau10ms:
ldi tempH,129 ;0,1us
ldi tempL,0x00 ;0,1us si cu RET=0,3us
t10ms:
dec tempL ;0.1us
brne t10ms ;0.2 or 0.1us 0.3us*256 + 0.1=76.8us
dec tempH ;0.1us
brne t10ms ;0.2 or 0.1us (76.8us+0.3us)*129+(76.8us+0.3us)=925.2+77.1+0.3=10023us
ret
;_______________________________________________________________________________
____________
;tau100ms | -rutina de intarziere de 100ms (real 100400us)
;__________| -o instructiune dureaza 0.1us deci este nevoie cam de 100000 de cicli
;
tau100ms:
ldi counter,100 ;0,1us
t100out:
ldi tempH,13 ;0,1us
ldi tempL,0x00 ;0,1us si cu RET=0,4us

t100in:
dec tempL ;0.1us
brne t100in ;0.2 or 0.1us 0.3*256=76.8+0.1=76.9(brne=1)
dec tempH ;0.1us
brne t100in ;0.2 or 0.1us (76.9+0.3)*13=1003.6+0.1=1003.7
dec counter ;0.1us
brne t100out ;0.2 or 0.1us (1003.7+0.3)*100+0.1=100400.01+0.4=100400,5us
ret


;_______________________________________________________________________________
____________
;tau500ms | -rutina de intarziere de 500ms (real 540480us)
;__________| -o instructiune dureaza 0.1us deci este nevoie cam de 500000 de cicli



;
tau500ms:
ldi counter,200 ;0,1us
t500out:
ldi tempH,35 ;0,1us
ldi tempL,0x00 ;0,1us si cu RET=0,4us

t500in:
dec tempL ;0.1us
brne t500in ;0.2 or 0.1us 0.3*256=76.8+0.1=76.9(brne=1)
dec tempH ;0.1us
brne t500in ;0.2 or 0.1us (76.9+0.3)*35=2702+0.1=2702.1
dec counter ;0.1us
brne t500out ;0.2 or 0.1us (2702.1+0.3)*200+0.1=540480.1+0.1+0.4=540480.6us 500ms
ret
;_______________________________________________________________________________
____________
;LCD_wait | -citeste BUSY FLAG in LCD
;__________| -
;
LCD_wait:
rcall LCD_getaddr
andi return, 0x80
brne LCD_wait
ret

;_______________________________________________________________________________
____________
;LCD_init | -initialize the LCD
;_________| -
;
LCD_init:

ldi tempL, 0b00001111
out DDRD, templ

rcall tau100ms
ldi argL, 0x20
rcall LCD_command8

rcall LCD_wait
; ldi argL, 0x28
; ldi argL, 0x20
ldi argL, 0x24
rcall LCD_command

rcall LCD_wait
ldi argL, 0x0F
rcall LCD_command

rcall LCD_wait
ldi argL, 0x01
rcall LCD_command

rcall LCD_wait
ldi argL, 0x06
rcall LCD_command
ret

;_______________________________________________________________________________
____________
;LCD_command | -same as LCD_putchar, but with RS low!
;_____________|
LCD_command:
rcall LCD_wait

push argL
in tempL, DDRD
sbr tempL, 0b11110000
out DDRD, tempL
in tempL, PortD
cbr tempL, 0b11111110
cbr argL, 0b00001111
or tempL, argL

out PortD, tempL
sbi PortD, LCD_E
nop
nop
nop
cbi PortD, LCD_E
pop argL
cbr tempL, 0b11110000
swap argL
cbr argL, 0b00001111
or tempL, argL
out PortD, tempL
sbi PortD, LCD_E
nop
nop
nop
cbi PortD, LCD_E
in tempL, DDRD
cbr tempL, 0b11110000
out DDRD, tempL
ret
;_______________________________________________________________________________
____________
;LCD_command8 | -used for init (we need some 8-bit commands to switch to 4-bit mode!)
;_____________|
LCD_command8:
rcall LCD_wait

in tempL, DDRD

sbr tempL, 0b11110000
out DDRD, tempL
in tempL, PortD
cbr tempL, 0b11110000
cbr argL, 0b00001111

or tempL, argL

out PortD, tempL
sbi PortD, LCD_E
nop
nop
nop
cbi PortD, LCD_E
in tempL, DDRD
cbr tempL, 0b11110000
out DDRD, tempL
ret

;_______________________________________________________________________________
____________
;LCD_putchar | -
;_____________|
LCD_putchar:
rcall LCD_wait

push argL
in tempL, DDRD
sbr tempL, 0b11110000
out DDRD, tempL
in tempL, PortD
cbr tempL, 0b11111110
cbr argL, 0b00001111

or tempL, argL
out PortD, tempL
sbi PortD, LCD_RS
sbi PortD, LCD_E
nop
nop
nop
cbi PortD, LCD_E
pop argL
cbr tempL, 0b11110000
swap argL

cbr argL, 0b00001111
or tempL, argL
out PortD, tempL
sbi PortD, LCD_RS
sbi PortD, LCD_E
nop
nop
nop
cbi PortD, LCD_E
cbi PortD, LCD_RS
in tempL, DDRD
cbr tempL, 0b11110000
out DDRD, tempL
ret

;_______________________________________________________________________________
____________
;LCD_getchar | -
;_____________|
LCD_getchar:
in tempL, DDRD
andi tempL, 0b00001111
out DDRD, tempL
sbi PortD, LCD_RS
sbi PortD, LCD_RW
sbi PortD, LCD_E
nop
in tempL, PinD
andi tempL, 0b11110000
mov return, tempL
cbi PortD, LCD_E
nop
nop
sbi PortD, LCD_E
nop
in tempL, PinD
andi tempL, 0b11110000
swap tempL
or return, tempL
cbi PortD, LCD_E
cbi PortD, LCD_RS
cbi PortD, LCD_RW
ret

;_______________________________________________________________________________
____________
;LCD_getaddr | -works just like LCD_getchar, but with RS low, return.7 is the busy flag
;_____________|
LCD_getaddr:
in tempL, DDRD
andi tempL, 0b00001111
out DDRD, tempL
cbi PortD, LCD_RS
sbi PortD, LCD_RW
sbi PortD, LCD_E
nop
in tempL, PinD
andi tempL, 0b11110000
mov return, tempL
cbi PortD, LCD_E
nop
nop
sbi PortD, LCD_E
nop
in tempL, PinD
andi tempL, 0b11110000
swap tempL
or return, tempL
cbi PortD, LCD_E
cbi PortD, LCD_RW
ret

;_______________________________________________________________________________
____________
;mul16x16_16 | -Multiply of two 16bits numbers with 16bits result 16x16=16
;_____________| -r23:r22 * r21:r20 = R17:R16
; -Register usage: r0, r1 and r16 to r23 (8 registers)
;* NOTE
;* Full orthogonality i.e. any register pair can be used as long as
;* the result and the two operands does not share register pairs.
;* The routine is non-destructive to the operands.
;
mul16x16_16:
mul r22, r20 ; al * bl
movw r17:r16, r1:r0
mul r23, r20 ; ah * bl
add r17, r0
mul r21, r22 ; bh * al
add r17, r0
ret
ret
;_______________________________________________________________________________
____________
;mul16x16_32 | -Signed multiply of two 16bits numbers with 32bits result 16x16=32bit
;_____________| -r23:r22 * r21:r20 =r19:r18:r17:r16
; -Register usage: r0, r1 and r16 to r23 (8 registers)
;* NOTE
;* Full orthogonality i.e. any register pair can be used as long as
;* the 32bit result and the two operands does not share register pairs.
;* The routine is non-destructive to the operands.
;
mul16x16_32:
clr r2
mul r23, r21 ; ah * bh
movw r19:r18, r1:r0
mul r22, r20 ; al * bl
movw r17:r16, r1:r0
mul r23, r20 ; ah * bl
add r17, r0
adc r18, r1
adc r19, r2
mul r21, r22 ; bh * al
add r17, r0
adc r18, r1
adc r19, r2
ret

ret
;_______________________________________________________________________________
____________
;Div24by24 | -a 24/24 divide routine
;___________| -original was AH:AM:AL / BH:BM:BL => CH:CM:CL
; -counter,argH,argL / return,tempH,tempL => fbinH,fbinM,fbinL
; -counter:argH:argL / return:tempH:tempL => fbinH:fbinM:fbinL
; - R20:R19:R18 / R21:R17:R16 => fbinH:fbinM:fbinL
; -counter argH argL /return tempH tempL => fbinH:fbinM:fbinL
div24by24:

clr fbinH ; clear quotient (result, answer)
clr fbinM
clr fbinL
clr KH ; clear bit position/counter
clr KM
clr KL
inc KL ; initialize the bit position to lsb
BITLP:
sbrc return,7 ; is the divisor shifted all the way up?
rjmp DODIV ; yup, go do the division (via subtractions)
lsl KL ; else shift the bit position/counter up
rol KM
rol KH
lsl tempL ; and shift the divisor up
rol tempH
rol return
rjmp BITLP ; loop until the divisor is shifted up

DODIV:
cp counter,return ; is dividend>=divisor?
brlo NEXTBIT ; no... don't do a subtraction, just shift the
0

#16 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 09 December 2007 - 11:52 AM

cele mai lungi mesaje postate vreodata ...moderatorul le poate sterge daca vrea... :wub:

Aceasta postare a fost editata de charlie: 09 December 2007 - 11:53 AM

0

#17 Useril este offline   Paul_L 

  • Senior
  • PipPipPipPipPip
  • Grup: Members
  • Postari: 295
  • Inregistrat: 30-September 07

Postat 09 December 2007 - 12:35 PM

Interesant dar nu era o idee mai buna sa nu zbori si cu display-ul . Era mai usor si puneai display-ul numai jos pe o cupla cind citeai valorile cind zbori nu se uita nimeni la el .
0

#18 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 09 December 2007 - 06:47 PM

este o idee buna...am trecut prin faza asata la proiectare si am ales varianta asta...mica si compacta.

A existat si varianta care transmitea in 433MHz datele pe care le citeam jos cu un laptop. Chestie mult mai complicata. Versiunea aia citea si turatia la head. Nu am implementat-o niciodata pentru ca nu am reusit sa fac transmisia stabila...
0

#19 Useril este offline   Cirip 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 732
  • Inregistrat: 07-January 05

Postat 10 December 2007 - 05:12 PM

Salut Charlie,

Si felicitari pentru realizare.
Am cateva intrebari referitoare la schema:
Cum sunt folosite rezistentele alea care compun suntul de 0.1 Ohmi? In schema nu par conectate nicaieri si, in plus, un sunt de 0.1 Ohmi ar pierde destul de multa tensiune la un curent de peste 10A
Ce senzor de temperatura ai folosit? In schema nu se precizeaza.

Multumesc,
Cirip
Teorie este atunci cand stii totul, dar nu merge nimic.
Practica este cand toate merg, dar nu stii de ce.
Montajele mele imbina teoria cu practica: nu merge nimic si nu stiu de ce.
0

#20 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 31 December 2007 - 09:24 AM

Salut cirip,

Ai punctat bine.
Rezistentele se lipesc pe cablaj pe o bucata care se desprinde de placa principala. Ea ar trebui lipita de la un conector Dean's la altul facand un sandwich din cablaje si astfel realizand shuntul pe care se masoara curentul. Suntul de 0.1 Ohmi este cam mare pentru aplicatia mea. Pierd 1V la 10A si nu-mi pot permite pentru ca din 2 celule LiPo daca pierd 1V nu e bine pentru regulatorul care urmeaza. Asa ca varianta asta am facut-o, am testat-o, dar nu am implementat-o din motivul descris mai sus.

Ideea era sa monitorizez si curentul ca sa pot masura cati mA am scos din pack si cati au mai ramas.

Senzorul este un LM35.

Aceasta postare a fost editata de charlie: 31 December 2007 - 09:25 AM

0

#21 Useril este offline   iony 

  • MEGA Membru
  • PipPipPipPipPipPipPip
  • Grup: Members
  • Postari: 2346
  • Inregistrat: 06-April 07

Postat 12 January 2008 - 07:52 PM

uite aci ceva mai misto :lol:
http://www.rctoys.com/rc-toys-and-parts/ET...TA-LOGGERS.html
0

#22 Useril este offline   pab 

  • Incepator
  • PipPip
  • Grup: Members
  • Postari: 38
  • Inregistrat: 16-November 03

  Postat 14 January 2008 - 07:56 AM

Saluta Charlie! As dori si eu un senzor ca al tau dar sa indice numai tensiunea! Cat m ar costa? Gata facut
0

#23 Useril este offline   ag81sri 

  • Junior
  • PipPipPip
  • Grup: Members
  • Postari: 70
  • Inregistrat: 11-November 07

Postat 14 January 2008 - 09:17 AM

Imi cer scuze ! Poate nu am inteles eu bine : Shuntul smd are 0,1 ohm ?
Asta ar insemna ca :
- La un consum de 10 A, avem o cadere de 1volt,
- Iar la 30A, prin consecinta o cadere de 3volti ?
Ma rog , numai atunci cand citeste, dar ,integrat in timp, totusi scade ceva tensiunea, trecand in caldura !
Nu am inteles eu bine ?!
0

#24 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 21 January 2008 - 02:12 PM

Ai inteles f bine. Din cauza acestor caderi de tensiune pe shunt nici nu am impementat citirea curentului ci doar a tensiunii. Shuntul trebuie sa fie mult mai mic ca sa nu se simta aceasta cadere de tensiune.
0

#25 Useril este offline   andreycosmin 

  • Membru
  • PipPipPipPip
  • Grup: Members
  • Postari: 213
  • Inregistrat: 02-January 08

Postat 15 February 2008 - 10:33 PM

salut
vreau si eu un exemplar contra cost din acest produs crezi ca se poate?
0

#26 Useril este offline   charlie 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 765
  • Inregistrat: 31-May 04

Postat 22 February 2008 - 08:06 AM

Ti-am trimis MI...
0

#27 Useril este offline   znecula 

  • Membru de onoare
  • PipPipPipPipPipPip
  • Grup: Members
  • Postari: 845
  • Inregistrat: 03-April 05
  • Gender:Male
  • Location:Iasi

Postat 25 February 2008 - 09:53 PM

Vreau si eu pretul.

Stima.
0

Arata acest topic


Pagina 1 din 1

10 useri citesc topicul
0 membri, 10 vizitatori, 0 utilizatori anonimi

913Creative.ro