Ejemplo n.º 1
0
/*------------------------------------------------------------------
 ----------------TEST FUNCTION--------------------------------------
 -----------------------------------------------------------------*/
void test(void) {
	int len, i; 								// set up length variable and index for topstring
	char topstring[] = { "This is a test" }; 	// this is the string that will be written on the top row
	char bottomstring[] = { "This is line 2" };	// this is the string that will be written on the bottom row

	Init_Lcd(); 								// Run Init_Lcd function which sets up LCD with your preferences

	len = strlen(topstring); // measure the length of topstring using strlen() and store the into in len1 variable
	{ // lets write topstring to the LCD
		for (i = 0; i < len; i++) // the for loop steps through the string sending each letter
			Lcd_Send(topstring[i]); // the Lcd_Send function is run for the given letter of the topstring at index i
	}

	delay(50); // a quick delay in ms to allow LCD to display the value for a little bit before refreshing

	len = strlen(bottomstring); // measure length of the bottom string using strlen() from string.h

	Set_Cursor(0xC0); //set cursor to the beginning of the second line

	for (i = 0; i < len; i++) {
		Lcd_Send(bottomstring[i]); // Display the winner string on the LCD
	}
	delay(5000); // wait 5000ms so you can enjoy the feeling of victory

	Clear_LCD();
} // end test
Ejemplo n.º 2
0
void main()
{	
	ldc1000_int();
	Port_init();
	Init_Lcd();
	//Speed_IN1();
	//Time1_init();
	PT0=1;
	while(1)
	{
		Sdata=Rp_Sample();
		va=Sdata;
		DE(1);
		Sdata=Rp_Sample();
		va1=Sdata;
		va2=va1-va;
		LCD_value(0,0,va);
		if(va>1000){
			DE(200);
			SBUF=2;
		}else{
				DE(200);	DE(200);	DE(200);	DE(200);
			SBUF=0;
		}
		
		
	}
}
Ejemplo n.º 3
0
int main(void)
{

Init_Ports();
Init_Lcd();
usart_init();    
                           

while(1)
{ }

}
Ejemplo n.º 4
0
void lcdInit(void) {
	Init_Ports();	// configure the ports
	Init_Lcd();		// initialize the LCD
	delay(100);		// wait for the LCD to boot up
}
Ejemplo n.º 5
0
void main( void )
{
	unsigned int ucState=0xffff;
	unsigned char test[10];
	memset(test,'\0',10);
	int i=0;
	halBoardInit();
	hal430SetSystemClock();
	halButtonsInit();
	Init_Uart(115200);
	Init_Lcd();
	Msp430_ADC12_Init();
	Write_NByte((unsigned char *)eeprom,10,0);
	Read_NByte_Randomaddress(test,10,0);
	printf("main %s\r\n",test);
	 while(1)
	{
		if(flag==1)
		{
			//WDTCTL = WDTPW + WDTNMI + WDTTMSEL + WDTSSEL + WDTCNTCL;             // Start watchdog timer
			//IE1 |= WDTIE;                         // Enable WDT interrupt
			printf("we are in active state\r\n");
			//这里写自己的程序,把程序做在一个有限的循环里,这样做完之后就可以自动结束并关机。
			for(i=0;i<1000;i++){
			ucState = halButtonsPressed();
			
			if(ucState!=0xffff)
			{
			    i=0;
			    send_wave();
			    hal_buzzer(2);
			    Get_Power();
				//printf("%x is pressed\r\n",ucState);
				switch(ucState)
					{
					case BUTTON_MATL:
						printf("matl is pressed\r\n");
						break;
					case BUTTON_HARD:
						printf("hard is pressed\r\n");
						break;
					case BUTTON_DIREC:
						printf("direc is pressed\r\n");
						break;
					case BUTTON_TIMES:
						printf("times is pressed\r\n");
						break;						
					case BUTTON_SAVE:
						printf("save is pressed\r\n");
						break;
					case BUTTON_UP:
						printf("up is pressed\r\n");
						break;
					case BUTTON_DEL:
						printf("del is pressed\r\n");
						break;
					case BUTTON_AVE:
						printf("ave is pressed\r\n");
						break;
					case BUTTON_LEFT:
						printf("left is pressed\r\n");
						break;
					case BUTTON_MENU:
						printf("menu is pressed\r\n");
						break;
					case BUTTON_RIGHT:
						printf("right is pressed\r\n");
						break;
					case BUTTON_BACKLIGHT:
						printf("backlight is pressed\r\n");
						break;
					case BUTTON_ESC:
						printf("esc is pressed\r\n");
						break;
					case BUTTON_DOWN:
						printf("down is pressed\r\n");
						break;
					case BUTTON_ENTER:
						printf("enter is pressed\r\n");
						break;
					default:
						break;
					}
			}			
			//LPM3;
			Delay(100);
			}
			//如需定时,上边这个LPM3要被包括在那个有循环的循环体中,这样才能实现类似便携式仪表5分钟自动关机的效果。如果不使用定时也可以不要LPM3这句话。
			//WDTCTL = WDTPW + WDTHOLD + WDTNMI;             // Stop watchdog timer
			flag=0;
		}
		else
		{
			//如果周边设备在关机时有需要复位的或是关闭的在这里处理
			printf("we are in power off state\r\n");
		}
		hal_buzzer(0);
		printf("we going to LPM4\r\n");
		LPM4;
	}
}