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

📄 ds1302.lss

📁 DS1302资料lcd.rar
💻 LSS
📖 第 1 页 / 共 4 页
字号:
 150:	08 95       	ret

00000152 <LCD1602_initial>:
功    能: 1602液晶初始化
参    数: 无
返回值  : 无
********************************************/
void LCD1602_initial(void)
{
 152:	2a e0       	ldi	r18, 0x0A	; 10
 154:	40 e1       	ldi	r20, 0x10	; 16
 156:	57 e2       	ldi	r21, 0x27	; 39
 158:	03 c0       	rjmp	.+6      	; 0x160 <LCD1602_initial+0xe>
 15a:	ca 01       	movw	r24, r20
 15c:	01 97       	sbiw	r24, 0x01	; 1
 15e:	f1 f7       	brne	.-4      	; 0x15c <LCD1602_initial+0xa>
	uint8_t x=10;
	while(x--)
 160:	21 50       	subi	r18, 0x01	; 1
 162:	d8 f7       	brcc	.-10     	; 0x15a <LCD1602_initial+0x8>
参    数: 无
返回值  : 无
********************************************/
void LCD1602_portini(void)
{
	LCDa_CTRL_DDR |= _BV(LCDa_RS)|_BV(LCDa_RW)|_BV(LCDa_E);//配置控制管脚为输出
 164:	8a b3       	in	r24, 0x1a	; 26
 166:	80 67       	ori	r24, 0x70	; 112
 168:	8a bb       	out	0x1a, r24	; 26
	LCDa_DATA_DDR |= 0xFF;//配置数据管脚为输出
 16a:	87 b3       	in	r24, 0x17	; 23
 16c:	27 bb       	out	0x17, r18	; 23
返回值  : 无
********************************************/
void LCD1602_sendbyte(uchar DatCmd, uchar dByte)
{
	if (DatCmd == iCmd)		//指令操作
		LCDa_CLR_RS;
 16e:	dc 98       	cbi	0x1b, 4	; 27
	else
		LCDa_SET_RS;
		
	LCDa_CLR_RW;			//写操作
 170:	dd 98       	cbi	0x1b, 5	; 27
	LCDa_SET_E;
 172:	de 9a       	sbi	0x1b, 6	; 27
	LCDa_DO = dByte;		//写入数据
 174:	88 e3       	ldi	r24, 0x38	; 56
 176:	88 bb       	out	0x18, r24	; 24
 178:	88 ee       	ldi	r24, 0xE8	; 232
 17a:	93 e0       	ldi	r25, 0x03	; 3
 17c:	01 97       	sbiw	r24, 0x01	; 1
 17e:	f1 f7       	brne	.-4      	; 0x17c <LCD1602_initial+0x2a>
_delay_us(500);
//	Delayms(1);
	LCDa_CLR_E;	
 180:	de 98       	cbi	0x1b, 6	; 27
	_delay_ms(5);
//	Delayms(100);				// 等待内部复位
	LCD1602_portini();			//端口初始化
	
	LCD1602_sendbyte(iCmd, LCDa_FUNCTION);	// 功能、模式设定
	while(LCD1602_readBF());
 182:	0e 94 88 00 	call	0x110	; 0x110 <LCD1602_readBF>
 186:	88 23       	and	r24, r24
 188:	e1 f7       	brne	.-8      	; 0x182 <LCD1602_initial+0x30>
返回值  : 无
********************************************/
void LCD1602_sendbyte(uchar DatCmd, uchar dByte)
{
	if (DatCmd == iCmd)		//指令操作
		LCDa_CLR_RS;
 18a:	dc 98       	cbi	0x1b, 4	; 27
	else
		LCDa_SET_RS;
		
	LCDa_CLR_RW;			//写操作
 18c:	dd 98       	cbi	0x1b, 5	; 27
	LCDa_SET_E;
 18e:	de 9a       	sbi	0x1b, 6	; 27
	LCDa_DO = dByte;		//写入数据
 190:	8c e0       	ldi	r24, 0x0C	; 12
 192:	88 bb       	out	0x18, r24	; 24
 194:	88 ee       	ldi	r24, 0xE8	; 232
 196:	93 e0       	ldi	r25, 0x03	; 3
 198:	01 97       	sbiw	r24, 0x01	; 1
 19a:	f1 f7       	brne	.-4      	; 0x198 <LCD1602_initial+0x46>
_delay_us(500);
//	Delayms(1);
	LCDa_CLR_E;	
 19c:	de 98       	cbi	0x1b, 6	; 27
	LCD1602_portini();			//端口初始化
	
	LCD1602_sendbyte(iCmd, LCDa_FUNCTION);	// 功能、模式设定
	while(LCD1602_readBF());
	LCD1602_sendbyte(iCmd, LCDa_ON);		//打开显示
	while(LCD1602_readBF());
 19e:	0e 94 88 00 	call	0x110	; 0x110 <LCD1602_readBF>
 1a2:	88 23       	and	r24, r24
 1a4:	e1 f7       	brne	.-8      	; 0x19e <LCD1602_initial+0x4c>
返回值  : 无
********************************************/
void LCD1602_sendbyte(uchar DatCmd, uchar dByte)
{
	if (DatCmd == iCmd)		//指令操作
		LCDa_CLR_RS;
 1a6:	dc 98       	cbi	0x1b, 4	; 27
	else
		LCDa_SET_RS;
		
	LCDa_CLR_RW;			//写操作
 1a8:	dd 98       	cbi	0x1b, 5	; 27
	LCDa_SET_E;
 1aa:	de 9a       	sbi	0x1b, 6	; 27
	LCDa_DO = dByte;		//写入数据
 1ac:	81 e0       	ldi	r24, 0x01	; 1
 1ae:	88 bb       	out	0x18, r24	; 24
 1b0:	88 ee       	ldi	r24, 0xE8	; 232
 1b2:	93 e0       	ldi	r25, 0x03	; 3
 1b4:	01 97       	sbiw	r24, 0x01	; 1
 1b6:	f1 f7       	brne	.-4      	; 0x1b4 <LCD1602_initial+0x62>
_delay_us(500);
//	Delayms(1);
	LCDa_CLR_E;	
 1b8:	de 98       	cbi	0x1b, 6	; 27
 1ba:	80 ed       	ldi	r24, 0xD0	; 208
 1bc:	97 e0       	ldi	r25, 0x07	; 7
 1be:	01 97       	sbiw	r24, 0x01	; 1
 1c0:	f1 f7       	brne	.-4      	; 0x1be <LCD1602_initial+0x6c>
	LCD1602_sendbyte(iCmd, LCDa_FUNCTION);	// 功能、模式设定
	while(LCD1602_readBF());
	LCD1602_sendbyte(iCmd, LCDa_ON);		//打开显示
	while(LCD1602_readBF());
	LCD1602_clear();						//清屏
	while(LCD1602_readBF());
 1c2:	0e 94 88 00 	call	0x110	; 0x110 <LCD1602_readBF>
 1c6:	88 23       	and	r24, r24
 1c8:	e1 f7       	brne	.-8      	; 0x1c2 <LCD1602_initial+0x70>
返回值  : 无
********************************************/
void LCD1602_sendbyte(uchar DatCmd, uchar dByte)
{
	if (DatCmd == iCmd)		//指令操作
		LCDa_CLR_RS;
 1ca:	dc 98       	cbi	0x1b, 4	; 27
	else
		LCDa_SET_RS;
		
	LCDa_CLR_RW;			//写操作
 1cc:	dd 98       	cbi	0x1b, 5	; 27
	LCDa_SET_E;
 1ce:	de 9a       	sbi	0x1b, 6	; 27
	LCDa_DO = dByte;		//写入数据
 1d0:	86 e0       	ldi	r24, 0x06	; 6
 1d2:	88 bb       	out	0x18, r24	; 24
 1d4:	88 ee       	ldi	r24, 0xE8	; 232
 1d6:	93 e0       	ldi	r25, 0x03	; 3
 1d8:	01 97       	sbiw	r24, 0x01	; 1
 1da:	f1 f7       	brne	.-4      	; 0x1d8 <LCD1602_initial+0x86>
_delay_us(500);
//	Delayms(1);
	LCDa_CLR_E;	
 1dc:	de 98       	cbi	0x1b, 6	; 27
	LCD1602_sendbyte(iCmd, LCDa_ON);		//打开显示
	while(LCD1602_readBF());
	LCD1602_clear();						//清屏
	while(LCD1602_readBF());
	LCD1602_sendbyte(iCmd, LCDa_ENTRY);	// 输入模式设定		
}
 1de:	08 95       	ret

000001e0 <DS1302_portinit>:
参    数: 无
返回值  : 无
********************************************/
void DS1302_portinit(void)		  
{
 CTRL_DDR|=_BV(RTC_CLK)|_BV(RTC_DATA)|_BV(RTC_CS);//将时钟端(RTC_CLK)数据端(RTC_DATA)片选端(RTC_CS)设置为输出
 1e0:	84 b3       	in	r24, 0x14	; 20
 1e2:	87 60       	ori	r24, 0x07	; 7
 1e4:	84 bb       	out	0x14, r24	; 20
}
 1e6:	08 95       	ret

000001e8 <DS1302_writeB>:
功    能: 向DS1302写入一个字节数据(没有RST操作)
参    数: byte--要写入的数据
返回值  : 无
********************************************/
void DS1302_writeB(uchar byte)
{
 1e8:	20 e0       	ldi	r18, 0x00	; 0
    can be achieved.
*/
void
_delay_loop_1(uint8_t __count)
{
	__asm__ volatile (
 1ea:	3a e1       	ldi	r19, 0x1A	; 26
 uchar i;
 for(i=0;i<8;i++)		 	  //8位数据计数
 {
  CTRL_PORT&=~_BV(RTC_CLK);		  //拉低时钟端
 1ec:	a9 98       	cbi	0x15, 1	; 21
  if(byte&0x01)				  //当前位是否是1
 1ee:	80 ff       	sbrs	r24, 0
 1f0:	02 c0       	rjmp	.+4      	; 0x1f6 <DS1302_writeB+0xe>
  {
   CTRL_PORT|=_BV(RTC_DATA);	  //当前位是1,拉高数据端
 1f2:	aa 9a       	sbi	0x15, 2	; 21
 1f4:	01 c0       	rjmp	.+2      	; 0x1f8 <DS1302_writeB+0x10>
  }
  else						  
  {
   CTRL_PORT&=~_BV(RTC_DATA);	  //当前位是0,拉低数据端
 1f6:	aa 98       	cbi	0x15, 2	; 21
 1f8:	93 2f       	mov	r25, r19
 1fa:	9a 95       	dec	r25
 1fc:	f1 f7       	brne	.-4      	; 0x1fa <DS1302_writeB+0x12>
  }  
 // Delayus(10);				  //调整时钟和脉冲宽度
 _delay_us(10);
 CTRL_PORT&=~_BV(RTC_CLK);
 1fe:	a9 98       	cbi	0x15, 1	; 21
 200:	93 2f       	mov	r25, r19
 202:	9a 95       	dec	r25
 204:	f1 f7       	brne	.-4      	; 0x202 <DS1302_writeB+0x1a>
  _delay_us(10);
  CTRL_PORT|=_BV(RTC_CLK);		  //时钟上升沿(DS1302采样数据)
 206:	a9 9a       	sbi	0x15, 1	; 21
返回值  : 无
********************************************/
void DS1302_writeB(uchar byte)
{
 uchar i;
 for(i=0;i<8;i++)		 	  //8位数据计数
 208:	2f 5f       	subi	r18, 0xFF	; 255
 20a:	28 30       	cpi	r18, 0x08	; 8
 20c:	11 f0       	breq	.+4      	; 0x212 <DS1302_writeB+0x2a>
 // Delayus(10);				  //调整时钟和脉冲宽度
 _delay_us(10);
 CTRL_PORT&=~_BV(RTC_CLK);
  _delay_us(10);
  CTRL_PORT|=_BV(RTC_CLK);		  //时钟上升沿(DS1302采样数据)
  byte>>=1;					  //数据右移1位,为送出新数据位做准备
 20e:	86 95       	lsr	r24
 210:	ed cf       	rjmp	.-38     	; 0x1ec <DS1302_writeB+0x4>
 212:	08 95       	ret

00000214 <DS1302_readB>:
返回值  : byte--读出的数据
********************************************/
uchar DS1302_readB(void)
{
 uchar i,byte=0;
 CTRL_DDR&=~_BV(RTC_DATA);		 //将数据端口设置为输入		  
 214:	a2 98       	cbi	0x14, 2	; 20
 CTRL_PORT&=~_BV(RTC_DATA);		 //无上拉电阻
 216:	aa 98       	cbi	0x15, 2	; 21
 218:	20 e0       	ldi	r18, 0x00	; 0
 21a:	80 e0       	ldi	r24, 0x00	; 0
 21c:	3a e1       	ldi	r19, 0x1A	; 26
 for(i=0;i<8;i++)			 //8位数据计数
 {
  byte>>=1;  				 //保存读入的数据位
 21e:	86 95       	lsr	r24
  CTRL_PORT|=_BV(RTC_CLK);		 //时钟上升沿
 220:	a9 9a       	sbi	0x15, 1	; 21
 222:	93 2f       	mov	r25, r19
 224:	9a 95       	dec	r25
 226:	f1 f7       	brne	.-4      	; 0x224 <DS1302_readB+0x10>
  //Delayus(10);				 //延时,调整时钟脉冲宽度
_delay_us(10);
  CTRL_PORT&=~_BV(RTC_CLK);		 //时钟下降沿,DS1302输出数据位
 228:	a9 98       	cbi	0x15, 1	; 21
 22a:	93 2f       	mov	r25, r19
 22c:	9a 95       	dec	r25
 22e:	f1 f7       	brne	.-4      	; 0x22c <DS1302_readB+0x18>
 // Delayus(10);				 //等待数据变化(MEGA16太快,必须等待DS1302的数据位输出,否则不能正确读出)
_delay_us(10);
  if(CTRL_PIN&_BV(RTC_DATA))	 //当前位是否是高电平
 230:	9a 99       	sbic	0x13, 2	; 19
  {
   byte|=0x80;//_BV(PC1);		 //是高电平就将返回数据的当前位置1
 232:	80 68       	ori	r24, 0x80	; 128
uchar DS1302_readB(void)
{
 uchar i,byte=0;
 CTRL_DDR&=~_BV(RTC_DATA);		 //将数据端口设置为输入		  
 CTRL_PORT&=~_BV(RTC_DATA);		 //无上拉电阻
 for(i=0;i<8;i++)			 //8位数据计数
 234:	2f 5f       	subi	r18, 0xFF	; 255
 236:	28 30       	cpi	r18, 0x08	; 8
 238:	91 f7       	brne	.-28     	; 0x21e <DS1302_readB+0xa>
  else
  {
   byte&=0x7f;//~_BV(PC1);			 //是低电平就将返回数据的当前位置0
  }
 }
 CTRL_DDR|=_BV(RTC_DATA);	 //最后将数据端口设置为输出
 23a:	a2 9a       	sbi	0x14, 2	; 20
 return byte;				 //返回读出的数据
}
 23c:	08 95       	ret

0000023e <DS1302_writeD>:
参    数: addr--地址值(寄存器或RAM)
	  	  data--要写入的地址
返回值  : 无
********************************************/
void DS1302_writeD(uchar addr,uchar data)
{
 23e:	0f 93       	push	r16
 240:	1f 93       	push	r17
 242:	06 2f       	mov	r16, r22
 CTRL_PORT&=~_BV(RTC_CS);	 //拉低片选端
 244:	a8 98       	cbi	0x15, 0	; 21
 CTRL_PORT&=~_BV(RTC_CLK);	 //拉低时钟端
 246:	a9 98       	cbi	0x15, 1	; 21
 248:	1a e1       	ldi	r17, 0x1A	; 26
 24a:	91 2f       	mov	r25, r17
 24c:	9a 95       	dec	r25
 24e:	f1 f7       	brne	.-4      	; 0x24c <DS1302_writeD+0xe>
 //Delayus(10);
 _delay_us(10);
 CTRL_PORT|=_BV(RTC_CS);	 //拉高片选端
 250:	a8 9a       	sbi	0x15, 0	; 21
 252:	91 2f       	mov	r25, r17
 254:	9a 95       	dec	r25
 256:	f1 f7       	brne	.-4      	; 0x254 <DS1302_writeD+0x16>
// Delayus(10); 			 //调整片选脉冲
_delay_us(10);
 DS1302_writeB(addr);	 //写入操作命令(地址)
 258:	0e 94 f4 00 	call	0x1e8	; 0x1e8 <DS1302_writeB>
 25c:	81 2f       	mov	r24, r17
 25e:	8a 95       	dec	r24
 260:	f1 f7       	brne	.-4      	; 0x25e <DS1302_writeD+0x20>
 //Delayus(10);
 _delay_us(10);
 CTRL_PORT&=~_BV(RTC_CLK);	 //拉低时钟端
 262:	a9 98       	cbi	0x15, 1	; 21
 264:	81 2f       	mov	r24, r17
 266:	8a 95       	dec	r24
 268:	f1 f7       	brne	.-4      	; 0x266 <DS1302_writeD+0x28>
// Delayus(10);
 _delay_us(10);
 DS1302_writeB(data);	 //写入数据
 26a:	80 2f       	mov	r24, r16
 26c:	0e 94 f4 00 	call	0x1e8	; 0x1e8 <DS1302_writeB>
 CTRL_PORT&=~_BV(RTC_CLK);	 //拉低时钟端
 270:	a9 98       	cbi	0x15, 1	; 21
 272:	1a 95       	dec	r17
 274:	f1 f7       	brne	.-4      	; 0x272 <DS1302_writeD+0x34>
// Delayus(10);			 //调整片选脉冲
 _delay_us(10);
 CTRL_PORT&=~_BV(RTC_CS);	 //拉低片选端
 276:	a8 98       	cbi	0x15, 0	; 21
}

⌨️ 快捷键说明

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