Other Parts Discussed in Thread: PCF8574, , PCF8574A
Tool/software: Code Composer Studio
Hi, I am new at this. I am trying to interfacing 1602A LCD display with MSP430G2553 via PCF8574. When I run the code, nothing happens:
#include <msp430.h> unsigned int *ptxData; unsigned int count = 0; // [0..3] -> power on, [4..5] -> function set, [6..7] -> display off, cursor off, blink off // [8..9] -> clear screen, [10..11] -> right, do not shift, [12..13] -> display on, cursor on // [14..15] -> write char 'B' unsigned int txData[] = {0x03, 0x03, 0x03, 0x02, 0x02, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x06, 0x00, 0x0F, 0x24, 0x22}; void main() { WDTCTL = WDTPW | WDTHOLD; // for i2c pins P1SEL = 0xC0; P1SEL2 = 0xC0; // i2c config UCB0CTL1 |= UCSWRST; UCB0CTL0 = UCMST | UCMODE_3 | UCSYNC; UCB0CTL1 = UCSSEL_3; UCB0BR0 = 12; UCB0BR1 = 0; UCB0I2CSA = 0x27; // slave address UCB0CTL1 &= ~UCSWRST; // enable tx interrupt IE2 |= UCB0TXIE; _enable_interrupts(); // start to transmit data ptxData = txData; UCB0CTL1 |= UCTR + UCTXSTT; while (1); } #pragma vector = USCIAB0TX_VECTOR __interrupt void USCIAB0TX_ISR(void){ // send txData elements one by one UCB0TXBUF = *ptxData; count++; *ptxData++; // if txData ends, start from beginning if (count == 16) { count = 0; ptxData -= 16; } }
What am I missing, can you help me?