Subversion Repositories Projects

Rev

Rev 346 | Rev 389 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 346 Rev 387
Line 51... Line 51...
51
 
51
 
52
/**
52
/**
53
 * disable the txd pin of usart1
53
 * disable the txd pin of usart1
54
 */
54
 */
55
void usart1_DisableTXD(void) {
55
void usart1_DisableTXD(void) {
56
        UCSR1B &= ~(1 << TXCIE1); // disable TX-Interrupt
56
        //UCSR1B &= ~(1 << TXCIE1); // disable TX-Interrupt
57
        UCSR1B &= ~(1 << TXEN1); // disable TXD in USART
57
        UCSR1B &= ~(1 << TXEN1); // disable TX in USART
58
        DDRB &= ~(1<<DDB3); // set TXD pin as input
58
        DDRB &= ~(1<<DDB3); // set TXD pin as input
59
        PORTB &= ~(1 << PORTB3);
59
        PORTB &= ~(1 << PORTB3);
Line 60... Line 60...
60
}
60
}
Line 64... Line 64...
64
 */
64
 */
65
void usart1_EnableTXD(void) {
65
void usart1_EnableTXD(void) {
66
        DDRB |= (1<<DDB3); // set TXD pin as output
66
        DDRB |= (1<<DDB3); // set TXD pin as output
67
        PORTB &= ~(1 << PORTB3);
67
        PORTB &= ~(1 << PORTB3);
68
        UCSR1B |= (1 << TXEN1); // enable TX in USART
68
        UCSR1B |= (1 << TXEN1); // enable TX in USART
69
        UCSR1B |= (1 << TXCIE1); // disable TX-Interrupt
69
        //UCSR1B |= (1 << TXCIE1); // enable TX-Interrupt
70
}
70
}
Line 71... Line 71...
71
 
71
 
72
 
72
 
Line 88... Line 88...
88
        s++;
88
        s++;
89
    }
89
    }
90
}
90
}
Line 91... Line 91...
91
 
91
 
-
 
92
/**
-
 
93
 * transmit interrupt handler
-
 
94
 * unused
-
 
95
 */
-
 
96
SIGNAL(SIG_USART1_DATA) {
-
 
97
}
-
 
98
 
92
/**
99
/**
93
 * receive data through usart1
100
 * receive data through usart1
94
 * portions taken and adapted from
101
 * portions taken and adapted from
95
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Fbranches%2FV0.72p+Code+Redesign+killagreg%2Fuart0.c
102
 * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Fbranches%2FV0.72p+Code+Redesign+killagreg%2Fuart0.c
96
 */
103
 */
Line 237... Line 244...
237
            // re-enable TXD pin
244
            // re-enable TXD pin
238
            usart1_EnableTXD();
245
            usart1_EnableTXD();
Line 239... Line 246...
239
 
246
 
240
            unsigned char mstenth = ms/10;
247
            unsigned char mstenth = ms/10;
241
                        sendMKData(label, address, &mstenth, 1);
248
                        sendMKData(label, address, &mstenth, 1);
242
 
249
                                               
243
            // disable TXD pin again
250
            // disable TXD pin again
244
            usart1_DisableTXD();
251
            usart1_DisableTXD();