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.

MSP430F425: How to show 2 measurement values ie a 2 digit value & 5 digit value on a 7 digit , segment LCD simulataneously

Part Number: MSP430F425
Other Parts Discussed in Thread: MSP430FE425

Hi All,

I am have currently intefaced  the MSP430F425  with a 5 digit, 7 segment display. I am able to calculate a value & display a 5 digit number it on the same. Now i intend to use it on a 7 digit, 7 segment wherein i want to display 2 seperate values which signify 2 measurements.

Ex: - I was displaying voltage 1.0000 to 5.0000  earlier, Now i would like to display 10.000 to 50.000 & 00 to 99mA while measuring them separately.

Attached below is the code i am using which runs like a dream


#include "MSP430FE425.h"
#include "4_5_LCD_40_STATIC_Test.h"

/* Variable Declarations */
// Number to display,
// range = 0 - 1999 = max display
// NOTE: DO NOT use leading zeros

unsigned int h;
unsigned int index;
unsigned int dig_pntr;


/* LCD Mapping Array */
const char digit[10] =
{
0xEB, // '0' LCD segments
0x60, // '1'
0xC7, // '2'
0xE5, // '3'
0x6C, // '4'
0xAD, // '5'
0xAF, // '6'
0xE0, // '7'
0xEF, // '8'
0xED, // '9'
};


/***********************************************
*
* Function : disp_decimal
* Desc : DECIMAL POINT PRINT
*
***********************************************/
void disp_decimal(int value_exp)
{
if ( value_exp == (4) )
LCDM1 |= 0x10; // 1dp exp -4
else if ( value_exp == (3) )
LCDM2 |= 0x10; // 2dp exp -3
else if( value_exp == (2) )
LCDM3 |= 0x10; // 3dp exp -2
else if (value_exp == (1) )
LCDM4 |= 0x10; // 4dp exp -1
}


/***********************************************
*
* Function : disp_digit
* Args : input as decimal
*
***********************************************/
//void disp_digit(unsigned int value, int value_exp)
void disp_digit(unsigned long int value)
{
unsigned long int value_long;
// char* LCD = LCDMEM;
value_long = dec2bcd(value); // decimal to BCD conversion

for (index=5; index>0; index--)
{
LCDMEM[index-1] = digit[value_long & 0xF]; // Remainder = character in table to display
value_long >>= 4; // Shifts right so next character can be displayed
}
}

/**********************************************
*
* Function : dec2bcd
* Desc : decimal to BCD conversion
*
***********************************************/
unsigned long int dec2bcd(unsigned long int value)
{
// example : if value = 12345
unsigned int a[5];
unsigned int h;
unsigned long int bcd_value;

for(h = 0; h < 5; h++)
{
a[h] = value % 10; // 5,4,3,2,1
value /= 10; // 1234,123,12,1,0
}

bcd_value = 0x0000;

for(h = 5; h > 0; h--)
{
bcd_value <<= 4;
bcd_value |= a[h-1];
}
return bcd_value;
}

/**********************************************
*
* Function : clear_LCD_scr
* Desc : Clear all connected LCD Segments
*
***********************************************/

void clear_LCD_scr(unsigned char clear_value)
{
for (index = 0; index < 13; index++)
{
LCDMEM[index] = clear_value;
}
delay(50000);

}
/***********************************************
* Function: delay
* Desc : Provides delay of
* j * (time per instruction)
*
***********************************************/
void delay(unsigned int j)
{
while((j--));
}

/* ********************************************************
* Function : lcd_3_5_init
* Desc : Function initialises the LCD Pins
* Args : N/A
* Return type : N/A
* *******************************************************/

void lcd_3_5_init( void )
{
// LCDCTL = LCDP1+LCDP0+LCDSTATIC+LCDON; // Static LCD, segments S0-S23
LCDCTL = LCDP1+LCDP0+LCD4MUX+LCDON; // LCD 4MUX initialisation
//BTCTL = BTFRFQ1+BTFRFQ0; // Set freqLCD = ACLK/256
BTCTL = 0X00; // Set freqLCD - ACLK/128
// Initialize port pins
//P1DIR = 0xFF; // Set port to outputs
//P2DIR = 0xFF; // Set port to outputs
}

**Attention** This is a public forum