please help me to display this

Discussion in 'Programmer's Corner' started by asd66, Feb 21, 2012.

  1. asd66

    Thread Starter New Member

    Oct 27, 2010
    2
    0
    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.
     
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Funny I was just working with itoa() function. In Hi-tech C for PIC16F series. Does the MickroC compiler include the function itoa()?
     
  3. asd66

    Thread Starter New Member

    Oct 27, 2010
    2
    0
  4. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    The ltoa() is a standard function in Ansi C. But sorry for you not a part of MikroC. Some googling gave me that in mikroC the same function is named IntToStr. Take a look at it. Hope it helps.
     
    asd66 likes this.
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    I would be curious just how the mikroC C compiler for the PIC family works with the Atmega16.

    I would imagine "not."
     
  6. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    [​IMG]
    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:
     
  7. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    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);
     
  8. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
Loading...