• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC > LCD > Displaying string and int value

kawauso

New Member
I would like to know how to write :
1) a message like « Bonjour ! Ça va ? »
2) the value of a variable after measuring,
3) the combination of both 1) & 2) like 3,47 volts.
I made some research on the web. I do not want to use only in MikroC the Conversion Library of Mikroelektronika and the void IntToString(void) without being able to watch the code inside and understanding the conversion process.
Some body has a idea or the link to an open source ?
Thanks at all !
Merci à tous.
Eric
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
Here's mine. No comments .. takes an array, a value and a decimal requirement then stores as fixed point number ie.. 900 with 1 decimal = 90.0
It does what I want it to... modify as you see fit..

C:
void printFloat(char * flt, long number, char digits)
    {
    if(number < 0)
        {
        number = abs(number);
        }
    if(digits == 2)
        {
        flt[0] = number / 1000 + 48;
        if(flt[0] == 48) flt[0] = 0x20;
        flt[1] = ((number % 1000) / 100)+ 48;
        flt[2] = 46;
        flt[3] = ((number % 100) / 10)+ 48;
        flt[4] = (number % 10) + 48;
        flt[5] = 0;
        }
    else
        {
        flt[0] = number / 100 + 48;
        if(flt[0] == 48) flt[0] = 0x20;
        flt[1] = ((number % 100) / 10)+ 48;
        flt[2] = 46;
        flt[3] = (number % 10) + 48;
        flt[4] = 0;
        }
    }
 

Latest threads

EE World Online Articles

Loading

 
Top