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

📄 main.s

📁 Atmega64单片机程序(完整工程)
💻 S
字号:
	.module main.c
	.area data(ram, con, rel)
_WritFileData::
	.blkb 21
	.area idata
	.byte 'F,'i,'l,'e,32,'s,'y,'s,'t,'e,'m,32,'t,'e,'s,'t
	.byte 33,33,33,10,0
	.area data(ram, con, rel)
	.area text(rom, con, rel)
;              c -> R20
	.even
__StackOverflowed::
	xcall push_gset1
	mov R20,R16
; #include "SYS_Config.h"
; #include "GUI_Config.h"
; #include "FS_Config.h"
; #include "time.h"
; #include "KeyScan.h"
; 
; #include "SD_Config.h"
; 
; #include "GUI.h"
; #include "Picture.h"
; 
; #include "SD_EEPROM.h"
; #include "SD_Drive.h"
; #include "USART1.h"
; #include "TEST_SD.h"
; 
; #include "fat.h"
; 
; INT8U Data_Buf[SD_BLOCKSIZE];
; INT8U WritFileData[]="File system test!!!\n";
; 
; //注明:堆在设为64,设为32会出现硬件堆在溢出的情况!!!
; extern void MenuMainLoop(void);
; //编译时间
; extern void DispBuildTime(void);
; 
; void _StackOverflowed(char c)
; {
;    if (c == 1)
	cpi R20,1
	brne L2
;        Uart1_SendString("\ntrashed HW stack\n");
	ldi R16,<L4
	ldi R17,>L4
	xcall _Uart1_SendString
	xjmp L3
L2:
;    else
;        Uart1_SendString("\ntrashed SW stack\n");
	ldi R16,<L5
	ldi R17,>L5
	xcall _Uart1_SendString
L3:
L1:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
;              i -> <dead>
	.even
_main::
	sbiw R28,3
; }
; 
; 
; HANDLE FHandle;//文件系统句柄
; void main(void)
; {
;     INT8U i;
; 	
;     GUI_Delay(500);//等待系统稳定,再作初始化
	ldi R16,500
	ldi R17,1
	xcall _GUI_Delay
; 
;     CLI();//关中断,对模块函数进行初始化
	cli
; 	timer0_init();
	xcall _timer0_init
; 	timer2_init();
	xcall _timer2_init
; 	
;     #if USART1_EN
;         Uart1_Init();
	xcall _Uart1_Init
;     #endif
;     
;     #if (USART1_EN==1&&SD_MMC_TEST_EN==1)
;         Test_SD_Initialize();   //SD卡初始化(带串口输出功能)
;     #else
;         SD_Initialize();
	xcall _SD_Initialize
;     #endif
;     
;     GUI_Init();
	xcall _GUI_Init
; 	//编译时间
;     DispBuildTime();
	xcall _DispBuildTime
; 	GUI_Delay(10000);
	ldi R16,10000
	ldi R17,39
	xcall _GUI_Delay
;     
;     SEI();//开中断 
	sei
;     
; 	//GUI_Display_Image(PIC_FAT);
;     
;     #if SD_MMC_TEST_EN
;         SD_MMC_TEST();          //测试SD卡各项功能函数,正常使用时使SD_MMC_TEST_EN=0
;     #endif
;      
;     DiskInit();                 //初始化磁盘管理模块
	xcall _DiskInit
;     AddFileDriver( SD_Command );//加载SD卡驱动程序
	ldi R16,<PL_SD_Command
	ldi R17,>PL_SD_Command
	xcall _AddFileDriver
;     FileInit();
	xcall _FileInit
;        
;     Uart1_SendString("\n\nMakeDir:");    
	ldi R16,<L7
	ldi R17,>L7
	xcall _Uart1_SendString
;     MakeDir("a:\\蒋金雄");
	ldi R16,<L8
	ldi R17,>L8
	xcall _MakeDir
;     
;     //Uart1_SendString("\n\nFileOpen_W:");    
;     //FHandle = FileOpen("a:\\蒋金雄\\JJX.txt","w");
;     
;     //Uart1_SendString("\n\nFileWrite:");    
;     //FileWrite(WritFileData,sizeof(WritFileData), FHandle);
;     
;     //Uart1_SendString("\n\nFileClose:");    
;     //FileClose(FHandle);
;     
;     Uart1_SendString("\n\nFileOpen:");    
	ldi R16,<L9
	ldi R17,>L9
	xcall _Uart1_SendString
;     FHandle = FileOpen("a:\\蒋金雄\\JJX.txt","r");
	ldi R18,<L11
	ldi R19,>L11
	ldi R16,<L10
	ldi R17,>L10
	xcall _FileOpen
	sts _FHandle,R16
;     
;     Uart1_SendString("\n\nFileRead:");    
	ldi R16,<L12
	ldi R17,>L12
	xcall _Uart1_SendString
;     FileRead(Data_Buf,512,FHandle);
	lds R2,_FHandle
	std y+2,R2
	ldi R20,0
	ldi R21,2
	ldi R22,0
	ldi R23,0
	std y+0,R22
	std y+1,R23
	movw R18,R20
	ldi R16,<_Data_Buf
	ldi R17,>_Data_Buf
	xcall _FileRead
;     
;     Uart1_SendString("\n\nFileClose:"); 
	ldi R16,<L13
	ldi R17,>L13
	xcall _Uart1_SendString
;     FileClose(FHandle);
	lds R16,_FHandle
	xcall _FileClose
;     
;     Uart1_SendString("\n\nOUTPUT:");  
	ldi R16,<L14
	ldi R17,>L14
	xcall _Uart1_SendString
;     Uart1_SendString(Data_Buf);    
	ldi R16,<_Data_Buf
	ldi R17,>_Data_Buf
	xcall _Uart1_SendString
; 
; 
;     AllCacheWriteBack();
	xcall _AllCacheWriteBack
;     RemoveFileDriver(0);
	clr R16
	xcall _RemoveFileDriver
	xjmp L16
L15:
	xcall __StackCheck
	xcall _MenuMainLoop
L16:
;     
;     while(1)
	xjmp L15
X0:
L6:
	adiw R28,3
	.dbline 0 ; func end
	ret
	.area bss(ram, con, rel)
_FHandle::
	.blkb 1
_Data_Buf::
	.blkb 512
	.area data(ram, con, rel)
L14:
	.blkb 10
	.area idata
	.byte 10,10,'O,'U,'T,'P,'U,'T,58,0
	.area data(ram, con, rel)
L13:
	.blkb 13
	.area idata
	.byte 10,10,'F,'i,'l,'e,'C,'l,'o,'s,'e,58,0
	.area data(ram, con, rel)
L12:
	.blkb 12
	.area idata
	.byte 10,10,'F,'i,'l,'e,'R,'e,'a,'d,58,0
	.area data(ram, con, rel)
L11:
	.blkb 2
	.area idata
	.byte 'r,0
	.area data(ram, con, rel)
L10:
	.blkb 18
	.area idata
	.byte 'a,58,92,189,175,189,240,208,219,92,'J,'J,'X,46,'t,'x
	.byte 't,0
	.area data(ram, con, rel)
L9:
	.blkb 12
	.area idata
	.byte 10,10,'F,'i,'l,'e,'O,'p,'e,'n,58,0
	.area data(ram, con, rel)
L8:
	.blkb 10
	.area idata
	.byte 'a,58,92,189,175,189,240,208,219,0
	.area data(ram, con, rel)
L7:
	.blkb 11
	.area idata
	.byte 10,10,'M,'a,'k,'e,'D,'i,'r,58,0
	.area data(ram, con, rel)
L5:
	.blkb 19
	.area idata
	.byte 10,'t,'r,'a,'s,'h,'e,'d,32,'S,'W,32,'s,'t,'a,'c
	.byte 'k,10,0
	.area data(ram, con, rel)
L4:
	.blkb 19
	.area idata
	.byte 10,'t,'r,'a,'s,'h,'e,'d,32,'H,'W,32,'s,'t,'a,'c
	.byte 'k,10,0
	.area data(ram, con, rel)
	.area func_lit
PL_SD_Command:	.word `_SD_Command

⌨️ 快捷键说明

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