Dear programers,
I´m programing the eZ430-RF2500. I want to transmit 13 Hex values via I2C. The LEDs at MAIN- end show me that the program reached the end of the commands. I want to connect the 2274 on a 5V I2C-Level with the help of 2 * BSN20 Transistors.
The program I´m using:
#include “msp430x22x4.h”
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
P1DIR = 0x03; // P1.0 + P1.1 output, else input
P1OUT = 0x04; // P1.2 pullup
P1REN |= 0x04; // P1.2 pullup
P3SEL |= 0x06;
UCB0CTL1 |= UCSWRST;
UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC;
UCB0CTL1 = UCSSEL_2 + UCSWRST;
UCB0BR0 = 12;
UCB0BR1 = 0;
UCB0I2CSA = 0x90;
UCB0CTL1 &= ~UCSWRST;
IE2 |= UCB0TXIE;
while(1)
{
int i;
while(0x04 & P1IN); //Delay till push the button
for(i=0x0000;i<0x9000;i++); //Bounce Delay
P1OUT |= 0x01; //Red LED on; TX the Line
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x11;
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x0A;
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x1B;
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x44;
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x4C;
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x1B;
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x47;
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x44;
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x00;
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x00;
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0xEF;
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0x7F;
while(UCB0CTL1 & UCTXSTP);
UCB0CTL1 |= UCTR + UCTXSTT;
UCB0TXBUF = 0xDA;
UCB0CTL1 |= UCTXSTP; //---->Do I need this??<----
for(i=0x0000;i<0x5000;i++); //Delay; You can see the Red TX Light
P1OUT &= ~0x01; //Red LED off; TX finished
P1OUT |= 0x02; //Green LED on; TX finished; Aim reached
for(i=0x0000;i<0xF000;i++); //Delay; You can see the Green Aim Light
P1OUT &= ~0x02; //Turn the Green LED off
}
}