Sign in

username:

password:



Not a member?

Search msp430



Search tips

Subscribe to msp430



Ads

Discussion Groups

Discussion Groups | MSP430 | LCD display

The purpose of this group is to foster exchange of information on the Texas Instruments MSP430 family of microcontrollers and related tools. Everyone welcome, all levels of familiarity/expertise.

LCD display - sid_...@yahoo.com - Jul 14 16:55:22 2008

hi all,

I have a project in which i have to dynamically display numbers on
LCD by taking input from the user, i have done it for integers, can any
one guide me how do i implement the same for decimal numbers
Thanx

------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )


Re: LCD display - Gabriel Calin - Jul 14 17:24:59 2008

Just use fixed point notation and plot a "." in the right place. For
example, a decimal number 10.123 will be stored as 10123. All math will
work exactly the same way you know (you will only have to check you
variable limits to avoid overflows).

Calin

s...@yahoo.com wrote:
>
> hi all,
>
> I have a project in which i have to dynamically display numbers on
> LCD by taking input from the user, i have done it for integers, can any
> one guide me how do i implement the same for decimal numbers
> Thanx
>
>

[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )

Re: LCD display - sid_...@yahoo.com - Jul 14 17:27:46 2008

ya dats true but hw do i scan if a decimal point is present or not;

this is the code for integers as per my requirements:
#include "LCD.h"
#include "msp430xG46x.h"
#include "stdio.h"

const int charseg[]=
{
LCD_A+LCD_B+LCD_C+LCD_D+LCD_E+LCD_F, // '0' or 'O'
LCD_B+LCD_C, // '1' or 'I'
LCD_A+LCD_B+LCD_D+LCD_E+LCD_G, // '2' or 'Z'
LCD_A+LCD_B+LCD_C+LCD_D+LCD_G, // '3'
LCD_B+LCD_C+LCD_F+LCD_G, // '4' or 'y'
LCD_A+LCD_C+LCD_D+LCD_F+LCD_G, // '5' or 'S'
LCD_A+LCD_C+LCD_D+LCD_E+LCD_F+LCD_G, // '6' or 'b'
LCD_A+LCD_B+LCD_C, // '7'
LCD_A+LCD_B+LCD_C+LCD_D+LCD_E+LCD_F+LCD_G, // '8' or 'B'
LCD_A+LCD_B+LCD_C+LCD_F+LCD_G // '9' or 'g'

};

void disp(long int num)
{
int pos=0, index;
long int x;

if(num>18888888)
{
LCDM7=LCD_A+LCD_D+LCD_E+LCD_F+LCD_G;
LCDM6=LCD_E+LCD_G;
LCDM5=LCD_E+LCD_G;
}
else if(num>9999999)
{

LCDMEM[12]|=LCD_D;

x=num-10000000;

do
{
index=x%10;
LCDMEM[pos+LCD_MEM_OFFSET]=charseg[index];
pos++;
x=x/10;
}while(x!=0);
}

else
{

x=num;

do
{
index=x%10;
LCDMEM[pos+LCD_MEM_OFFSET]=charseg[index];
pos++;
x=x/10;
}while(x!=0);

}

}
void main(void)
{
int i;
WDTCTL = WDTPW + WDTHOLD; // Stop WDT

FLL_CTL0 |= XCAP14PF; // Configure load caps

P5SEL = 0x1C; // P5.2/3/4 = LCD COM lines
for (i = 19; i > 0; i--) LCDMEM[i] = 0; // Clear LCD
LCDACTL = LCDON + LCD4MUX + LCDFREQ_128; // 4mux LCD, ACLK/128
LCDAPCTL0 = 0x7E; // Segments 4-27

disp(18283848);

}

----- Original Message ----
From: Gabriel Calin
To: m...@yahoogroups.com
Sent: Monday, July 14, 2008 5:24:14 PM
Subject: Re: [msp430] LCD display
Just use fixed point notation and plot a "." in the right place. For
example, a decimal number 10.123 will be stored as 10123. All math will
work exactly the same way you know (you will only have to check you
variable limits to avoid overflows).

Calin

sid_s_us@yahoo. com wrote:
>
> hi all,
>
> I have a project in which i have to dynamically display numbers on
> LCD by taking input from the user, i have done it for integers, can any
> one guide me how do i implement the same for decimal numbers
> Thanx

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )

Re: LCD display - Leon - Jul 14 17:44:02 2008

----- Original Message -----
From:
To:
Sent: Monday, July 14, 2008 10:27 PM
Subject: Re: [msp430] LCD display
> ya dats true but hw do i scan if a decimal point is present or not;
>

With fixed-point arithmetic you know where it is.

Leon
------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )