Hello Everybody, I have msp-exp430g2 launchpad and i'm trying to communicate with lcd with i2c controller attached to it(YWRobot LCM1602 IIC V1 by arduino). I've copied an example i saw i ran it and ,of course, it didn't work I wanted to know what i'm missing to make it work. a good start point is the address of the lcd(slave), in which, i don't know. how can i find the lcd address? I don't have any datasheet for this lcd. Here's my code: #include #include "msp430.h" #include "TI_USCI_I2C_master.h" /* * main.c */ void delay( unsigned int n ) { volatile int i; for( ; n; n-- ) { for( i = 0; i < 50; i++ ); } } int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT BCSCTL1 = CALBC1_8MHZ; DCOCTL = CALDCO_8MHZ; TI_USCI_I2C_transmitinit(0x27, 0x08); unsigned char transmit_string[40]; while ( TI_USCI_I2C_notready() ); TI_USCI_I2C_transmit(2, (unsigned char *) "\x00\x38"); while ( TI_USCI_I2C_notready() ); TI_USCI_I2C_transmit(1, (unsigned char *) "\x39"); // 8-bit bus, 2-line display, extension instruction mode. while ( TI_USCI_I2C_notready() ); TI_USCI_I2C_transmit(7, (unsigned char *) "\x14\x78\x5e\x6d\x0c\x01\x06"); while ( TI_USCI_I2C_notready() ); TI_USCI_I2C_transmit(2, (unsigned char *) "\x00\x01"); while ( TI_USCI_I2C_notready() ); TI_USCI_I2C_transmit(21, (unsigned char *) "\x40Hello, world. "); while(1) { //Switch2Pressed = 0; __bis_SR_register(LPM2_bits + GIE); // __no_operation(); // For debugger // while (i2c_avail()) { // int c = i2c_getchar(); // i2c_putchar(c); // } } return 0; }
↧