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

📄 dispfinal.c

📁 视频字符叠加系统、采用89系列单片机开发
💻 C
📖 第 1 页 / 共 3 页
字号:
		while(osd_busy);
		left_shift(char_attribute);
		for(i=0;i<8;i++)
			{
			while(osd_busy);
			left_shift(address_buf[i]);
		   	}
		osd1_cs=1;
		osd2_cs=1;
		if(receive_buf[1]>=12) 	real_clock.date_lines=receive_buf[1]-12;
		else					real_clock.date_lines=receive_buf[1];
		real_clock.date_words=receive_buf[2];
		if(receive_buf[3]>=12) 	real_clock.time_lines=receive_buf[3]-12;
		else					real_clock.time_lines=receive_buf[3];
		real_clock.time_words=receive_buf[4];
		}
//--------------------------------------------------------------------
void close_time(void)
		{
		unsigned char i,t;
		for(t=0;t<10;t++)
		address_buf[t]=0xef;
		t=receive_buf[0]&0x03;
		if(t==1)
			{
			if(close1) 
				{
				close1=0;
				oneday=1;
				}
			else
				{
				close1=1;
				osd1_cs=0;
				while(osd_busy);
					left_shift(((real_clock.date_lines>>3)&0x01)|char_position);
				while(osd_busy);
					left_shift((real_clock.date_lines<<5)|real_clock.date_words);
				while(osd_busy);
					left_shift(char_attribute);
				for(i=0;i<10;i++)
					{
					while(osd_busy);
						left_shift(address_buf[i]);
				   	}
				osd1_cs=1;
				osd1_cs=0;
				while(osd_busy);
					left_shift(((real_clock.time_lines>>3)&0x01)|char_position);
				while(osd_busy);
					left_shift((real_clock.time_lines<<5)|real_clock.time_words);
				while(osd_busy);
					left_shift(char_attribute);
				for(i=0;i<8;i++)
					{
					while(osd_busy);
						left_shift(address_buf[i]);
				   	}
				osd1_cs=1;
		  		}
			}
		if(t==2)
			{
			if(close2)
		 		{
				close2=0;
				oneday=1;
				}
			else
				{
				close2=1;
				osd2_cs=0;
				while(osd_busy);
					left_shift(((real_clock.date_lines>>3)&0x01)|char_position);
				while(osd_busy);
					left_shift((real_clock.date_lines<<5)|real_clock.date_words);
				while(osd_busy);
					left_shift(char_attribute);
				for(i=0;i<10;i++)
					{
					while(osd_busy);
						left_shift(address_buf[i]);
				   	}
				osd2_cs=1;
				osd2_cs=0;
				while(osd_busy);
					left_shift(((real_clock.time_lines>>3)&0x01)|char_position);
				while(osd_busy);
					left_shift((real_clock.time_lines<<5)|real_clock.time_words);
				while(osd_busy);
					left_shift(char_attribute);
				for(i=0;i<8;i++)
					{
					while(osd_busy);
						left_shift(address_buf[i]);
				   	}
				osd2_cs=1;
		  		}
		  	}
		if(t==0x00)
			{
			if(close1) 
				{
				close1=0;
				oneday=1;
				}
			else
				{
				close1=1;
				osd1_cs=0;
				while(osd_busy);
					left_shift(((real_clock.date_lines>>3)&0x01)|char_position);
				while(osd_busy);
					left_shift((real_clock.date_lines<<5)|real_clock.date_words);
				while(osd_busy);
					left_shift(char_attribute);
				for(i=0;i<10;i++)
					{
					while(osd_busy);
						left_shift(address_buf[i]);
				   	}
				osd1_cs=1;
				osd1_cs=0;
				while(osd_busy);
					left_shift(((real_clock.time_lines>>3)&0x01)|char_position);
				while(osd_busy);
					left_shift((real_clock.time_lines<<5)|real_clock.time_words);
				while(osd_busy);
					left_shift(char_attribute);
				for(i=0;i<8;i++)
					{
					while(osd_busy);
						left_shift(address_buf[i]);
				   	}
				osd1_cs=1;
		  		}
			if(close2) 
				{
				close2=0;
				oneday=1;
				}
			else
				{
				close2=1;
				osd2_cs=0;
				while(osd_busy);
					left_shift(((real_clock.date_lines>>3)&0x01)|char_position);
				while(osd_busy);
					left_shift((real_clock.date_lines<<5)|real_clock.date_words);
				while(osd_busy);
					left_shift(char_attribute);
				for(i=0;i<10;i++)
					{
					while(osd_busy);
						left_shift(address_buf[i]);
				   	}
				osd2_cs=1;
				osd2_cs=0;
				while(osd_busy);
					left_shift(((real_clock.time_lines>>3)&0x01)|char_position);
				while(osd_busy);
					left_shift((real_clock.time_lines<<5)|real_clock.time_words);
				while(osd_busy);
					left_shift(char_attribute);
				for(i=0;i<8;i++)
					{
					while(osd_busy);
						left_shift(address_buf[i]);
				   	}
				osd2_cs=1;
		  		}
			}
	  	}
//--------------------------------------------------------------------
void close_date(void)
		{
		unsigned char i,t;
		for(t=0;t<10;t++)
		address_buf[t]=0xef;
		t=receive_buf[0]&0x03;
		if(t==1)
			{
			if(closedate1) 
				{
				closedate1=0;
				oneday=1;
				}
			else
				{
				closedate1=1;
				osd1_cs=0;
				while(osd_busy);
					left_shift(((real_clock.date_lines>>3)&0x01)|char_position);
				while(osd_busy);
					left_shift((real_clock.date_lines<<5)|real_clock.date_words);
				while(osd_busy);
					left_shift(char_attribute);
				for(i=0;i<10;i++)
					{
					while(osd_busy);
					left_shift(address_buf[i]);
				   	}
				osd1_cs=1;
		  		}
			}
		if(t==2)
			{
			if(closedate2) 
				{
				closedate2=0;
				oneday=1;
				}
			else
				{
				closedate2=1;
				osd2_cs=0;
				while(osd_busy);
					left_shift(((real_clock.date_lines>>3)&0x01)|char_position);
				while(osd_busy);
					left_shift((real_clock.date_lines<<5)|real_clock.date_words);
				while(osd_busy);
					left_shift(char_attribute);
				for(i=0;i<10;i++)
					{
					while(osd_busy);
						left_shift(address_buf[i]);
				   	}
				osd2_cs=1;
		  		}
			}
		if(t==0x00)
			{
			if(closedate1) 
				{
				closedate1=0;
				oneday=1;
				}
			else
				{
				closedate1=1;
				osd1_cs=0;
				while(osd_busy);
					left_shift(((real_clock.date_lines>>3)&0x01)|char_position);
				while(osd_busy);
					left_shift((real_clock.date_lines<<5)|real_clock.date_words);
				while(osd_busy);
					left_shift(char_attribute);
				for(i=0;i<10;i++)
					{
					while(osd_busy);
					left_shift(address_buf[i]);
				   	}
				osd1_cs=1;
				}
			if(closedate2) 
				{
				closedate2=0;
				oneday=1;
				}
			else
				{
				closedate2=1;
				osd2_cs=0;
				while(osd_busy);
					left_shift(((real_clock.date_lines>>3)&0x01)|char_position);
				while(osd_busy);
					left_shift((real_clock.date_lines<<5)|real_clock.date_words);
				while(osd_busy);
					left_shift(char_attribute);
				for(i=0;i<10;i++)
					{
					while(osd_busy);
						left_shift(address_buf[i]);
				   	}
				osd2_cs=1;
		  		}
			}
	  	}

//---------------------------------------------------------------------
void background_set(void)
		{
		unsigned char i;
		i=receive_buf[0]&0x03;
		if(i==0) 
 	    	{
			osd1_cs=0;
			if(black1) 	left_shift(no_background);
			else      	left_shift(background_fring);
			while(osd_busy);
			osd1_cs=1;
			black1=!black1;
			osd2_cs=0;
			if(black2) 	left_shift(no_background);
			else      	left_shift(background_fring);
			while(osd_busy);
			osd2_cs=1;
			black2=!black2;
			}
	  	else
			{
			if(i==1)
				{
				osd1_cs=0;
				if(black1) 	left_shift(no_background);
				else      	left_shift(background_fring);
				while(osd_busy);
				osd1_cs=1;
				black1=!black1;
				}	
			else	  
				{
				osd2_cs=0;
				if(black2) 	left_shift(no_background);
				else      	left_shift(background_fring);
				while(osd_busy);
				osd2_cs=1;
				black2=!black2;
				}
		  	}
	 	}

//----------------------------------------------------------------------------
//timer0 count 25ms,be used to speech output              
void timer0(void) interrupt 1 
		{
			TL0=0x00;
			TH0=0xb2;
			if(++real_clock.microseconds>=100)
				{
				real_clock.microseconds=0;
				second=1;
				if(++real_clock.seconds>=60)
					{
					real_clock.seconds=0;
					if(++real_clock.minutes>=60)
						{
						real_clock.minutes=0;
						if(++real_clock.hours>=24)
							{
							real_clock.hours=0;
							oneday=1;
							if(leap)
								{
								if(++real_clock.dates>month2_dates[real_clock.months])
									{
									real_clock.dates=1;
									if(++real_clock.months>12)
										{
										real_clock.months=1;
										++real_clock.years;
 									    leap=0;
										}
								  	}
								}
							else	   		 
								{
								if(++real_clock.dates>month1_dates[real_clock.months])
									{
									real_clock.dates=1;
									if(++real_clock.months>12)
										{
										real_clock.months=1;
										if(++real_clock.years%4==0&&real_clock.years%100!=0||real_clock.years%400==0)
										leap=1;										  
								 	  	}
							  	 	}
						   		}
						  	}
					 	}
				  	}
			   	}
									
		}
 
//-----------------------------------------------------------------------
void receive_send() interrupt 4
		{
		ES=0;
		if(RI)
			{
			RI=0;
			if(command)
				{
				if(receive_count==REC_LENGTH)
					{
					if(SBUF==receive_bcc) 
						{
				   	receive_flag=1;
						command=0;
						addr_mark=0;
						for(receive_count=0;receive_count<29;receive_count++)
							{
								receive_buf2[receive_count]=receive_buf1[receive_count];
							}
						}
					else 
						{
						receive_flag=0;
						command=0;
						addr_mark=0;
						}
					}
				else
					{
					receive_buf1[receive_count++]=SBUF;
					receive_bcc=receive_bcc^SBUF;
					}
				}
			else
				{
				if(addr_mark)
					{
					addr_mark=0;
					if(SBUF==LOCAL_PORT) 
						{
						command=1;							
						receive_bcc=0;
						receive_count=0;
						}
					else 
						{
						command=0;
						}	
					}	
				else 
					{
					if(SBUF==0xff) 	addr_mark=1;																
					else			addr_mark=0;
					}
				}
			}
		else if(TI)
			{
			TI=0;
			if(receive_count>=4);
			else
				{
				if(receive_count++==3) 
				SBUF=receive_bcc;
				else
				SBUF=receive_buf[receive_count];
				}
			}
		ES=1;
		}
		 
//----------------------------------------------------------------------------
void extern_interrupt1() interrupt 2
		{
		// 	second=!second;
 		;
	   	}

//-----------------------------------------------------------------------------




  

⌨️ 快捷键说明

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