kgavionics
Full Member level 3
- Joined
- Jun 12, 2012
- Messages
- 167
- Helped
- 7
- Reputation
- 14
- Reaction score
- 11
- Trophy points
- 1,298
- Location
- Alberta.Canada
- Activity points
- 2,482
Hello
I have this code that sends a string to an LCD and I have a problem (see picture) when the number is less than 3 digits! How can I get rid of the weird characters and display for instance 0 as 000,10 as 010 and so on!
Thank you guys in advance!
I have this code that sends a string to an LCD and I have a problem (see picture) when the number is less than 3 digits! How can I get rid of the weird characters and display for instance 0 as 000,10 as 010 and so on!
Thank you guys in advance!
C:
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include "lcd_lib.h"
#include <stdlib.h>
int main(void)
{
unsigned char str[3],value=0;
LCDinit();//init LCD bit, dual line, cursor right
LCDclr();//clears LCD
LCDcursorOFF();
itoa(value,str,10);
LCDstring(str,3);
//LCDsendChar(value);
while(1);//loop demos
return 0;
}
//working on hardware