Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <msp430.h>
- /**
- * main.c
- */
- int main(void)
- {
- WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
- P4SEL |= BIT4 + BIT5; //P4.4 P4.5 appartengono alla UART
- //configurazione interfaccia seriale
- UCA1CTL1 |= UCSWRST; //disabilita UART
- UCA1CTL1 |= UCSSEL_2; //seleziona SMLCK
- //imposta bound rate a 9600 bps
- UCA1BR0 = 109; //imposta il prescaler
- UCA1BR1 = 0;
- UCA1MCTL = UCBRS_2; //imposta il modulatore
- //nessuna configurazione di carattere
- //usiamo conf. di default (8 bit, N, 1 stop bit, LSB first)
- UCA1CTL1 &= ~UCSWRST; //abilita l'interfaccia
- while(1){
- while(!(UCA1IFG & UCTXIFG)); //aspetta finchè non è possibile trasmettere
- UCA1TXBUF = 65; //trasmetti 'A'
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement