Part Number:MSP430F2618
Hi, hope someone could help me.
I try to get my code from MSP430F169 to MSP430F2618.
The UART logic has changed for this microcontroller and I tried it with below code.
I have not found a TX-Enable in the 2618, like in the ME2 register of 169.
My problem is that no data come out of P3.4 (UCA0TXD)
I also tried with ACLK as source, but it didn't work.
Best, Manfred
#include <io430x26x.h>
#include "in430.h"
#define wdg() WDTCTL=WDTPW+WDTSSEL+WDTCNTCL; WDTCTL=WDTPW+WDTSSEL
int toTX;
void main ()
{
unsigned char sec_cnt;
BCSCTL1 |= DIVA_3; // ACLK = 8MHz / 8 = 2MHz
/* Stop Watchdog Timer. */
WDTCTL = WDTPW + WDTHOLD;
BCSCTL1 |= XTS; // High frequency mode
BCSCTL3 |= LFXT1S1; // Frequency from 3 to 16 MHz
do
{
IFG1 &= ~OFIFG; // Oszillator-Fehler-Bit löschen
for(sec_cnt=0xff; sec_cnt ;--sec_cnt);
} while( IFG1 & OFIFG ); // While solange der Oszillator nicht angeschwungen ist
BCSCTL2 |= (SELM0+SELM1+SELS); // 11: MCLK = LFXT1CLK, SMCLK=CLK
TBCTL = TASSEL_1 + MC_2; // SRC=ACLK, continous count 0-ffff
TBCCTL0 = CCIE; // Interrupt enable
TBCCR0 = 2000; // 2MHz / 2000 = 1ms
UCA0CTL1 = UCSWRST;
UCA0CTL0 = 0;
UCA0CTL1 |= UCSSEL1; // SSEL1 = SMCLK
// UCA0CTL1 |= UCRXEIE;
UCA0BR1 = 6;
UCA0BR0 = 0x82; // 1666
UCA0MCTL = 0x0c; // UCBRS=6, UCBRF=0, UCOS16=0
P3SEL |= 0x30;
UCA1CTL1 &= (~UCSWRST);
_EINT( );
while ( 1 )
{
wdg();
if(!toTX)
{
UCA0TXBUF = 0x55;
toTX = 500;
}
}
}
#pragma vector=TIMERB0_VECTOR
__interrupt void interrupt_TIMERB0_VECTOR(void)
{
TBCCR0 += 2000; // Add Offset to TACCR0 x 0.5us
if(toTX) --toTX;
}