Ejemplo n.º 1
0
int main(void) {
	double roots[N] = {3., 2., 1., -3.};
	double * coefficients = findCoefficients(roots, N);
	int i;
	for (i = 0; i < N + 1; i++) {
		printDecimal(coefficients[i]);
	}
	printf("\n");
	return 0;
}
Ejemplo n.º 2
0
time DebugInterface::printTime( time input, bool newline )
{
#if SentioEM_Emulator_Interface == OFF && SentioEM_Debug_Interface == ON

	printLine("\n\rTime in Sec:", false);
	printDecimal( input.getInSeconds(), newline );

	while( !( DEBUG_USART->STATUS & USART_STATUS_TXC ) );
#endif

	return input;
}
Ejemplo n.º 3
0
time DebugInterface::printTimeDet( time input, bool newline )
{
#if SentioEM_Emulator_Interface == OFF && SentioEM_Debug_Interface == ON

	printLine("\n\rSec:", false );
	printDecimal( input.getSecond(), false );
	printLine(" Min:", false );
	printDecimal( input.getMinute(), false );
	printLine(" Hr:", false );
	printDecimal( input.getHour(),false );

	if( newline )
	{
		USART_Tx( DEBUG_USART, '\n' );
		USART_Tx( DEBUG_USART, '\r' );
	}

	while( !( DEBUG_USART->STATUS & USART_STATUS_TXC ) );
#endif

	return input;
}
Ejemplo n.º 4
0
void main( void )
{
// Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;
  initDisplay();
  clearDisplay();
  printString("Hello Masters");

  while(1) 
  {
  {    
  // insert code here to periodically update the display and update global
  // variables that count seconds, minutes and hours.
  // Suggestion: update the display each time the number of seconds changes.
  // You will need to 'calibrate' the delay loop.
    for (k=0; k<60; k++)
{
	for (j=0;j<60;j++)
	{
		for (i=0;i<60;i++)
		{
			clearDisplay();
                        delay(65535);
			seconds = i;
			
		}
		minutes=j;
	}
	hours=k;
}

  
    
    delay(65535); //this controls rate of counter, 65535 is maximum value of 16bit counter
    counter++;
    printTime(hours, minutes, seconds);
    clearDisplay();
    printDecimal(counter);
  }
  }
}
Ejemplo n.º 5
0
void DebugInterface::printFloat( float input, uint8_t displayLength, bool newline )
{
#if SentioEM_Emulator_Interface == OFF && SentioEM_Debug_Interface == ON

	uint8_t length;

	if(input < 0)
	{
		USART_Tx( DEBUG_USART, '-' );
		input *= -1;
	}

	length = printDecimal( (uint32_t) input, false );

	if( length <= displayLength )
		USART_Tx( DEBUG_USART, '.' );

	while( length < displayLength )
	{

		input = input - (uint32_t)input;

		input *= 10;
		USART_Tx( DEBUG_USART, ( (uint8_t) input ) + ( ( (uint8_t) input > 0x09 ) ? '7' : '0' ) );

		length++;
	}

	if( newline )
	{
		USART_Tx( DEBUG_USART, '\n' );
		USART_Tx( DEBUG_USART, '\r' );
	}

	while( !( DEBUG_USART->STATUS & USART_STATUS_TXC ) );
#endif
}
Ejemplo n.º 6
0
void print(struct node *number, char base){
	struct node *curr = number;
	struct node *prev = NULL;
	if(iszero(number)) {
		printf("0");
		return;
	}
	switch(base){
	case 'b':
		printf("b");
		/* Mod each node, starting at the most significant bit, then keep going until you hit the least significant, and return*/
		while(curr != NULL){
			prev = curr;
			curr = curr->next;
		}
		/* prev is now at the last node */
		while (prev != NULL){
			printBinary(prev);
			prev = prev->prev;
		}
		break;
	case 'o':
		printf("o");
		/* Mod each node, starting at the most significant bit, then keep going until you hit the least significant, and return*/
		while(curr != NULL){
			prev = curr;
			curr = curr->next;
		}
		/* prev is now at the last node */
		while (prev != NULL){
			printOct(prev);
			prev = prev->prev;
		}
		break;
	case 'x':
		printf("x");
		/* Mod each node, starting at the most significant bit, then keep going until you hit the least significant, and return*/
		while(curr != NULL){
			prev = curr;
			curr = curr->next;
		}
		/* prev is now at the last node */
		while (prev != NULL){
			printHex(prev);
			prev = prev->prev;
		}
		break;
	case 'd':
		printf("d");
		/* Mod each node, starting at the most significant bit, then keep going until you hit the least significant, and return*/
		while(curr != NULL){
			prev = curr;
			curr = curr->next;
		}
		/* prev is now at the last node */
		while (prev != NULL){
			printDecimal(prev);
			prev = prev->prev;
		}
		break;
	default:
		printf("Bad Output Base");
	}
	return;
}