Last change
on this file since 16834 was 10588, checked in by neise, 14 years ago |
added MSR Firmware
MSR is the little brother of FSC
|
File size:
1.3 KB
|
Line | |
---|
1 | /************************************************************************/
|
---|
2 | /* */
|
---|
3 | /* UART test program */
|
---|
4 | /* */
|
---|
5 | /* Author: Peter Dannegger */
|
---|
6 | /* */
|
---|
7 | /************************************************************************/
|
---|
8 | #include "main.h"
|
---|
9 | #include "uart0.h"
|
---|
10 |
|
---|
11 |
|
---|
12 | void delay_1ms( u16 i )
|
---|
13 | {
|
---|
14 | do{
|
---|
15 | _delay_ms( 1 );
|
---|
16 | }while( --i );
|
---|
17 | }
|
---|
18 |
|
---|
19 |
|
---|
20 | int main( void )
|
---|
21 | {
|
---|
22 | init_uart0( (u16)(XTAL / BAUD / 16 - 0.5) );
|
---|
23 | sei();
|
---|
24 | delay_1ms( 300 );
|
---|
25 | uputs0("Hallo Peter\n\r");
|
---|
26 | uputs0("UART buffer test\n\r");
|
---|
27 |
|
---|
28 | for(;;){
|
---|
29 | if( !ukbhit0()){
|
---|
30 | continue;
|
---|
31 | }
|
---|
32 | delay_1ms( 10000 ); // wait 10s
|
---|
33 | // to see rx buffer overflow
|
---|
34 | do{
|
---|
35 | uputchar0( ugetchar0()); // send without waiting
|
---|
36 | if( !utx0_ready() ){
|
---|
37 | if( !ukbhit0()){
|
---|
38 | break;
|
---|
39 | }
|
---|
40 | uputchar0( '.' ); // to see tx buffer size
|
---|
41 | do{
|
---|
42 | uputchar0( ugetchar0()); // send with busy waiting
|
---|
43 | }while( ukbhit0());
|
---|
44 | }
|
---|
45 | }while( ukbhit0());
|
---|
46 | uputchar0( '\n' );
|
---|
47 | uputchar0( '\r' );
|
---|
48 | }
|
---|
49 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.