4426.ada1298_msp430f1611.rarTo whom it may concern,
I am trying to program ads1298 with MSP430F1611, but there are some problems as follows.
1. I must repeat the RREG command to get the correct value of the register.
for example, I WREG the registers first, and then PREG the registers, the code as follow.
while (!(IFG1 & UTXIFG0));
TXBUF0 = 0x41;
while (!(IFG1 & UTXIFG0));
TXBUF0 = 0x04;
while (!(IFG1 & UTXIFG0)); // WREG CONFIG1 0xA6
TXBUF0 = 0xA6;
while (!(IFG1 & UTXIFG0)); // WREG CONFIG2 0x10
TXBUF0 = 0x10;
while (!(IFG1 & UTXIFG0)); // WREG CONFIG3 0xC0
TXBUF0 = 0xC0;
while (!(IFG1 & UTXIFG0)); // WREG 0x04 0x05
TXBUF0 = 0x05;
while (!(IFG1 & UTXIFG0)); // WREG 0x05 0x06
TXBUF0 = 0x06;
while (!(IFG1 & UTXIFG0));
TXBUF0 = (0x45);
while (!(IFG1 & UTXIFG0));
TXBUF0 = 0x07;
for (i = 0; i < 8; i++) // WREG CHnSET 0x05
{
while (!(IFG1 & UTXIFG0));
TXBUF0 = 0x05;
}
for (i = 0; i < 2; i++)
{
while (!(IFG1 & UTXIFG0)); // RREG CONFIG3
TXBUF0 = 0x21;
while (!(IFG1 & UTXIFG0));
TXBUF0 = 0x01;
}
while (!(IFG1 & URXIFG0));
RES[0] = RXBUF0;
while (!(IFG1 & URXIFG0));
RES[1] = RXBUF0;
for (i = 0; i < 2; i++)
{
while (!(IFG1 & UTXIFG0)); // RREG CONFIG3
TXBUF0 = 0x23;
while (!(IFG1 & UTXIFG0));
TXBUF0 = 0x01;
}
while (!(IFG1 & URXIFG0));
RES[2] = RXBUF0;
while (!(IFG1 & URXIFG0));
RES[3] = RXBUF0;
It seems something strange when I PREG the registers.
2. I could not get the values of the eight channels when I set START pin to 1 and use the RDATAC command.
My whole code is attached