please help me to display this

Thread Starter

asd66

Joined Oct 27, 2010
2
hii
i wont to display the content of a varilable on LCD 16*2
connected with Atmega16
for ex:

int i=123;
LCD_out(1,3,i);
???
using mikroC
thx.
 

t06afre

Joined May 11, 2009
5,934
Funny I was just working with itoa() function. In Hi-tech C for PIC16F series. Does the MickroC compiler include the function itoa()?
ITOA
Synopsis
#include <stdlib.h>
char * itoa (char * buf, int val, int base)
Description
The function itoa converts the contents of val into a string which is stored into buf.
The conversion is performed according to the radix specified in base. buf is assumed
to reference a buffer which has sufficient space allocated to it.
Example
#include <stdlib.h>
#include <stdio.h>
void
main (void)
{
char buf[10];
itoa(buf, 1234, 16);//16=hex,10=dec,8=oct
printf(" buffer holds %s\n" buf);​
}
/*
See Also​
strtol(), utoa(), ltoa(), ultoa()
*/
 

ErnieM

Joined Apr 24, 2011
8,415
I would be curious just how the mikroC C compiler for the PIC family works with the Atmega16.

I would imagine "not."
 

t06afre

Joined May 11, 2009
5,934
I would be curious just how the mikroC C compiler for the PIC family works with the Atmega16. I would imagine "not."

of course I know that it is pointless to use a PIC compiler on a Atmega16. But the point is that ANSI C. Is not platform dependent. So in an ideal world. Then writing C and using the core functions. It Should not matter if you are coding for MAC, Windows, or even a micro controller. Of course things get a little harder then it comes to micro controllers. As an example the printf function. So compilers for micro controllers have to adapt to the real world. And they also have to take a lot of shortcuts regarding the Ansi C standard. Some compilers are more true to the Ansi C standard than others. And noe of them are 100% neither with the standard. That was why i took a reservation. And said "Does the MickroC compiler include the function itoa()?" As my compiler do. I was only trying to help:rolleyes:
 

THE_RB

Joined Feb 11, 2008
5,438
hii
i wont to display the content of a varilable on LCD 16*2
connected with Atmega16
for ex:

int i=123;
LCD_out(1,3,i);
???
using mikroC
thx.
Check the MikroC help file, it lists the libraries for string conversion etc. I think the one you need is called WordToStr() and displays a 16but insigned int as 5 text characters, used like this;

int i=123;
unsigned char txt[6]; // holds 5 char text string + null
WordToStr(i,txt);
LCD_out(1,3,txt);
 
Top