Part Number: MSP430F4152
Other Parts Discussed in Thread: MSP-EXP430FR4133
Tool/software: Code Composer Studio
Hi,
I want to interface MSP430F4152 with Segment LCD.Segment LCD is New for me .
I have seen below Application Note and Code from MSP430 Book.
http://www.ti.com/lit/an/slaa654a/slaa654a.pdf?&ts=1590147546767
// Reference from BOOK // MSP430 Microcontroller Basics // John H. Davies // //---------------------------------------------------------------------- #include <io430xG46x.h> // Specific device #include <intrinsics.h> // Intrinsic functions #include <stdint.h> // Integers of defined sizes //---------------------------------------------------------------------- #define LCDMEMS 11 // LCD memories used (3-13) // Pointer to LCD memory used: allows use of array LCDMem[] uint8_t * const LCDMem = (uint8_t *) &LCDM3; //---------------------------------------------------------------------- // Function prototypes void InitLCD (void); //---------------------------------------------------------------------- void main (void) { int i, j; // Loop counters enum {up, down} direction; // Direction of Johnson counter WDTCTL = WDTPW|WDTHOLD; // Stop watchdog timer P2OUT = BIT2; // LED1 (P2.2) on, LED2 (P2.1) off P2DIR = BIT1|BIT2; // Set pins with LEDs to output InitLCD(); // Initialize SBLCDA4 TACCR0 = 0x1000; // Upper limit of count for TAR TACCTL0 = CCIE; // Enable Compare 0 interrupts TACTL = MC_1| TASSEL_1 | TACLR; // Set up and start Timer A // "Up to CCR0" mode, no clock division, clock from ACLK, clear timer direction = up; // Start Johnson counter up for (;;) { // Loop forever for (i = 0; i < LCDMEMS; ++i) { // Count through LCD memories for (j = 0; j < 8; ++j) { // Count through bits __low_power_mode_3(); // LPM3 provides delay if (direction == up) { // Shift left, insert 1 on right LCDMem[i] = (LCDMem[i] << 1) | BIT0; } else { // Shift left, insert 0 (default) LCDMem[i] = (LCDMem[i] << 1); } } __low_power_mode_3(); // extra delays after each character __low_power_mode_3(); } if (direction == up) { // Reverse direction after all chars direction = down; } else { direction = up; } } } //---------------------------------------------------------------------- // Initialize SBLCDA4 //---------------------------------------------------------------------- void InitLCD (void) { int i; for(i = 0; i < LCDMEMS; ++i) { // Clear LCD memory used LCDMem[i] = 0; } P5SEL = BIT4 | BIT3 | BIT2; // Select COM[3:1] function LCDAPCTL0 = LCDS4|LCDS8|LCDS12|LCDS16|LCDS20|LCDS24; // Enable LCD segs 4-27 (4-25 used) LCDAVCTL0 = 0; // No charge pump, everything internal LCDACTL = LCDFREQ_128 | LCD4MUX | LCDSON | LCDON; } // ACLK/128, 4mux, segments on, LCD_A on //---------------------------------------------------------------------- // Interrupt service routine for Timer A channel 0 // Processor returns to "calling routine" in active mode //---------------------------------------------------------------------- #pragma vector = TIMERA0_VECTOR __interrupt void TIMERA0_ISR (void) { P2OUT ^= BIT1|BIT2; // Toggle LEDs __low_power_mode_off_on_exit(); // Restore Active Mode on return }
From where i can download Segmented LCD Demo code like for below application with Digits , Symbols , Up an Down etc.?
How do I write the waveform pattern in code/program to display on Segmented LCD?
Thankyou
--
Karan
