?? lion.lst
字號:
AVRASM ver. 1.30 C:\USER\DESIGN\AVR450\TINY15~1\LION.ASM Tue Jul 11 10:49:24 2000
; Last change: JB 00/07/11 (YY/MM/DD)
;**************************** MODULE INFO *******************************
;
; File name : bclion.asm
; AUTHOR : Atmel
; VERSION : 1.2
; DATE : July 10th 2000
;
; Compiler : Atmel AVR Assembler 1.30
; Contents : Travel Battery Charger Reference Design with ATtiny15
;
; Change log
; V1.2 JB Fixed bug when stopping PWM output
;*************************[ Included Define Files ]***********************
; Define files included here
; Note: Battery Specific Functions are included at the end of this file
.include "tn15def.inc"
;***************************************************************************
;* A P P L I C A T I O N N O T E F O R T H E A V R F A M I L Y
;*
;* Number :AVR000
;* File Name :"tn15def.inc"
;* Title :Register/Bit Definitions for the ATtiny15
;* Date :99.07.05
;* Version :1.00
;* Support E-mail :avr@atmel.com
;* Target MCU :ATtiny15
;*
;* DESCRIPTION
;* When including this file in the assembly program file, all I/O register
;* names and I/O register bit names appearing in the data book can be used.
;* In addition, the six registers forming the three data pointers X, Y and
;* Z have been assigned names XL - ZH. Highest RAM address for Internal
;* SRAM is also defined
;*
;* The Register names are represented by their hexadecimal address.
;*
;* The Register Bit names are represented by their bit number (0-7).
;*
;* Please observe the difference in using the bit names with instructions
;* such as "sbr"/"cbr" (set/clear bit in register) and "sbrs"/"sbrc"
;* (skip if bit in register set/cleared). The following example illustrates
;* this:
;*
;* in r16,PORTB ;read PORTB latch
;* sbr r16,(1<<PB6)+(1<<PB5) ;set PB6 and PB5 (use masks, not bit#)
;* out PORTB,r16 ;output to PORTB
;*
;* in r16,TIFR ;read the Timer Interrupt Flag Register
;* sbrc r16,TOV0 ;test the overflow flag (use bit#)
;* rjmp TOV0_is_set ;jump if set
;* ... ;otherwise do something else
;***************************************************************************
;***** Specify Device
.device ATtiny15
;***** I/O Register Definitions
.equ SREG =$3f
.equ GIMSK =$3b
.equ GIFR =$3a
.equ TIMSK =$39
.equ TIFR =$38
.equ MCUCR =$35
.equ MCUSR =$34
.equ TCCR0 =$33
.equ TCNT0 =$32
.equ OSCCAL =$31
.equ TCCR1 =$30
.equ TCNT1 =$2f
.equ OCR1A =$2e
.equ OCR1B =$2d
.equ SFIOR =$2c
.equ WDTCR =$21
.equ EEAR =$1e
.equ EEDR =$1d
.equ EECR =$1c
.equ PORTB =$18
.equ DDRB =$17
.equ PINB =$16
.equ ACSR =$08
.equ ADMUX =$07
.equ ADCSR =$06
.equ ADCH =$05
.equ ADCL =$04
;***** Bit Definitions
.equ INT0 =6
.equ PCIE =5
.equ INTF0 =6
.equ PCIF =5
.equ OCIE1 =6
.equ TOIE1 =2
.equ TOIE0 =1
.equ OCF1 =6
.equ TOV1 =2
.equ TOV0 =1
.equ PUD =6
.equ SE =5
.equ SM =4
.equ SM1 =4
.equ SM0 =3
.equ ISC01 =1
.equ ISC00 =0
.equ WDRF =3
.equ BORF =2
.equ EXTRF =1
.equ PORF =0
.equ CS02 =2
.equ CS01 =1
.equ CS00 =0
.equ CAL7 =7
.equ CAL6 =6
.equ CAL5 =5
.equ CAL4 =4
.equ CAL3 =3
.equ CAL2 =2
.equ CAL1 =1
.equ CAL0 =0
.equ CTC1 =7
.equ PWM1 =6
.equ COM11 =5
.equ COM10 =4
.equ CS13 =3
.equ CS12 =2
.equ CS11 =1
.equ CS10 =0
.equ FOCM =2
.equ PSR1 =1
.equ PSR0 =0
.equ WDTOE =4
.equ WDE =3
.equ WDP2 =2
.equ WDP1 =1
.equ WDP0 =0
.equ EERIE =3
.equ EEMWE =2
.equ EEWE =1
.equ EERE =0
.equ PB4 =4
.equ PB3 =3
.equ PB2 =2
.equ PB1 =1
.equ PB0 =0
.equ DDB5 =5
.equ DDB4 =4
.equ DDB3 =3
.equ DDB2 =2
.equ DDB1 =1
.equ DDB0 =0
.equ PINB5 =5
.equ PINB4 =4
.equ PINB3 =3
.equ PINB2 =2
.equ PINB1 =1
.equ PINB0 =0
.equ ACD =7
.equ ACO =5
.equ ACI =4
.equ ACIE =3
.equ ACIS1 =1
.equ ACIS0 =0
.equ REFS1 =7
.equ REFS0 =6
.equ ADLAR =5
.equ MUX2 =2
.equ MUX1 =1
.equ MUX0 =0
.equ ADEN =7
.equ ADSC =6
.equ ADFR =5
.equ ADIF =4
.equ ADIE =3
.equ ADPS2 =2
.equ ADPS1 =1
.equ ADPS0 =0
.def ZL =r30
.def ZH =r31
.equ INT0addr=$001 ;External Interrupt0 Vector Address
.equ PCINTaddr=$002 ;Pin change Interrupt Vector Address
.equ T1COMPaddr=$003 ;Timer1 Compare match interrupt vector address
.equ OVF1addr=$004 ;Overflow 1 Interrupt Vector Address
.equ OVF0addr=$005 ;Overflow 1 Interrupt Vector Address
.equ EERDYaddr =$006 ;EEPROM Interrupt Vector Address
.equ ACIaddr =$007 ;Analog Comparator Interrupt Vector Address
.equ ADCCaddr =$008 ;ADC Interrupt Vector Address
.include "bc.inc"
; Last change: JB 00/07/11 (YY/MM/DD)
;**************************** MODULE INFO *******************************
;
; File name : BC.INC
; AUTHOR : Atmel
; VERSION : 1.2
; DATE : July 10th 2000
;
; Compiler : Atmel AVR Assembler 1.30
; Contents : Header file for Travel Charger Reference Design
;
;*************************[ Charger Characteristics ]********************
.equ sec_duration = 6 ; 1 Second (#Timer0 Overflow Interrupts)
.equ min_duration = 61 ; ~1 Minute (1.6 MHz = 59,965 sec)
;.equ min_duration = 6 ; ~1 Minute (1.6 MHz = 6 sec), debug
.equ avg_loop_cnt = 4 ; ADC Measurement Average Loop Count
; NOTE! Count = (1<<avr_loop_cnt) !!!
;*************************[ Hardware Assignments ]************************
.equ PWM_PIN = PB1 ; PWM pin
.equ ADC_T_channel =0x41 ; Battery Temperature Channel
.equ ADC_I_channel =0x42 ; Battery Current Channel
.equ ADC_V_channel =0x43 ; Battery Voltage Channel
.equ ADC_offset_channel =0x44 ; ADC Offset Channel
.equ ADC_g_offset_channel =0x45 ; ADC gain Offset Channel
.equ ADC_diff_channel =0x46 ; ADC Diff Channel
.equ ADC_gain_channel =0x47 ; ADC gain Channel
;*************************[ Register Assignments ]************************
.def SREG_Storage =r1 ; Temporary Storage During Interrupts
.def av_l =r5 ; Average Low Byte (ADC Measurement)
.def av_h =r6 ; Average High Byte (ADC Measurement)
.def last_min_Vl =r10 ; Last minute Voltage Low Byte
.def last_min_Vh =r11 ; Last minute Voltage High Byte
.def last_min_Tl =r12 ; Last minute Temperature Low Byte
.def last_min_Th =r13 ; Last minute Temperature High Byte
.def last_t_min =r14 ; Last minute tick counter
.def temp =r16 ; Temporary Storage Register 1
.def temp2 =r17 ; Temporary Storage Register 2
.def tick_cnt =r18 ; Tick Counter
.def t_sec =r19 ; Time_seconds
.def t_min =r20 ; Time_minutes
.def control =r21 ; Charge control register
.def Vl =r22 ; Voltage Low Byte
.def Vh =r23 ; Voltage High Byte
.def Il =r24 ; Current Low Byte
.def Ih =r25 ; Current High Byte
.def Tl =r26 ; Temperature Low Byte
.def Th =r27 ; Temperature High Byte
.def chargel =r28 ; Temp variable, used only in Liion
.def chargeh =r29 ; Temp variable, used only in Liion
;*************************[ Charge Control ]******************************
.equ NO_PWM =0x01
.include "liion.inc" ;Battery spec.
; Last change: JB 00/07/11 (YY/MM/DD)
;**************************** MODULE INFO *******************************
;
; File name : LIION.INC
; AUTHOR : Atmel
; VERSION : 1.2
; DATE : July 10th 2000
;
; Compiler : Atmel AVR Assembler 1.30
; Contents : Header file for liion.asm, containing the battery
; specific definitions, functions and subroutines
;
;
; 20 * capacity * R16_17 * AD_resolution
; I_fast = ______________________________________
; R18 * (R8_9 + R16_17) * V_ref_voltage
;
;
; cell_voltage * cells * R16_17 * AD_resolution
; max_V_Fast = _____________________________________________
; (R8_9 + R16_17) * V_ref_voltage
;
;
; I_trickle = I_fast/40
;
; 20 * min_I * cells * R16_17 * AD_resolution
; min_I_fast = ___________________________________________
; R18 * (R8_9 + R16_17) * V_ref_voltage
;
; Change log
; V1.1 JB Added calculations for measurements, changed charge parameters
;
;*************************[ Battery Characteristics ]*********************
;Modify these values according to battery datasheet
.equ cells = 1 ; number of cells in the battery pack
.equ capacity = 750 ; battery pack capacity in mAh LiIon
.equ cell_voltage = 4100 ; change cell voltage between 4100 mV
; and 4200 mV
.equ AD_ref_voltage = 3670 ; A/D Converter reference voltage, 3670mV
.equ AD_resolution = 1024 ; A/D converter resolution, 10-bit, 1024 steps
.equ min_T_abs = 0x02C7 ; Termination Temperature = 5 C
.equ max_T_abs = 0x0175 ; Termination Temperature = 40 C
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -