Вот код начальной инициализации и работы: C
<c>
P4OUT = GR_RST + CH_RST1 + CH_RST2; // set RST signal for Graphic LCD
P4DIR = GR_RST + CH_RST1 + CH_RST2; // Output 1 to RST pin
P4OUT &= ~(GR_RST + CH_RST1);
_NOP();
_NOP();
P4OUT |= (GR_RST + CH_RST1+ CH_RST2); // Reset cycle more than 1 uSec
U0CTL |= (I2C+SYNC+MST); // set the I2C mode for UART 1, master mode
U0CTL &= ~I2CEN; // reset I2C state machine, now configure the I2C master, then set I2CEN bit
I2CTCTL = I2CSSEL1+I2CRM+I2CTRX; // select SMCLK for input clock for I2C, and reset all pending Transmit states
// and number of transmitted bytes are independent of I2CNDAT
// and transmit master function
I2CPSC = 1; // prescaler value <=4; resulting in value I2CPSC+1==2, => prescaler divider is 2
I2CSCLH = 8; // total high time = (I2CSCLH+2)*(I2CPSC+1)= 10*2==20 cycles => 1300/20/2=33kHz or kBit
I2CSCLL = 8; // same for SCL low period? i.e. duty cycle == 1/2
I2CSA = 0; // slave addres of the device to be adressed; word
I2CIFG = 0; // reset all flags
U0CTL |= I2CEN; // now Enable the setuped I2C module to work
// Back lighting setup
TACCR0 = 255; // ~250Hz of PWM freq
TACCTL2 = OUTMOD0 + OUTMOD1; // reset on timer=CCR0 and SET on timer=CCR2
TACCR2 = 128; // half the brightness
TACTL = TASSEL0 + MC0 + TACLR; // reset register, ACLK clock and start the timer in up mode until CCR0
// P1SEL |= BIT3; // select port to output
// to start transmition we set bit I2CSTT, to stop we set I2CSTP
i2c_send();
</c>