예제 #1
0
파일: main.c 프로젝트: shivency/15th
void main(void)
{
	uchar tab_temper[]={"temper: "};
    uchar tab_time[]={"now:   :  :"};
    DS18B20SendChangeCmd();
    LCD1602Config();
    LCD1602WriteCommand(yh);
    LCD1602WriteStr(tab_temper, 8);
    LCD1602WriteCommand(er+3);
    LCD1602WriteStr(tab_time, 11);
	DS1302Config();
	Timer1Config();
	
	while(1){

		LCD1602WriteCommand(0xc0);
        TempSisplay(DS18B20GetTmpValue(), yh+8);
        DS18B20SendChangeCmd();
		KeyScan();

// 		TimeReresh(14,miao);
// 		TimeReresh(11,fen);
// 		TimeReresh(8,shi);
	}
}
예제 #2
0
파일: LCD1602.C 프로젝트: shivency/15th
//!!a lot of undefination
void LCD1602Config(void)
{  
	char i = 0;
	LCD_RW = 0;

	LCD1602WriteCommand(0x38);//设置液晶工作模式
	LCD1602WriteCommand(0x0c);//开显示不显示光标
	LCD1602WriteCommand(0x06);//整屏不移动,指针加一
	LCD1602WriteCommand(0x01);

}
예제 #3
0
/*******************************************************************************
* 函 数 名 :main
* 函数功能 :主函数
* 输    入 :无
* 输    出 :无
*******************************************************************************/
void main()
{
	CarStop();	
	LED_OFF;
	UsartConfiguration();
	LCD1602Init();
	Timer0Init();
	
	//5ms 执行一次
	while(1)
	{ 
		if(tick_5ms >= 5)
		{
			tick_5ms = 0;
			tick_200ms++;
			if(tick_200ms >= 40)
			{
				tick_200ms = 0;
				if(switch_flag)
				{
					LED_ON;
					switch_flag = 0;
				}else
				{
					LED_OFF;
					switch_flag = 1;				
				}
			}
			
			continue_time--;//200ms 无接收指令就停车
			if(continue_time == 0)
			{
				continue_time = 1;
				CarStop();
			}
			//do something
			if(bt_rec_flag == 1)//接收到红外信号
			{
				bt_rec_flag = 0;
				switch(ctrl_comm)
				{
					case COMM_UP:    CarGo();break;
					case COMM_DOWN:  CarBack();break;
					case COMM_LEFT:  CarLeft();break;
					case COMM_RIGHT: CarRight();break;
					case COMM_STOP:  CarStop();break;
					default : break;
				}
				LCD1602WriteCommand(ctrl_comm);
				//printf("%c",ctrl_comm);
			}
		}
	}
}
예제 #4
0
int main(void)
{
	delay_init();
	GPIOCLKInit();
	UserLEDInit();
	LCD1602Init();
	//IRCtrolInit();
	TIM2_Init();
	MotorInit();
	ServoInit();
	
	RedRayInit();
	//USART3Conf(9600);

 while(1)
 {	 
	 		if(tick_5ms >= 5)
		{
			tick_5ms = 0;
			tick_200ms++;
			if(tick_200ms >= 40)
			{
				tick_200ms = 0;
				LEDToggle(LED_PIN);
			}
//			continue_time--;//200ms 无接收指令就停车
//			if(continue_time == 0)
//			{
//				continue_time = 1;
//				CarStop();
//			}
			//do something
			SearchRun();
			if(ctrl_comm_last != ctrl_comm)//指令发生变化
			{
				ctrl_comm_last = ctrl_comm;
				switch(ctrl_comm)
				{
					case COMM_UP:    CarGo();break;
					case COMM_DOWN:  CarBack();break;
					case COMM_LEFT:  CarLeft();break;
					case COMM_RIGHT: CarRight();break;
					case COMM_STOP:  CarStop();break;
					default : break;
				}
				Delayms(10);//防抖
				LCD1602WriteCommand(ctrl_comm);
			}
		}
		
 }
}
예제 #5
0
int main(void)
{
	delay_init();
	GPIOCLKInit();
	UserLEDInit();
	LCD1602Init();
	IRCtrolInit();
	TIM2_Init();
	MotorInit();
	ServoInit();

 while(1)
 {	 
	 		if(tick_5ms >= 5)
		{
			tick_5ms = 0;
			tick_200ms++;
			if(tick_200ms >= 40)
			{
				tick_200ms = 0;
				LEDToggle(LED_PIN);
			}
			
			continue_time--;//200ms 无接收指令就停车
			if(continue_time == 0)
			{
				continue_time = 1;
				CarStop();
			}
			//do something
			if(ir_rec_flag == 1)//接收到红外信号
			{
				ir_rec_flag = 0;
				switch(ctrl_comm)
				{
					case COMM_UP:    CarGo();break;
					case COMM_DOWN:  CarBack();break;
					case COMM_LEFT:  CarLeft();break;
					case COMM_RIGHT: CarRight();break;
					case COMM_STOP:  CarStop();break;
					default : break;
				}
				LCD1602WriteCommand(ctrl_comm);
			}
		}
		
 }
}