#include #include "TS_LC7981.h" // FKA #include // für Zeichen (Infotext) notwendig #include // für sprint #include void UART1_senden_einstellen(void); void E32_konfigurieren(void); void konfiguration_senden(void); char i,txbuffer[6]; int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer // P5DIR |= BIT6+ BIT7; // für LED P5.6 grün + P5.7 P4DIR |= BIT0+ BIT1; // M0 + M1 E32-868T P4OUT |= BIT0+ BIT1; /* P1DIR =0xFF; // FKA text_init(); // in TS_7981.h programmversion();*/ UART1_senden_einstellen(); E32_konfigurieren(); konfiguration_senden(); for(;;); } void UART1_senden_einstellen(void) { P3SEL |= 0xC0; // P3.6 = USART1 TXD ; P3.7 = RXD1 ME2 |= UTXE1; // Enable USART1 TXD/RXD UCTL1 |= CHAR; // 8-bit character UTCTL1 |= SSEL0; // UCLK = ACLK UBR01 = 0x03; // 32k/9600 - 3.41 UBR11 = 0x00; // UMCTL1 = 0x4A; // Modulation UCTL1 &= ~SWRST; // Initialize USART state machine IE2 |= UTXIE1; // Enable USART1 RX interrupt //_BIS_SR(LPM3_bits + GIE); // Enter LPM3 w/ interrupt } void E32_konfigurieren(void) { txbuffer[0] = 0xC0; // sichert die Parameter nach Stromausfall txbuffer[1] = 0x55; // Adresse oberes Byte (Empfängeradresse) txbuffer[2] = 0x55; // Adresse unteres Byte (Empfängeradresse) txbuffer[3] = 0x1A; // 8N1, UART baut rate:9600 (bps), Übertragungsrate:2,4k (bps) txbuffer[4] = 0x07; // Kanal 7 txbuffer[5] = 0xC7; // OPTION "0xC7 = Fixed" Übetragungsmodus; TXD und AUX als Ausgang RXD als Eingang; } void konfiguration_senden(void) { i=0; while (i<6) { TXBUF1 = txbuffer[i]; while (!(IFG2 & UTXIFG1)); // USART1 TX buffer ready? i++; } } // UART0 TX ISR //#pragma vector=UART0TX_VECTOR #pragma vector=UART1TX_VECTOR __interrupt void usart1_tx (void) { }