Hello ,
I am trying a simple master transmit code as below. I am not able to see the clock signals on the Logic Analyzer. Could someone please tell me what is wrong with the code?
#include "io430.h"
unsigned char TxData = 0x5A;
int main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
// P6.0 output, check power up of board and smlck on P5.5
P6DIR |= 0x01;
P6OUT |= 0x00;
P5DIR |= BIT5;
P5SEL |= BIT5;
//port setup, port3 sda-pin1 and scl-pin3
P3SEL |= 0x0A;
//mandatory initialization
U0CTL |= I2C + SYNC;
U0CTL &= ~I2CEN;
//master cnfiguration
I2CNDAT = 0x01;
I2CSA = 0x0048;
//clock settings
I2CTCTL |= I2CSSEL_2;
I2CPSC = 0x03; //
I2CSCLH = 0x03;
I2CSCLL = 0x03;
//interrupt settings
I2CIE |= TXRDYIE;
U0CTL |= I2CEN;
U0CTL |= MST;
I2CTCTL |= I2CSTT + I2CSTP + I2CTRX;
__enable_interrupt();
}
#pragma vector=USART0TX_VECTOR
__interrupt void I2C_ISR(void)
{
switch(I2CIV)
{
case 0: break; // No interrupt
case 2: break; // Arbitration lost
case 4: break; // No Acknowledge
case 6: break; // Own Address
case 8: break; // Register Access Ready
case 10: break; // Receive Ready
case 12:
I2CDRB = TxData; // TX data
break; // Transmit Ready
case 14: break; // General Call
case 16: break; // Start Condition
}
}