Hi!
I am using MSP430fr4133 launchpad. I configure LCD in static mode & it doesn't work. I want to run NXP LCD which has one backplane from this result .
Please provide help.
Here is my code.
***********LCD.c***************
#include <msp430.h>
#include "global.h"
#define LCDMEMW ((int*)LCDMEM)
const char digit[10] =
{
0xFC, // "0"
0x60, // "1"
0xDB, // "2"
0xF3, // "3"
0x67, // "4"
0xB7, // "5"
0xBF, // "6"
0xE4, // "7"
0xFF, // "8"
0xF7 // "9"
};
void LCDInit(void)
{
//unsigned char Value=0;
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
// Configure XT1 oscillator
P4SEL0 |= BIT1 | BIT2; // P4.2~P4.1: crystal pins
do
{
CSCTL7 &= ~(XT1OFFG | DCOFFG); // Clear XT1 and DCO fault flag
SFRIFG1 &= ~OFIFG;
}while (SFRIFG1 & OFIFG); // Test oscillator fault flag
CSCTL6 = (CSCTL6 & ~(XT1DRIVE_3)) | XT1DRIVE_2; // Higher drive strength and current consumption for XT1 oscillator
// Disable the GPIO power-on default high-impedance mode
// to activate previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
// Configure LCD pins
SYSCFG2 |= LCDPCTL; // R13/R23/R33/LCDCAP0/LCDCAP1 pins selected
LCDPCTL0 = 0xFFFF;
LCDPCTL1 = 0x07FF;
LCDPCTL2 = 0x00F0; // L0~L26 & L36~L39 pins selected
LCDCTL0 = LCDSSEL_0 | LCDDIV_7; // flcd ref freq is xtclk
// LCD Operation - Mode 3, internal 3.08v, charge pump 256Hz
LCDVCTL = LCDCPEN | LCDREFEN | VLCD_6 | (LCDCPFSEL0 | LCDCPFSEL1 | LCDCPFSEL2 | LCDCPFSEL3);
LCDMEMCTL |= LCDCLRM; // Clear LCD memory
LCDCSSEL0 = 0x0001; // Configure COMs and SEGs
LCDCSSEL1 = 0x0000; // L0, L1, L2, L3: COM pins
LCDCSSEL2 = 0x0000;
LCDM0 = 0x11; // L0 = COM0,
LCDM1 = 0x00;
LCDCTL0 |= LCDSTATIC | LCDON; // Turn on LCD, 2-mux selected
PMMCTL0_H = PMMPW_H; // Open PMM Registers for write
PMMCTL0_L |= PMMREGOFF_L; // and set PMMREGOFF
}
//======================================
int LCDDataOut(int data,int position)
{
LCDMEM[pos4] = digit[data];
}
//__bis_SR_register(LPM3_bits | GIE); // Enter LPM3.5
//__no_operation(); // For debugger
***********main.c***************
#include <msp430.h>
#include"global.h"
unsigned int counter = 0;
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
LCDInit();
//P4.0 set as o/p for led
P4DIR |= BIT0; // Set P4.0 to output direction
P4OUT &= ~(BIT0); // set P4.0 to 0 ( OFF)
while(1)
{
LCDDataOut(1,pos2);
__delay_cycles(10);
}
}