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
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..
Of course it works, as long as you have a routine to actually do the printing - which you need to write yourself for whatever 'display' you're using.
However, what you're forgetting is the huge impact of sprintf which takes a LOT of memory space, and runs pretty slowly - it's far more efficient to write a specific routine to do just what you want.
I hate to admit it, but, it's so much easier in Arduino. I added an "LCD" class for my old 2-pin 8-bit LCD Backpack a couple years ago and it was relatively easy to include the Arduino "Print" class for all those neat formatting capabilities... I posted the demo' here on ETO...
I hate to admit it, but, it's so much easier in Arduino. I added an "LCD" class for my old 2-pin 8-bit LCD Backpack a couple years ago and it was relatively easy to include the Arduino "Print" class for all those neat formatting capabilities... I posted the demo' here on ETO...
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..
Dear Ian,
Sorry for my late reply. I tried ypur routine in my code. I probably missed some thing, because in line 2 of LCD, LCD doesn't displays the decounting of microsecond (just for testing the code, rapidely and in a wide situation).
Do you have an idea.
Compiled with mikroC from mikroelektronika
Eric
Thank you to enlighten me. I m trying to switch with your instruction ... it’s almost ok ... I will try some changes by my own, maybe will come back.
About the line with abs ... I would not use any fonction of the library, how could I change this line ? number = - number doesn’t work ...
Bonjour Ian,
In order to count for(sec = -8388607; sec <= 8388607; sec = sec + 0.5), I fitted your routine to my needs as follow here under ...
But ... ‘-‘ minus never displays ...
And what is the aim of lines :
if (*(flt + 2) == 48) *(flt + 2) = 32; // 32 = space
Code :
void print_float_v7(char *flt, long number, char digits)
{
if (number < 0)
{
number = - number;
*(flt) = 45; // 45 = '-'
*(flt + 1) = 32; // 32 = space
}
if (number >= 0)
{
*(flt) = 32; // 32 = space
*(flt + 1) = 32; // 32 = space
}