⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simp.lst

📁 温度测量
💻 LST
📖 第 1 页 / 共 4 页
字号:

AVRASM ver. 1.54  C:\AVR\High Res Temp\simp.asm Sun Feb 02 22:35:56 2003


warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
warning : Register already defined by the .DEF directive
         ;************************************************
         ;* Main Program LCD Temperature Readout Demo	*
         ;*						*
         ;* Copyright 2001-2003 Wayne Peacock		*
         ;* First Revision 11 March 2002			*
         ;* Second Revision 19th September 2002		*
         ;*						*
         ;* Displays temperature in low & high resolution*
         ;* on a 2x16LCD panel. No RS232 included	*
         ;************************************************
         ;* See Schematic for Hardware connections	*
         ;* 						*
         ;* Disclaimer:					*
         ;* The Author takes no responsibility for the 	*
         ;* use of this code. Use at your own risk!	*
         ;* 						*
         ;* This code or part there of is licensed only 	*
         ;* for private use and NOT for commercial use.	*
         ;* 						*
         ;* Please contact the Author 'Wayne Peacock' 	*
         ;* <wpeacock@senet.com.au> before using the code*
         ;* or part there of in a commercial project.	*
         ;************************************************
          
          .Include 	"1200def.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		:"1200def.inc"
         ;* Title		:Register/Bit Definitions for the AT90S1200
         ;* Date	 		:97.12.11
         ;* Version		:1.22
         ;* Support telephone	:+47 72 88 43 88 (ATMEL Norway)
         ;* Support fax		:+47 72 88 43 99 (ATMEL Norway)
         ;* Support E-Mail	:avr@atmel.com
         ;* Target MCU		:AT90S1200
         ;*
         ;* 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.
         ;* 
         ;* The Register names are represented by their hexadecimal addresses.
         ;* 
         ;* 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 AT90S1200
         
         ;***** I/O Register Definitions
          .equ	SREG	=$3f
          .equ	GIMSK	=$3b
          .equ	TIMSK	=$39
          .equ	TIFR	=$38
          .equ	MCUCR	=$35
          .equ	TCCR0	=$33
          .equ	TCNT0	=$32
          .equ	WDTCR	=$21
          .equ	EEAR	=$1e
          .equ	EEDR	=$1d
          .equ	EECR	=$1c
          .equ	PORTB	=$18
          .equ	DDRB	=$17
          .equ	PINB	=$16
          .equ	PORTD	=$12
          .equ	DDRD	=$11
          .equ	PIND	=$10
          .equ	ACSR	=$08
         
         ;***** Bit Definitions
         
          .equ	INT0	=6
         
          .equ	TOIE0	=1
         
          .equ	TOV0	=1
         
          .equ	SE	=5
          .equ	SM	=4
          .equ	ISC01	=1
          .equ	ISC00	=0
         
          .equ	CS02	=2
          .equ	CS01	=1
          .equ	CS00	=0
         
          .equ	WDE	=3
          .equ	WDP2	=2
          .equ	WDP1	=1
          .equ	WDP0	=0
         
          .equ	EEWE	=1
          .equ	EERE	=0
         
          .equ	PB7	=7
          .equ	PB6	=6
          .equ	PB5	=5
          .equ	PB4	=4
          .equ	PB3	=3
          .equ	PB2	=2
          .equ	PB1	=1
          .equ	PB0	=0
         
          .equ	DDB7	=7
          .equ	DDB6	=6
          .equ	DDB5	=5
          .equ	DDB4	=4
          .equ	DDB3	=3
          .equ	DDB2	=2
          .equ	DDB1	=1
          .equ	DDB0	=0
         
          .equ	PINB7	=7
          .equ	PINB6	=6
          .equ	PINB5	=5
          .equ	PINB4	=4
          .equ	PINB3	=3
          .equ	PINB2	=2
          .equ	PINB1	=1
          .equ	PINB0	=0
         
          .equ	PD6	=6
          .equ	PD5	=5
          .equ	PD4	=4
          .equ	PD3	=3
          .equ	PD2	=2
          .equ	PD1	=1
          .equ	PD0	=0
         
          .equ	DDD6	=6
          .equ	DDD5	=5
          .equ	DDD4	=4
          .equ	DDD3	=3
          .equ	DDD2	=2
          .equ	DDD1	=1
          .equ	DDD0	=0
         
          .equ	PIND6	=6
          .equ	PIND5	=5
          .equ	PIND4	=4
          .equ	PIND3	=3
          .equ	PIND2	=2
          .equ	PIND1	=1
          .equ	PIND0	=0
         
          .equ	ACD	=7
          .equ	ACO	=5
          .equ	ACI	=4
          .equ	ACIE	=3
          .equ	ACIS1	=1
          .equ	ACIS0	=0
         
          .equ	XRAMEND =0
          .equ	E2END	=3F
          .equ	FLASHEND=1FF
         
          .equ	INT0addr=$001	;External Interrupt0 Vector Address
          .equ	OVF0addr=$002	;Overflow0 Interrupt Vector Address
          .equ	ACIaddr =$003	;Analog Comparator Interrupt Vector Address
         
          .def	ZL	=r30
         
          .def	count1	= r26		
          .def	count2	= r27
         
          .def	temp	= r16
          .def	data 	= r17
         
          .def	text	= r0
          .def	store	= r1
         
                 .org $0000 
                
         ;************************************************
         ;* Interrupt Vectors				*
         ;************************************************
                
000000 c003              rjmp	reset		; Reset Handler
000001 9518      	reti			; IRQ0 Handler
000002 9518      	reti			; Timer/Counter0 Overflow
000003 9518      	reti			; Analog Comparator
         	 
         ;************************************************
         ;* Main 					*
         ;************************************************
                            
          reset:  
         
         	; Power up delay is appox. 16ms
         	
000004 d047      	rcall	lcdinit			; Set up Port for LCD
000005 d0b8      	rcall	wait_2ms		; Give LCD time to start up!
000006 d0c6      	rcall	DS1820_init		; Set up Port for DS1820
         	
000007 e218      	ldi	data, 0x28		; 4 bit mode, 2 lines
000008 d05f      	rcall	command
000009 e01c      	ldi	data, 0x0C		; Display on, no cursor
00000a d05d      	rcall	command
00000b e011      	ldi	data, 0x01		; Clear Display (Requires delay)
00000c d05b      	rcall	command
         	
         ;************************************************
         ;* Top Line Display - "Wayne's TempRead"	*
         ;************************************************
          						
00000d e517      	ldi	data, 'W'
00000e d081      	rcall	onechar
         	
00000f e611      	ldi	data, 'a'
000010 d07f      	rcall	onechar
         	
000011 e719      	ldi	data, 'y'
000012 d07d      	rcall	onechar
         	
000013 e61e      	ldi	data, 'n'
000014 d07b      	rcall	onechar
         	
000015 e615      	ldi	data, 'e'
000016 d079      	rcall	onechar
         	
000017 e217      	ldi	data, 0x27
000018 d077      	rcall	onechar
         	
000019 e713      	ldi	data, 's'
00001a d075      	rcall	onechar
         	
00001b e210      	ldi	data, ' '
00001c d073      	rcall	onechar
         	
00001d e514      	ldi	data, 'T'
00001e d071      	rcall	onechar
         	
00001f e615      	ldi	data, 'e'
000020 d06f      	rcall	onechar
         	
000021 e61d      	ldi	data, 'm'
000022 d06d      	rcall	onechar
         	
000023 e710      	ldi	data, 'p'
000024 d06b      	rcall	onechar
         	
000025 e512      	ldi	data, 'R'
000026 d069      	rcall	onechar
         	
000027 e615      	ldi	data, 'e'
000028 d067      	rcall	onechar
         	
000029 e611      	ldi	data, 'a'
00002a d065      	rcall	onechar
         	
00002b e614      	ldi	data, 'd'
00002c d063      	rcall	onechar
         
         	
         ;************************************************
         ;* Get Temperature from DS1820			*
         ;************************************************
         	
          loop:
00002d ec10        	ldi	data, 0xC0
00002e d039        	rcall	command			; Bottom Line
           	
00002f d0a0      	rcall	DS1820_reset		; Reset DS1820
000030 f904      	bld	temp, WIRE
000031 fd04      	sbrc	temp, WIRE
000032 c012      	rjmp	error
         
000033 d0c9      	rcall	DS1820_conv		; Do Temp Conversion
000034 d09b      	rcall	ds1820_reset
         	
000035 d0ce      	rcall	DS1820_Scr		; Read Data in scratch Pad
         		
         ;************************************************
         ;* Display Temperature on Bottom Line		*
         ;************************************************
         		
000036 d0e4      	rcall	dump_temp
000037 e210      	ldi	data, ' '
000038 d057      	rcall	onechar
         	
000039 d0fe      	rcall	dump_temp2
00003a d136      	rcall	DS_disp
         
         ;************************************************
         ;* Display Registers on Top Line		*
         ;************************************************
         
00003b e810      	ldi	data, 0x80
00003c d02b        	rcall	command			; Top Line
           	
00003d d15d      	rcall	dump_reg
         	
00003e e001      	ldi	temp, 0x01
00003f efaf      del:	ldi	count1, 0xff
000040 d07e      	rcall	delay
000041 950a      	dec	temp
000042 f7e1      	brne	del
         	
000043 cfe9      	rjmp	loop
         			
000044 cfff      halt:	rjmp	halt
         
          error:	
000045 e615      	ldi	data, 'e'
000046 d049      	rcall	onechar
000047 e712              ldi	data, 'r'
000048 d047      	rcall	onechar
000049 e712      	ldi	data, 'r'
00004a d045      	rcall	onechar
00004b cff8      	rjmp	halt
         	
          .include "lcd4.asm"
         ;************************************************
         ;* LCD driver routines for AVR's		*
         ;*						*
         ;* For 2x16 LCD Panel (4bit Mode)		*
         ;*						*
         ;* Copyright 2001-2003 Wayne Peacock		*
         ;* First Revision 7th July 2001			*
         ;* Version 1.02					*
         ;*						*
         ;************************************************
         ;* See Schematic for Hardware connections	*
         ;* 						*
         ;* Disclaimer:					*
         ;* The Author takes no responsibility for the 	*
         ;* use of this code. Use at your own risk!	*
         ;* 						*
         ;* This code or part there of is licensed only 	*
         ;* for private use and NOT for commercial use.	*
         ;* 						*

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -