Part Number: MSP430FR4133
Other Parts Discussed in Thread: ENERGIA
Hi,
How can i print a decimal number to the LCD screen on the EVM using energia?
Thank you,
Julio
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: MSP430FR4133
Other Parts Discussed in Thread: ENERGIA
Hi,
How can i print a decimal number to the LCD screen on the EVM using energia?
Thank you,
Julio
Julio,
Example codes for this is available in CCS and Resource explorer.
//******************************************************************************
// MSP430FR413x Demo - LCD_E, Display a string "123456" on LCD in LPM3.5 mode.
//
// Description: Displays "123456" in sequence to the LCD display.
// f(LCD) = 32768Hz/((7+1)*16) = 256Hz.
// MSP430 works in LPM3.5 mode for ultra low power.
// ACLK = default REFO ~32768Hz,
// MCLK = SMCLK = default DCODIV ~1MHz
// LCD pin - Port Pin Map
// LCD pin G6021_LineX
// 1 L8 (P3.0)
// 2 L9 (P3.1)
// 3 L10 (P3.2)
// 4 L11 (P3.3)
// 5 L12 (P3.4)
// 6 L13 (P3.5)
// 7 L14 (P3.6)
// 8 L15 (P3.7)
// 9 L16 (P6.0)
// 10 L17 (P6.1)
// 11 L18 (P6.2)
// 12 L19 (P6.3)
// 13 L20 (P6.4)
// 14 L21 (P6.5)
// 15 L22 (P6.6)
// 16 L23 (P6.7)
// 17 L4 (P7.4)
// 18 L5 (P7.5)
// 19 L6 (P7.6)
// 20 L7 (P7.7)
// 21 L3 (P7.3)
// 22 L2 (P7.2)
// 23 L1 (P7.1)
// 24 L0 (P7.0)
// 25 -
// 26 -
// 27 -
// 28 -
// 29 -
// 30 -
// 31 -
// 32 L24 (P2.0)
// 33 L25 (P2.1)
// 34 L26 (P2.2)
// 35 L36 (P5.4)
// 36 L37 (P5.5)
// 37 L38 (P5.6)
// 38 L39 (P5.7)
//
// Cen Fang
// Wei Zhao
// Texas Instruments Inc.
// Oct 2013
// Built with IAR Embedded Workbench v5.60 & Code Composer Studio v5.5
//******************************************************************************
#include <msp430.h>
#define pos1 4 // Digit A1 - L4
#define pos2 6 // Digit A2 - L6
#define pos3 8 // Digit A3 - L8
#define pos4 10 // Digit A4 - L10
#define pos5 2 // Digit A5 - L2
#define pos6 18 // Digit A6 - L18
const char digit[10] =
{
0xFC, // "0"
0x60, // "1"
0xDB, // "2"
0xF3, // "3"
0x67, // "4"
0xB7, // "5"
0xBF, // "6"
0xE4, // "7"
0xFF, // "8"
0xF7 // "9"
};
int main( void )
{
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 = 0x000F; // Configure COMs and SEGs
LCDCSSEL1 = 0x0000; // L0, L1, L2, L3: COM pins
LCDCSSEL2 = 0x0000;
LCDM0 = 0x21; // L0 = COM0, L1 = COM1
LCDM1 = 0x84; // L2 = COM2, L3 = COM3
// Display "123456"
LCDMEM[pos1] = digit[1];
LCDMEM[pos2] = digit[2];
LCDMEM[pos3] = digit[3];
LCDMEM[pos4] = digit[4];
LCDMEM[pos5] = digit[5];
LCDMEM[pos6] = digit[6];
LCDCTL0 |= LCD4MUX | LCDON; // Turn on LCD, 4-mux selected
PMMCTL0_H = PMMPW_H; // Open PMM Registers for write
PMMCTL0_L |= PMMREGOFF_L; // and set PMMREGOFF
__bis_SR_register(LPM3_bits | GIE); // Enter LPM3.5
__no_operation(); // For debugger
}
Is it necessary to use energia in your case?
Thank you,
Nima Eskandari
**Attention** This is a public forum