Subversion Repositories Projects

Rev

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

Rev 387 Rev 389
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 TX 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); // disable pullup on TXD pin
Line 60... Line 60...
60
}
60
}
61
 
61
 
62
/**
62
/**
63
 * enable the txd pin of usart1
63
 * enable the txd pin of usart1
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); // disable pullup on TXD pin
68
        UCSR1B |= (1 << TXEN1); // enable TX in USART
68
        UCSR1B |= (1 << TXEN1); // enable TX in USART
Line 69... Line -...
69
        //UCSR1B |= (1 << TXCIE1); // enable TX-Interrupt
-
 
70
}
69
        UCSR1B |= (1 << TXCIE1); // enable TX-Interrupt
71
 
70
}
72
 
71
 
73
/**
72
/**
74
 * send a single <character> through usart1
73
 * send a single <character> through usart1
Line 91... Line 90...
91
 
90
 
92
/**
91
/**
93
 * transmit interrupt handler
92
 * transmit interrupt handler
94
 * unused
93
 * unused
95
 */
94
 */
96
SIGNAL(SIG_USART1_DATA) {
95
ISR(SIG_USART1_DATA) {
Line 97... Line 96...
97
}
96
}
98
 
97
 
99
/**
98
/**
Line 244... Line 243...
244
            // re-enable TXD pin
243
            // re-enable TXD pin
245
            usart1_EnableTXD();
244
            usart1_EnableTXD();
Line 246... Line 245...
246
 
245
 
247
            unsigned char mstenth = ms/10;
246
            unsigned char mstenth = ms/10;
248
                        sendMKData(label, address, &mstenth, 1);
-
 
-
 
247
                        sendMKData(label, address, &mstenth, 1);
-
 
248
                        // wait until UDR ready
249
                                               
249
                        while (!(UCSR1A & (1 << UDRE1)));                                              
250
            // disable TXD pin again
250
            // disable TXD pin again
251
            usart1_DisableTXD();
251
            usart1_DisableTXD();