我在使用msp430与eeprom进行通信,430为master,使用1Mhz内部DCO主频,然后,因为后期需要将主频提高到12Mhz,所以做了一些修改,发现,修改后i2c写入e2rom成功,读取失败。请教一下,谢谢~
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我在使用msp430与eeprom进行通信,430为master,使用1Mhz内部DCO主频,然后,因为后期需要将主频提高到12Mhz,所以做了一些修改,发现,修改后i2c写入e2rom成功,读取失败。请教一下,谢谢~
读程序
uint8 eeprom_read(uint8 addr1st,uint8 addr2st,uint8 *pword_val)
{
UCB0CTL1 |= UCTR;//write
UCB0CTL1 |= UCTXSTT;
UCB0TXBUF=addr1st;
while(!(IFG2 & UCB0TXIFG))
{
if(UCB0STAT & UCACKIFG)
return 1;
}
UCB0TXBUF=addr1st;
while(!(IFG2 & UCB0TXIFG))
{
if(UCB0STAT & UCACKIFG)
return 1;
}
UCB0CTL1 &= ~UCTR;//READ
UCB0CTL1 |= UCTXSTT;
while(UCB0CTL1 & UCTXSTT);
UCB0CTL1 |= UCTXSTP;
while(UCB0CTL1 & UCRXIFG);
*pword_val=UCB0RXBUF;
while(UCB0CTL1 & UCTXSTP);
return 0;
}