uart/USART/main.cpp

54 lines
1.6 KiB
C++
Raw Normal View History

2016-05-19 21:43:10 +02:00
/*
* Copyright (c) by BlackMark 2015-2016
* Date 05/01/2016
* Version 1.4
*/
#include <stdio.h>
#include "Clock.h"
#include "USART.h"
int main()
{
USART0 cUSART;
uint32_t ui32Counter = 0;
cUSART << "\r\nSizes: \r\n";
cUSART << "sizeof( char ) = " << sizeof( char ) << "\r\n";
cUSART << "sizeof( unsigned char ) = " << sizeof( unsigned char ) << "\r\n";
cUSART << "sizeof( short int ) = " << sizeof( short int ) << "\r\n";
cUSART << "sizeof( unsigned short int ) = " << sizeof( unsigned short int ) << "\r\n";
cUSART << "sizeof( int ) = " << sizeof( int ) << "\r\n";
cUSART << "sizeof( unsigned int ) = " << sizeof( unsigned int ) << "\r\n";
cUSART << "sizeof( long int ) = " << sizeof( long int ) << "\r\n";
cUSART << "sizeof( unsigned long int ) = " << sizeof( unsigned long int ) << "\r\n";
cUSART << "sizeof( long long int ) = " << sizeof( long long int ) << "\r\n";
cUSART << "sizeof( unsigned long long int ) = " << sizeof( unsigned long long int ) << "\r\n";
cUSART << "sizeof( float ) = " << sizeof( float ) << "\r\n";
cUSART << "sizeof( double ) = " << sizeof( double ) << "\r\n";
cUSART << "sizeof( long double ) = " << sizeof( long double ) << "\r\n\r\n";
while( true )
{
cUSART << "This has been running for \"" << ui32Counter++ << "\" seconds!\r\n\r\n";
cUSART << "Please enter a number: ";
int iNumber;
cUSART >> iNumber;
cUSART << "\r\nYou entered: " << iNumber << "\r\n\r\n";
cUSART << "Please enter a decimal number: ";
double dNumber;
cUSART >> dNumber;
cUSART << "\r\nYou entered: " << dNumber << "\r\n\r\n";
_delay_ms( 1000 );
}
return 0;
}