예제 #1
0
void stopP6 (void)
{
    P6DIR = 0;
    cntr=0;
    SEND_CMD(CLR_DISP);
    SEND_CMD(DD_RAM_ADDR);
    for (i=0 ; i!= 16; i++) SEND_CHAR(P6_error_Message[i]);    
    while(1);
}
예제 #2
0
void stop_ext (void)
{
    P2DIR &= ~BIT0;
    P4DIR = 0;
    cntr=0;
    SEND_CMD(CLR_DISP);
    SEND_CMD(DD_RAM_ADDR);
    for (i=0 ; i!= 16; i++) SEND_CHAR(EXT_error_Message[i]);    
    while(1);
}
예제 #3
0
//--------Send string to LCD-----------------------------
void SEND_STR(unsigned char* str) {

	unsigned int i=0;
	
	// set first row 
	SEND_CMD(DD_RAM_ADDR);

	// loop to the end of the string
	while(str[i]!='\0') {	
		
		SEND_CHAR(str[i]);  
		if (i == 15) 
			SEND_CMD(DD_RAM_ADDR2);
		i++;
	}

}
예제 #4
0
파일: display.c 프로젝트: ESS-Group/WSim
void putc(char c) {
    SEND_CHAR(c);
}
예제 #5
0
int main(void)
{

	InitOsc();  
	InitPorts();           
	InitUART0();
	InitLCD();

	TCPLowLevelInit();                            //after TCPLowLevelInit() UCLK = ACLK = MCLK/4 = 2 000 000 Hz   

	UART_transmit (CR);
	UART_transmit (LF);  
	for (i=0; i!=26; i++)  UART_transmit (UART_Message[i]); 
	UART_transmit (CR);
	UART_transmit (LF);  

	for (i=0; i!=32; i++)  
	{
		SEND_CHAR(LCD_Message[i]);
		if (i==15) SEND_CMD (DD_RAM_ADDR2);
	}  

	SEND_CMD(DD_RAM_ADDR);    
	RX_flag=0; 
	cntr = 0;   

	HTTPStatus = 0;                                // clear HTTP-server's flag register
	TCPLocalPort = TCP_PORT_HTTP;                  // set port we want to listen to

	while (1)                                      // repeat forever
	{

		//--------------buttons scan---------------------------------------------------------

		if ((B1) == 0)                                 //B1 is pressed
		{
			STATUS_LED_ON;                             //switch on status_led
			SEND_CMD(CLR_DISP);
			SEND_CMD(DD_RAM_ADDR);
			cntr=0;
		}
		else  STATUS_LED_OFF;                           //B1 is released 

		if ((B2) == 0)
		{      
			//        time_out = BUTTON_TIME;
			//        while (time_out != 0) 
			//        if ((B2) == 0) time_out--;
			//        else time_out = BUTTON_TIME;  

			Delayx100us(50);
			RELAY1_ON;                                        
		}
		else
		{      
			//        time_out = BUTTON_TIME;
			//        while (time_out != 0) 
			//        if ((B2) != 0) time_out--;
			//        else time_out = BUTTON_TIME;  

			Delayx100us(50);
			RELAY1_OFF;                                        
		}                   

		if ((B3) == 0)   
		{
			Delayx100us(50);
			RELAY2_ON;                     //B3 is pressed
		}
		else  
		{
			Delayx100us(50);
			RELAY2_OFF;                               //B3 is released
		}  

		while ((B4) == 0)                               //B4 is pressed
		{
			BUZ1_OFF;                                 
			BUZ2_ON;
			Delay(_100us);
			Delay(_100us);                            //buzzer with 5 000 Hz
			BUZ2_OFF;
			BUZ1_ON;
			Delay(_100us);          
		}    
		BUZ1_OFF;                                      //B4 is released
		BUZ2_OFF;      

		//--------UART0 receiv scan------------------------------------------------------------------     

		if (RX_flag == 1)                              //new receiv byte
		{                    
			STATUS_LED_ON;
			if (cntr == 0) 
			{
				SEND_CMD(CLR_DISP);
				SEND_CMD(DD_RAM_ADDR);                //set address for first row
			}
			SEND_CHAR(RXData);          
			if(cntr == 15) SEND_CMD(DD_RAM_ADDR2);    //set address for second row
			if(cntr++ == 31) cntr = 0;           
			RX_flag = 0;            
			STATUS_LED_OFF;
		}
		//---------Digital Inputs scan--------------------------------------------------------------

		if ((DI1) == 0)  for (i=0 ; i != 5; i++)UART_transmit(DI1_Message[i]);  
		if ((DI2) == 0)  for (i=0 ; i != 5; i++)UART_transmit(DI2_Message[i]);  
		if ((DI3) == 0)  for (i=0 ; i != 5; i++)UART_transmit(DI3_Message[i]);  
		if ((DI4) == 0)  for (i=0 ; i != 5; i++)UART_transmit(DI4_Message[i]);  

		//---------DALLAS scan ---------------------------------------------------------------------

		if ((DALLAS) == 0)                      
		{
			cntr=0;
			SEND_CMD(CLR_DISP);
			SEND_CMD(DD_RAM_ADDR);
			for (i=0 ; i!= 14; i++) SEND_CHAR(DALLAS_Message[i]);
		}   

		//---------FREQ scan ----------------------------------------------------------------------      

		if ((FREQ) != 0) 
		{
			cntr=0;
			SEND_CMD(CLR_DISP);
			SEND_CMD(DD_RAM_ADDR);
			for (i=0 ; i!= 16; i++) SEND_CHAR(FREQ_Message[i]);
		}   

		//***********************************************************************************    
		//this is the end of my programm
		//***********************************************************************************

		if (!(SocketStatus & SOCK_ACTIVE)) {
			TCPPassiveOpen();   // listen for incoming TCP-connection
		}
		DoNetworkStuff();                                      // handle network and easyWEB-stack
		// events
		HTTPServer();
	}                               
	return 0;
}