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

📄 stk500i.lst

📁 AVR单片机,STK500下载线制作全套资料,包括程序,电路图
💻 LST
📖 第 1 页 / 共 5 页
字号:
__start:
__text_start:
    0018 E5CF      LDI	R28,0x5F
    0019 E0D4      LDI	R29,4
    001A BFCD      OUT	0x3D,R28
    001B BFDE      OUT	0x3E,R29
    001C 51C0      SUBI	R28,0x10
    001D 40D0      SBCI	R29,0
    001E EA0A      LDI	R16,0xAA
    001F 8308      STD	Y+0,R16
    0020 2400      CLR	R0
    0021 E6E9      LDI	R30,0x69
    0022 E0F0      LDI	R31,0
    0023 E011      LDI	R17,1
    0024 3AE0      CPI	R30,0xA0
    0025 07F1      CPC	R31,R17
    0026 F011      BEQ	0x0029
    0027 9201      ST	R0,Z+
    0028 CFFB      RJMP	0x0024
    0029 8300      STD	Z+0,R16
    002A E2E6      LDI	R30,0x26
    002B E0F0      LDI	R31,0
    002C E6A0      LDI	R26,0x60
    002D E0B0      LDI	R27,0
    002E E010      LDI	R17,0
    002F 32EF      CPI	R30,0x2F
    0030 07F1      CPC	R31,R17
    0031 F021      BEQ	0x0036
    0032 95C8      LPM
    0033 9631      ADIW	R30,1
    0034 920D      ST	R0,X+
    0035 CFF9      RJMP	0x002F
    0036 D06F      RCALL	_main
_exit:
    0037 CFFF      RJMP	_exit
_T1_OCR1A:
    0038 938A      ST	R24,-Y
    0039 939A      ST	R25,-Y
    003A B78F      IN	R24,0x3F
    003B 938A      ST	R24,-Y
FILE: E:\ICCAVR\project\AVRISP~1\icc\tools.c
(0001) 
(0002) #include "stk500.h"
(0003) 
(0004) static unsigned int t1_tick;
(0005) 
(0006) //Konstanten im EEPROM
(0007) //#define EEPROM  __attribute__ ((section (".eeprom")))
(0008) 
(0009) //Variablen im EEPROM
(0010) //EEPROM unsigned char eeprom_sck_period=10;
(0011) //unsigned char eeprom_sck_period=10;
(0012) 
(0013) #ifndef __iom88v_h
(0014) #pragma interrupt_handler T1_OCR1A: 7	/*meag8*/
(0015) #else
(0016) #pragma interrupt_handler T1_OCR1A: 12	/*mega88*/
(0017) #endif
(0018) void T1_OCR1A(void) {
(0019) 	t1_tick --;
    003C 91800069  LDS	R24,t1_tick
    003E 9190006A  LDS	R25,t1_tick+1
    0040 9701      SBIW	R24,1
    0041 9390006A  STS	t1_tick+1,R25
    0043 93800069  STS	t1_tick,R24
    0045 9189      LD	R24,Y+
    0046 BF8F      OUT	0x3F,R24
    0047 9199      LD	R25,Y+
    0048 9189      LD	R24,Y+
    0049 9518      RETI
(0020) }
(0021) 
(0022) /*延时函数*/
(0023) //void wait_ms(unsigned int n) {
(0024) //
(0025) //	unsigned int a, b;
(0026) //	for (a = 0; a < n; a++) {
(0027) //		for (b = 600; b; b--) {
(0028) //			;
(0029) //			}
(0030) //		}
(0031) //}
(0032) 
(0033) unsigned char get_t1_tick(void) {
(0034) 	if(t1_tick) {
_get_t1_tick:
    004A 90200069  LDS	R2,t1_tick
    004C 9030006A  LDS	R3,t1_tick+1
    004E 2022      TST	R2
    004F F411      BNE	0x0052
    0050 2033      TST	R3
    0051 F041      BEQ	0x005A
(0035) 		t1_tick=0;
    0052 2422      CLR	R2
    0053 2433      CLR	R3
    0054 9230006A  STS	t1_tick+1,R3
    0056 92200069  STS	t1_tick,R2
(0036) 		return 1;
    0058 E001      LDI	R16,1
    0059 C001      RJMP	0x005B
(0037) 		}
(0038) 	return 0;
    005A 2700      CLR	R16
    005B 9508      RET
_wait_ms:
  n                    --> R20
    005C D944      RCALL	push_gset1
    005D 01A8      MOVW	R20,R16
(0039) }
(0040) 
(0041) void wait_ms(unsigned int n) {
    005E C005      RJMP	0x0064
(0042) 	while(n) {
(0043) 		if (get_t1_tick()) {
    005F DFEA      RCALL	_get_t1_tick
    0060 2300      TST	R16
    0061 F011      BEQ	0x0064
(0044) 			n --;
    0062 5041      SUBI	R20,1
    0063 4050      SBCI	R21,0
    0064 3040      CPI	R20,0
    0065 0745      CPC	R20,R21
    0066 F7C1      BNE	0x005F
    0067 D93C      RCALL	pop_gset1
    0068 9508      RET
FILE: E:\ICCAVR\project\AVRISP~1\icc\interface.c
(0001) /**	\file 
(0002) 	<b>USB receive and transmit</b><br>
(0003) 	Autor: Matthias Wei遝r<br>
(0004) 	Copyright 2005: Matthias Wei遝r<br>
(0005) 	License: QPL (see license.txt)
(0006) 	<hr>
(0007) */
(0008) #include "stk500.h"
(0009) 
(0010) unsigned char checksum;
(0011) 
(0012) //#ifdef CONFIG_INTERFACE_USB
(0013) #if 0
(0014) 
(0015) 	//Hardware
(0016) 	#define	USB_TXE		(PINB&BIT6_POS)
(0017) 	#define	USB_RXF		(PINC&BIT3_POS)
(0018) 	#define	USB_RD_ON	PORTC&=BIT1_NEG
(0019) 	#define	USB_RD_OFF	PORTC|=BIT1_POS
(0020) 	#define	USB_WR_ON	PORTC|=BIT2_POS
(0021) 	#define	USB_WR_OFF	PORTC&=BIT2_NEG
(0022) 	
(0023) 	/**
(0024) 		Initializes the usb interface
(0025) 	*/
(0026) 	void interface_init(void)
(0027) 	{
(0028) 		PORTC |= BIT1_POS;			//USB_RD inactive
(0029) 		DDRC |= BIT1_POS|BIT2_POS;	//USB_RD, USB_WR as output
(0030) 	}
(0031) 	
(0032) 	/**
(0033) 		Reads a byte from the USB interface
(0034) 		
(0035) 		@return received character or -1 if no character has been received
(0036) 	*/
(0037) 	signed int interface_getc(void)
(0038) 	{
(0039) 		unsigned char t;
(0040) 		
(0041) 		if(!USB_RXF)
(0042) 		{	
(0043) 			USB_RD_ON;
(0044) 			asm("NOP");
(0045) 			t = PIND;
(0046) 			USB_RD_OFF;
(0047) 			
(0048) 			return t;
(0049) 		}
(0050) 		else return -1;
(0051) 	}
(0052) 	
(0053) 	/**
(0054) 		Writes a byte to the USB
(0055) 		
(0056) 		@param t Byte to be written	
(0057) 	*/
(0058) 	void interface_putc(unsigned char t)
(0059) 	{
(0060) 		while(USB_TXE);
(0061) 		
(0062) 		//PORTD auf Ausgang
(0063) 		DDRD = 0xFF;
(0064) 		//Daten auf den Port
(0065) 		PORTD = t;
(0066) 		
(0067) 		USB_WR_ON;
(0068) 		USB_WR_OFF;
(0069) 		
(0070) 		//PORTC auf Eingang
(0071) 		DDRD = 0x00;
(0072) 		//Pull-Ups ein
(0073) 		PORTD = 0xFF;
(0074) 		
(0075) 		checksum ^= t;
(0076) 	}
(0077) 	
(0078) #endif
(0079) 
(0080) #ifdef CONFIG_INTERFACE_RS232
(0081) 	
(0082) /**
(0083) 	Initializes the rs232 interface
(0084) 	3.6864MHz
(0085) 	Autor: Lukas Salzburger
(0086) */
(0087) void interface_init(void) {
(0088) 	#ifndef __iom88v_h				/*meag8*/
(0089) 		UCSRB =  (1<<RXEN) | (1<<TXEN);
_interface_init:
    0069 E188      LDI	R24,0x18
    006A B98A      OUT	0x0A,R24
(0090) 		UBRRL = 1;
    006B E081      LDI	R24,1
    006C B989      OUT	0x09,R24
(0091) 		UBRRH = 0;
    006D 2422      CLR	R2
    006E BC20      OUT	0x20,R2
    006F 9508      RET
(0092) 	#else							/*mega88*/
(0093) 		UCSR0B =  (1<<RXEN0) | (1<<TXEN0);
(0094) 		UBRR0L = 1;
(0095) 		UBRR0H = 0;
(0096) 	#endif
(0097) }
(0098) 
(0099) /**
(0100) 	Reads a byte from the UART interface
(0101) 	
(0102) 	Autor: Lukas Salzburger
(0103) 	
(0104) 	@return received character or -1 if no character has been received
(0105) */
(0106) signed int interface_getc(void) {	/*获取PC机发来的一字节信息*/
(0107) 
(0108) 	#ifndef __iom88v_h				/*meag8*/
(0109) 		if (UCSRA & (1<<RXC)) {
_interface_getc:
    0070 9B5F      SBIS	0x0B,7
    0071 C003      RJMP	0x0075
(0110) 			return UDR;
    0072 B10C      IN	R16,0x0C
    0073 2711      CLR	R17
    0074 C002      RJMP	0x0077
(0111) 			}
(0112) 		else {
(0113) 			return -1;
    0075 EF0F      LDI	R16,0xFF
    0076 EF1F      LDI	R17,0xFF
    0077 9508      RET
(0114) 			}
(0115) 	#else							/*mega88*/
(0116) 		if (UCSR0A & (1<<RXC0)) {
(0117) 			return UDR0;
(0118) 			}
(0119) 		else {
(0120) 			return -1;
(0121) 			}
(0122) 	#endif
(0123) }
(0124) 
(0125) /**
(0126) 	Writes a byte to the UART
(0127) 	
(0128) 	Autor: Lukas Salzburger
(0129) 	
(0130) 	@param t Byte to be written	
(0131) */
(0132) void interface_putc(unsigned char t) {
(0133) 
(0134) 	#ifndef __iom88v_h				/*meag8*/
(0135) 		while (!(UCSRA & (1<<UDRE)));
_interface_putc:
  t                    --> R16
    0078 9B5D      SBIS	0x0B,5
    0079 CFFE      RJMP	_interface_putc
(0136) 		
(0137) 		UDR = t;
    007A B90C      OUT	0x0C,R16
(0138) 		checksum ^= t;
    007B 9020006B  LDS	R2,checksum
    007D 2620      EOR	R2,R16
    007E 9220006B  STS	checksum,R2
    0080 9508      RET
_interface_print:
  s                    --> R20
    0081 D91F      RCALL	push_gset1
    0082 01A8      MOVW	R20,R16
(0139) 	#else							/*mega88*/
(0140) 		while (!(UCSR0A & (1<<UDRE0)));
(0141) 		
(0142) 		UDR0 = t;
(0143) 		checksum ^= t;
(0144) 	#endif
(0145) }
(0146) 
(0147) #endif
(0148) 	
(0149) /**
(0150) 	Writes a string to USB
(0151) 	
(0152) 	@param s The string to be send
(0153) */
(0154) void interface_print(unsigned char *s)
(0155) {
    0083 C005      RJMP	0x0089
(0156) 	while(*s)
(0157) 	{
(0158) 		interface_putc(*s);
    0084 01FA      MOVW	R30,R20
    0085 8100      LDD	R16,Z+0
    0086 DFF1      RCALL	_interface_putc
(0159) 		s++;
    0087 5F4F      SUBI	R20,0xFF
    0088 4F5F      SBCI	R21,0xFF
    0089 01FA      MOVW	R30,R20
    008A 8020      LDD	R2,Z+0
    008B 2022      TST	R2
    008C F7B9      BNE	0x0084
    008D D916      RCALL	pop_gset1
    008E 9508      RET
_interface_put16:
  t                    --> R20
    008F D911      RCALL	push_gset1
    0090 01A8      MOVW	R20,R16
(0160) 	}
(0161) }
(0162) 
(0163) /**
(0164) 	Sends a 16 bit value over the USB
(0165) 	MSB first
(0166) 	
(0167) 	@param t Value to be send
(0168) */
(0169) void interface_put16(unsigned int t)
(0170) {
(0171) 	interface_putc((t>>8)&0xFF);
    0091 018A      MOVW	R16,R20
    0092 2F01      MOV	R16,R17
    0093 2711      CLR	R17
    0094 7010      ANDI	R17,0
    0095 DFE2      RCALL	_interface_putc
(0172) 	interface_putc((t>>0)&0xFF);
    0096 2F04      MOV	R16,R20
    0097 7010      ANDI	R17,0
    0098 DFDF      RCALL	_interface_putc
    0099 D90A      RCALL	pop_gset1
    009A 9508      RET
(0173) }
(0174) 
(0175) /**
(0176) 	Resets the checksum accumulator
(0177) */
(0178) void interface_reset_check(void)
(0179) {
(0180) 	checksum=0;
_interface_reset_check:
    009B 2422      CLR	R2
    009C 9220006B  STS	checksum,R2
    009E 9508      RET
(0181) }
(0182) 
(0183) /**
(0184) 	Sends the accumulated checksum
(0185) */
(0186) void interface_send_check(void)
(0187) {
(0188) 	interface_putc(checksum);
_interface_send_check:
    009F 9100006B  LDS	R16,checksum
    00A1 DFD6      RCALL	_interface_putc
(0189) 	checksum=0;
    00A2 2422      CLR	R2
    00A3 9220006B  STS	checksum,R2
    00A5 9508      RET
_main:
  i                    --> Y+1
  msg_size             --> R22
  seq_num              --> Y+0
  checksum             --> R12
  t                    --> R20
  state                --> R14
  rec_data             --> R10
    00A6 9723      SBIW	R28,3
FILE: E:\ICCAVR\project\AVRISP~1\icc\main.c
(0001) /**	\file
(0002) 	<b>USBisp main</b><br>
(0003) 	Autor: Matthias Wei遝r<br>
(0004) 	Copyright 2005: Matthias Wei遝r<br>
(0005) 	License: QPL (see license.txt)
(0006) 	<hr>
(0007) */
(0008) /*! \mainpage USBisp STK500 v2
(0009) 
(0010) 	(c)2005 by Matthias Weisser
(0011) 
(0012) 	This software is distributed under the QPL
(0013) 	see license.txt for more information
(0014) 
(0015)  	\section Compiler
(0016)  	latest WINAVR
(0017) 
(0018) 	\section version history version history
(0019) 	<b>v1.0</b>
(0020) 	<ul>
(0021) 		<li>First release</li>
(0022) 	</ul>
(0023) */
(0024) #include "stk500.h"
(0025) 
(0026) //States used in the receive state machine
(0027) #define	ST_START		0xF000								/*消息开始0x1B					*/
(0028) #define	ST_GET_SEQ_NUM	0xF001								/*消息包号						*/
(0029) #define ST_MSG_SIZE_1	0xF002								/*消息长度						*/
(0030) #define ST_MSG_SIZE_2	0xF003								/*消息长度						*/
(0031) #define ST_GET_TOKEN	0xF004								/*消息记号0x0E					*/
(0032) #define ST_GET_DATA		0xF005								/*消息数据						*/
(0033) #define	ST_GET_CHECK	0xF006								/*消息校验						*/

⌨️ 快捷键说明

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