Ejemplo n.º 1
0
/**************************************************************
 *  Name                 :	UART0_GetString
 *  Description          :	Receive a string through UART0 and
 *  						store it in array rub_UART_String. 
 *  						Print the string read character by
 *  						character (echo).
 *  						
 *  Parameters           :  None
 *  						
 *  Return               :	
 *                          T_UBYTE *rub_UART_String : Locality of array where the string was stored
 *                          
 *  Critical/explanation :  No
 **************************************************************/
PUBLIC_FCT PTR_UBYTE UART0_GetString(void)
{
	T_UBYTE lub_Data = 0;						//Temporarily variable to every character
	T_BOOLEAN lbi_StringComplete = FALSE;		//Flag to indicate finished reading
	T_UBYTE lub_index = 0;

	while(!lbi_StringComplete)
	{
		lub_Data = UART0_GetChar();					//Read character
		if((lub_Data != '\r') && (lub_Data != 0))
		{
			rub_UART_String[lub_index] = lub_Data;	//Store read character
			lub_index++;							//Point to next location
			UART0_SendChar(lub_Data);				//Echo data
		}	
		else
		{
			rub_UART_String[lub_index] = 0;			//Finish the string
			UART0_SendChar(CR);						//Print escape sequence
			UART0_SendChar(LF);						//Print escape sequence
			lbi_StringComplete = TRUE;				//Finish the reading
		}
	}
    return (PTR_UBYTE)rub_UART_String;				//Return the pointer where string is stored
}
Ejemplo n.º 2
0
/**************************************************************
 *  Name                 :	UART0_Write
 *  Description          :	Send a string through UART0  
 *  Parameters           :  
 *  						T_SBYTE *lpub_ptr: The string to be sent
 *  						
 *  Return               :	None
 *  Critical/explanation :  No
 **************************************************************/
PUBLIC_FCT void UART0_Write(PTR_UBYTE lpub_ptr)
{
	while(*lpub_ptr)				//While string isn't end		
	{
		UART0_SendChar(*lpub_ptr);	//Send every character of the string	
		lpub_ptr++;					//Point to next character
	}
}
Ejemplo n.º 3
0
void UartDebug(unsigned char myDataChar){							// Réception sur le port UART1
	unsigned char i;
/*
	// print out debug message
	i=0;
	while(DbgMessage[i] != '\0')	{
	        UARTCharPut(UART1_BASE, DbgMessage[i++]);
	}
*/
	UART0_SendChar(myDataChar);
}
Ejemplo n.º 4
0
void ProcessUartTxData(){							// Réception sur le port UART1
	unsigned char i;
	// ENVOYE NOUVELLE TRAME
	buffSndDCFbusy=1;								// Verouille le buffer de emission

	buffSndDcfData[0]=SOF;
	buffSndDcfData[1]=DataLength;


	i=0;
	for(i=0;i<DataLength+2;i++)	{
			UART0_SendChar(buffSndDcfData[i]);
			if(TXbyteDelay) WAIT1_Waitms(2);
	}

	buffSndDCFbusy=0;								// Libère le buffer de emission
}