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

📄 cpld_read.s

📁 用ICC编写的程序包括SPI
💻 S
字号:
	.module Cpld_Read.c
	.area text(rom, con, rel)
	.dbfile F:\IccAvr_Pro\Cpld_Read.c
	.dbfunc e Cpld_Read _Cpld_Read fI
;           temp -> R22
;         Result -> R20,R21
;        Address -> R16
	.even
_Cpld_Read::
	xcall push_gset2
	.dbline -1
	.dbline 5
; #include "Cpld_Read.h"
; #include <macros.h>
; 
; int Cpld_Read(unsigned char Address)
; {
	.dbline 9
;   
;   unsigned char temp;
;   int 	 Result;
;   CLI();
	cli
	.dbline 10
;   if(Address)		   					//Address select
	tst R16
	breq L2
	.dbline 11
;   	PORTB|=BIT(A0);			
	sbi 0x18,3
	xjmp L3
L2:
	.dbline 13
;   else
;   	PORTB&=~BIT(A0);
	cbi 0x18,3
L3:
	.dbline 14
;   PORTB|=BIT(LoadL);					//LoadL set low
	sbi 0x18,1
	.dbline 15
;   NOP();
	nop
	.dbline 16
;   NOP();
	nop
	.dbline 17
;   PORTB&=~BIT(LoadL);					
	cbi 0x18,1
	.dbline 18
;   NOP();
	nop
	.dbline 19
;   NOP();
	nop
	.dbline 20
;   NOP();
	nop
	.dbline 21
;   temp=CpldRead;						//Read Data low byte
	in R22,0x19
	.dbline 22
;   temp=CpldRead;
	in R22,0x19
	.dbline 24
;   
;   PORTB|=BIT(LoadL);					//Set LoadL high
	sbi 0x18,1
	.dbline 26
;   
;   PORTB|=BIT(LoadH);					//LoadH set low
	sbi 0x18,0
	.dbline 27
;   NOP();
	nop
	.dbline 28
;   NOP();
	nop
	.dbline 29
;   PORTB&=~BIT(LoadH);					
	cbi 0x18,0
	.dbline 30
;   NOP();
	nop
	.dbline 31
;   NOP();
	nop
	.dbline 32
;   NOP();
	nop
	.dbline 33
;   Result=CpldRead;						//Read Data low byte
	in R20,0x19
	clr R21
	.dbline 34
;   Result=CpldRead;
	in R20,0x19
	clr R21
	.dbline 36
;   
;   PORTB|=BIT(LoadH);					//LoadH set high
	sbi 0x18,0
	.dbline 38
;   
;  Result=(Result<<8)+temp;
	mov R21,R20
	mov R20,R22
	.dbline 39
;  SEI();
	sei
	.dbline 41
;  
;  return	 Result;
	movw R16,R20
	.dbline -2
L1:
	xcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym r temp 22 c
	.dbsym r Result 20 I
	.dbsym r Address 16 c
	.dbend
	.dbfunc e Cpld_Set _Cpld_Set fV
	.even
_Cpld_Set::
	.dbline -1
	.dbline 46
;  
;  }
;  
;  void  Cpld_Set(void)
;  {
	.dbline 47
;   	CLI();			 	 				//Set all the counters reset 
	cli
	.dbline 48
; 	PORTB|=BIT(Set);					//Zero
	sbi 0x18,2
	.dbline 49
; 	NOP();
	nop
	.dbline 50
; 	NOP();
	nop
	.dbline 51
; 	PORTB&=~BIT(Set);
	cbi 0x18,2
	.dbline 52
; 	NOP();
	nop
	.dbline 53
; 	NOP();
	nop
	.dbline 54
; 	NOP();
	nop
	.dbline 55
; 	NOP();
	nop
	.dbline 56
; 	NOP();
	nop
	.dbline 57
; 	NOP();
	nop
	.dbline 58
; 	PORTB|=BIT(Set);
	sbi 0x18,2
	.dbline 59
; 	SEI();
	sei
	.dbline -2
L4:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e Cpld_Init _Cpld_Init fV
	.even
_Cpld_Init::
	.dbline -1
	.dbline 63
; }
; 
; void  Cpld_Init(void)
; {	  
	.dbline 64
;  PORTB|=BIT(Set);	 	 				//Set All Control signal high
	sbi 0x18,2
	.dbline 65
;  PORTB|=BIT(LoadL);
	sbi 0x18,1
	.dbline 66
;  PORTB|=BIT(LoadH);
	sbi 0x18,0
	.dbline 67
;  PORTB&=~BIT(LoadL);
	cbi 0x18,1
	.dbline -2
L5:
	.dbline 0 ; func end
	ret
	.dbend

⌨️ 快捷键说明

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