Thread: LCD problem in printing ascii value from generated adc 8051

  1. #1
    Registered User
    Join Date
    Apr 2012

    LCD problem in printing ascii value from generated adc 8051

    Hi people,
    I am doing a bit of c programing to read temperature from an analogue temperature sensor. Now I have converted the value from the sensor to ASCII. My problem is to display that value. I have tried alot to display this converted value, but had no success. I know how to display words on lcd and special characters in ascii. but I can't display the value of the temperature as the compiler is giving me an error: " error C247: non-address/-constant initializer". Below is some extracts of the code made:

    unsigned char unit;
    code unsigned char message[]={unit,0xDF,0x43};
    now the units has been converted to ASCII in another function. Can please someone help me out. Thanks in advance,

  2. #2
    Registered User
    Join Date
    May 2010
    Why are you trying to use the code specifier? You will probably need a constant to use the code segment. Shouldn't that be one of your data segment instead.


  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    To be strictly ANSI C, you need something like
    void foo ( unsigned char unit ) {
        unsigned char message[]={0x00,0xDF,0x43};  /* 0x00 is a placeholder */
        message[0] = unit;
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 05-04-2011, 03:20 PM
  2. Problem printing ASCII control characters
    By d2rover in forum C Programming
    Replies: 12
    Last Post: 10-14-2010, 07:46 AM
  3. printing non-ASCII characters (in unicode)
    By dbaryl in forum C Programming
    Replies: 1
    Last Post: 10-25-2002, 01:00 PM
  4. printing ASCII
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-10-2002, 09:13 PM
  5. Printing extended ASCII characters
    By Jonny M in forum C Programming
    Replies: 2
    Last Post: 03-01-2002, 10:12 AM