kobre98
Full Member level 2
- Joined
- Sep 18, 2011
- Messages
- 145
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,296
- Location
- Gaza, Palestine
- Activity points
- 2,523
Hi,
I have a project in which I want to display numbers on LCD
I convert the numbers from int to string and then display them on LCD
but I want to compare this number with another two digits number which is stored in array
the problem is that each time I display the two digits number on LCD it leaves 4 to 5 blanks before the number is displayed
it's like the number is moved or not stored on [0] location
I don't know what to do
this code
the purpose of this code is that each time I press a button it will increase the hour which is a two digit number
and display it on LCD
at the bottom of the code I tried to clear it from spaces and display it a gain
I faced a lot of problems dealing with arrays and integers when LCD is involved so the question is how long an array should be to transfer a two digit integer to it and should I define it as integer or as long
I feel like lost the point but any explanation on how to convert int to string without getting spaces and without using atoi function would be appreciated
- - - Updated - - -
The main request is a method that I can use to convert integer to string even if the array of strings has spaces before or after the number
not a predefined method as atoi since non of them works for me
- - - Updated - - -
The main request is a method that I can use to convert integer to string even if the array of strings has spaces before or after the number
not a predefined method as atoi since non of them works for me
- - - Updated - - -
The main request is a method that I can use to convert integer to string even if the array of strings has spaces before or after the number
not a predefined method as atoi since non of them works for me
I have a project in which I want to display numbers on LCD
I convert the numbers from int to string and then display them on LCD
but I want to compare this number with another two digits number which is stored in array
the problem is that each time I display the two digits number on LCD it leaves 4 to 5 blanks before the number is displayed
it's like the number is moved or not stored on [0] location
I don't know what to do
this code
Code:
if(PORTA.F1==0)
{
WordToStr(counter_Hours, counter_Hours_string);
if(counter_Hours>=12)
{
counter_Hours = 0 ;
}
if(h[0]==houry[0] && h[1] == houry[1] )
{
portd=0xFF;
delay_ms(1000);
portd=0x00;
delay_ms(1000);
}
h[0] = counter_Hours_string[0];
h[1] = counter_Hours_string[1];
Lcd_out(1,1,h);
o=0;
for(n=0;n<7;n++){
if(h[n]!=' ')
{
h[o]= h[n];
o++;
}
}
the purpose of this code is that each time I press a button it will increase the hour which is a two digit number
and display it on LCD
at the bottom of the code I tried to clear it from spaces and display it a gain
I faced a lot of problems dealing with arrays and integers when LCD is involved so the question is how long an array should be to transfer a two digit integer to it and should I define it as integer or as long
I feel like lost the point but any explanation on how to convert int to string without getting spaces and without using atoi function would be appreciated
- - - Updated - - -
The main request is a method that I can use to convert integer to string even if the array of strings has spaces before or after the number
not a predefined method as atoi since non of them works for me
- - - Updated - - -
The main request is a method that I can use to convert integer to string even if the array of strings has spaces before or after the number
not a predefined method as atoi since non of them works for me
- - - Updated - - -
The main request is a method that I can use to convert integer to string even if the array of strings has spaces before or after the number
not a predefined method as atoi since non of them works for me