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"
|
2016-05-20 15:32:42 +02:00
|
|
|
#include "usart.h"
|
2016-05-19 21:43:10 +02:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
USART0 cUSART;
|
2016-05-19 22:59:22 +02:00
|
|
|
cUSART.init();
|
|
|
|
|
2016-05-19 21:43:10 +02:00
|
|
|
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";
|
2016-05-19 22:13:06 +02:00
|
|
|
cUSART << "sizeof( void* ) = " << sizeof( void* ) << "\r\n";
|
|
|
|
cUSART << "sizeof( unsigned char* ) = " << sizeof( unsigned char* ) << "\r\n";
|
|
|
|
cUSART << "sizeof( unsigned int* ) = " << sizeof( unsigned int* ) << "\r\n\r\n";
|
2016-05-19 21:43:10 +02:00
|
|
|
|
|
|
|
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";
|
2016-05-19 22:59:22 +02:00
|
|
|
|
|
|
|
unsigned char uchByte;
|
|
|
|
cUSART.receiveByte( uchByte, 1000 );
|
2016-05-19 21:43:10 +02:00
|
|
|
|
|
|
|
_delay_ms( 1000 );
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|