Actually I do have one more question though. I have to define a global if the two sections of code below are defined in two different header files correct? If I try to define a bool anywhere besides the header file Var and initialize it in the header file init, the second portion of code does not find the variable.
Code:
//DANS CORCULAR BUFFER MODIFICATION
// Called by printf()
/*
int putchar( u8 ch )
{
// Disable UART2 TX interrupt while manipulating buffer to avoid inconsistency
UART2_ITConfig( (UART2_IT_TXE | UART2_IT_TC), DISABLE );
if(flag_rs232_catch == 1) /*This impliments start of circular buffer, if data store becomes larger than array, store index
transmits and transmit index stores*/
{
uart2_tx[uart2_tx_size++] = ch;
flag_rs232_catch = 1;
uart2_tx_index = 0;
UART2_ITConfig( (UART2_IT_TXE | UART2_IT_TC), ENABLE );
UART2->DR = uart2_tx[uart2_tx_index]; //UART2_SendData8(uart2_tx[uart2_tx_index++]);
if(uart2_tx_size == 63) //If head reaches end of array, it loops to become tail
flag_rs232_catch = 0;
}
else if(flag_rs232_catch = 0)
{
uart2_tx[uart2_tx_index] = ch;
uart2_tx_index++;
UART2_ITConfig( (UART2_IT_TXE | UART2_IT_TC), ENABLE );
}
else
ch = 0; //***Jacob, is this the returning stop bit???***
return ch;
}
*/
//END OF DANS CIRCULAR BUFFER MODIFICATION FOR COMMAND, BELOW IS FORMER CODE BY JACOB QUANT
//***COMMENT FOR C BOARD*** CALLED BY 2ND HEADER FILE
#endif /* _COSMIC_ */
{
if( UART2_GetFlagStatus(UART2_FLAG_TXE) == SET )
{
if(flag_rs232_catch == 0)
{
UART2->DR = uart2_tx[uart2_tx_size]; //UART2_SendData8(uart2_tx[uart2_tx_index++]);
uart2_tx_size++;
}
else
{
UART2_ITConfig( UART2_IT_TXE, DISABLE );
uart2_tx_index = 0;
}
// TXE flag is cleared by hardware when new data is pushed into DR
}
// Transmission complete
As stated before, some of this code should not make sense yet so focus on memory