I am making a contact less tachometer based on magnets .I am using msp430g2253 micro controller and HD44780 lcd.
I have done certain calculations for calculating rpm in the main code and now i want the values to be printed on the LCD but here i am not able to understand how to do it.
rpm = cycles*60/1000000; //This is what i want to print on the lcd i.e the value stored
in variable rpm
The code of lcd which i have used takes only *char as input , so i am not able to find out a way to convert the integer to char(I know it sounds lame but …stilll…..) and print it on lcd.
The code below is a part of the whole lcd code, but this is used to print on lcd.
void lcdprint(char *text)
{
char *c;
c = text;
while((c !=0) && (*c!=0))
{
SendByte(*c , dat);
c++;
}
}
So how should i modify this code to print the integer value on lcd. Do i need to create a function for this purpose or what??
Some details:
1.Microcontroller used : MSP430G2253
2.Software for coding: Code composer studio (CCS)
3.LCD: HD44780
Best Answer
I do not have programming experience for TI uCs. I mostly use PICs. In the programs where I need to output numbers on the LCD screen I print char by char on the LCD.
Let's assume that I need to print out the number 123.
First I make a function which divides the number in individual numbers.
Then I display each number on LCD. You can improve the code by your needs.
Example-