Compile Error of 89S52

Discussion in 'Embedded Systems and Microcontrollers' started by thyag2020, Sep 22, 2011.

  1. thyag2020

    Thread Starter New Member

    Jan 8, 2010
    3
    0
    Hi, This is thyag. I have one problem in my program. I have not made this. I have get it done by outside. When i download the hex code from my system to IC through Atmel programmer, programmer program shows some error. then tried to complile existing C code in Keil C. I tried to Build but it is showing Not Built and Target not created.

    I have attached the C codes in word file. also attached Hex code of word files. Atmel IC 89S52 used. 12MHz crystel used.

    Could you please help me what is the problem in C code. why it is showing error when i am try to build. Suppose if you have programmer, please write the attached Hex code in 89S52 IC whether it is showing any error while writing in IC (Programmer program i have selected 89S52IC for write).
    Master and Slave are connected through serial data transfer. Both are 89S52IC. Please help me. Because i couldn't contact the developer of this program. His mobile number is not reachable. So, i couldnot contact him. Please help to me.
     
  2. stahta01

    Member

    Jun 9, 2011
    133
    21
    I suggest posting the error message.

    Again, I suggest posting the error message.


    I suggest using code tags; read link http://forum.allaboutcircuits.com/showthread.php?t=37117
    Edit: I have no plans to download word docs because of computer safety; I an guessing several others will not do it for the same reason; that is why posting code in code tags is better that attaching word docs.

    Edit2: It is better to attach .txt files than .doc files.

    Tim S.
     
    Last edited: Sep 22, 2011
  3. AlexR

    Well-Known Member

    Jan 16, 2008
    735
    54
    Without the full error messages its difficult to know what is going on.
    Also many people, myself included, have a policy of never opening .doc files so if you post your source files as either .pdf or plain text files you might get a better response.
     
  4. thyag2020

    Thread Starter New Member

    Jan 8, 2010
    3
    0
    Hi, Please see the error messages while build the C program in KeilC.
    Build target 'Target 1'
    compiling leak tester.c...
    leak tester.c(1): warning C318: can't open file 'REGS52.H'
    LEAK TESTER.C(173): error C213: left side of asn-op not an lvalue
    compiling leaktest_1.c...
    leaktest_1.c(1): warning C318: can't open file 'REGX51.H'
    LEAKTEST_1.C(144): error C202: 'TMOD': undefined identifier
    LEAKTEST_1.C(145): error C202: 'TH1': undefined identifier
    LEAKTEST_1.C(146): error C202: 'SCON': undefined identifier
    LEAKTEST_1.C(147): error C202: 'TR1': undefined identifier
    LEAKTEST_1.C(148): error C202: 'EA': undefined identifier
    LEAKTEST_1.C(149): error C202: 'EX0': undefined identifier
    LEAKTEST_1.C(152): error C202: 'PCON': undefined identifier
    LEAKTEST_1.C(153): error C202: 'P0': undefined identifier
    LEAKTEST_1.C(153): error C202: 'P2': undefined identifier
    LEAKTEST_1.C(153): error C202: 'P1': undefined identifier
    LEAKTEST_1.C(156): error C202: 'P3_7': undefined identifier
    LEAKTEST_1.C(166): error C202: 'P3_3': undefined identifier
    LEAKTEST_1.C(168): error C202: 'P3_6': undefined identifier
    LEAKTEST_1.C(173): error C202: 'P3_6': undefined identifier
    LEAKTEST_1.C(176): error C202: 'P3_7': undefined identifier
    LEAKTEST_1.C(180): error C202: 'P3_5': undefined identifier
    LEAKTEST_1.C(183): error C202: 'P3_5': undefined identifier
    LEAKTEST_1.C(186): error C202: 'P3_4': undefined identifier
    LEAKTEST_1.C(189): error C202: 'P3_4': undefined identifier
    LEAKTEST_1.C(203): error C202: 'P1_4': undefined identifier
    LEAKTEST_1.C(204): error C202: 'P0': undefined identifier
    LEAKTEST_1.C(216): error C202: 'P0': undefined identifier
    LEAKTEST_1.C(216): error C202: 'P2': undefined identifier
    LEAKTEST_1.C(216): error C202: 'P1': undefined identifier
    LEAKTEST_1.C(221): error C202: 'P1_4': undefined identifier
    LEAKTEST_1.C(225): error C202: 'P1_3': undefined identifier
    LEAKTEST_1.C(226): error C202: 'P0': undefined identifier
    LEAKTEST_1.C(237): error C202: 'P0': undefined identifier
    LEAKTEST_1.C(237): error C202: 'P2': undefined identifier
    LEAKTEST_1.C(237): error C202: 'P1': undefined identifier
    LEAKTEST_1.C(241): error C202: 'P1_3': undefined identifier
    LEAKTEST_1.C(248): error C202: 'P0': undefined identifier
    LEAKTEST_1.C(254): error C202: 'P1_2': undefined identifier
    LEAKTEST_1.C(255): error C202: 'P0': undefined identifier
    LEAKTEST_1.C(267): error C202: 'P0': undefined identifier
    LEAKTEST_1.C(267): error C202: 'P2': undefined identifier
    LEAKTEST_1.C(267): error C202: 'P1': undefined identifier
    LEAKTEST_1.C(271): error C202: 'P1_2': undefined identifier
    LEAKTEST_1.C(275): error C202: 'P1_2': undefined identifier
    LEAKTEST_1.C(276): error C202: 'P0': undefined identifier
    LEAKTEST_1.C(288): error C202: 'P0': undefined identifier
    LEAKTEST_1.C(288): error C202: 'P2': undefined identifier
    LEAKTEST_1.C(288): error C202: 'P1': undefined identifier
    LEAKTEST_1.C(293): error C202: 'P1_2': undefined identifier
    LEAKTEST_1.C(299): error C202: 'P0': undefined identifier
    LEAKTEST_1.C(304): error C202: 'P2': undefined identifier
    LEAKTEST_1.C(307): error C202: 'P3_0': undefined identifier
    LEAKTEST_1.C(308): error C202: 'P3_0': undefined identifier
    LEAKTEST_1.C(317): error C202: 'TI': undefined identifier
    LEAKTEST_1.C(320): error C202: 'SBUF': undefined identifier
    LEAKTEST_1.C(321): error C202: 'TI': undefined identifier
    LEAKTEST_1.C(322): error C202: 'TI': undefined identifier
    LEAKTEST_1.C(326): error C202: 'SBUF': undefined identifier
    LEAKTEST_1.C(327): error C202: 'TI': undefined identifier
    LEAKTEST_1.C(328): error C202: 'TI': undefined identifier
    LEAKTEST_1.C(330): error C202: 'SBUF': undefined identifier
    LEAKTEST_1.C(331): error C202: 'TI': undefined identifier
    LEAKTEST_1.C(332): error C202: 'TI': undefined identifier
    LEAKTEST_1.C(750): error C202: 'TH0': undefined identifier
    LEAKTEST_1.C(751): error C202: 'TL0': undefined identifier
    LEAKTEST_1.C(752): error C202: 'EA': undefined identifier
    LEAKTEST_1.C(753): error C202: 'ET0': undefined identifier
    LEAKTEST_1.C(754): error C202: 'TR0': undefined identifier
    LEAKTEST_1.C(903): error C202: 'P3_0': undefined identifier
    LEAKTEST_1.C(905): error C202: 'P3_0': undefined identifier
    LEAKTEST_1.C(973): error C202: 'EA': undefined identifier
    LEAKTEST_1.C(982): error C202: 'EA': undefined identifier
    LEAKTEST_1.C(988): error C202: 'EA': undefined identifier
    LEAKTEST_1.C(1000): error C202: 'EA': undefined identifier
    LEAKTEST_1.C(1006): error C202: 'P1_7': undefined identifier
    LEAKTEST_1.C(1007): error C202: 'P1_6': undefined identifier
    LEAKTEST_1.C(1009): error C202: 'P1_7': undefined identifier
    LEAKTEST_1.C(1011): error C202: 'P1_6': undefined identifier
    LEAKTEST_1.C(1017): error C202: 'P1_7': undefined identifier
    LEAKTEST_1.C(1019): error C202: 'P1_6': undefined identifier
    LEAKTEST_1.C(1021): error C202: 'P1_7': undefined identifier
    LEAKTEST_1.C(1023): error C202: 'P1_6': undefined identifier
    LEAKTEST_1.C(1030): error C202: 'P1_7': undefined identifier
    LEAKTEST_1.C(1042): error C202: 'P1_6': undefined identifier
    LEAKTEST_1.C(1044): error C202: 'P1_6': undefined identifier
    LEAKTEST_1.C(1059): error C202: 'P1_7': undefined identifier
    LEAKTEST_1.C(1061): error C202: 'P1_7': undefined identifier
    LEAKTEST_1.C(1072): error C202: 'P1_7': undefined identifier
    LEAKTEST_1.C(1086): error C202: 'IE0': undefined identifier
    LEAKTEST_1.C(1090): error C202: 'P3_0': undefined identifier
    LEAKTEST_1.C(1091): error C202: 'P3_2': undefined identifier
    LEAKTEST_1.C(1093): error C202: 'P3_0': undefined identifier
    LEAKTEST_1.C(1094): error C202: 'P3_2': undefined identifier
    LEAKTEST_1.C(1102): error C202: 'TF0': undefined identifier
    LEAKTEST_1.C(1106): error C202: 'TR0': undefined identifier
    LEAKTEST_1.C(1110): error C202: 'TH0': undefined identifier
    LEAKTEST_1.C(1111): error C202: 'TL0': undefined identifier
    Target not created
     
  5. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    To me it looks like your compiler can not find the file REGS52.H. I assume that the latter header file. Contains all the internal register definition for the controller. Do a search for 'REGS52.H' file on your computer. I am quite sure you have it. And all that is needed is to tell your compiler the path to this file.
    Edit: I aslo saw that your compiler also can not find the 'REGX51.H' file. Do the same for this file
     
  6. stahta01

    Member

    Jun 9, 2011
    133
    21
    If the search fails try my suggestion below:

    My guess is that you are using the wrong header file to work with the Keil compiler. Please find the correct example file that does as little as possible to check your compiler setup works. It is likely call blinky.c as that is what I used in class on a Silab 8051-like MCU.

    http://www.keil.com/uvision/ide_ov_examples.asp

    Tim S.
     
  7. thyag2020

    Thread Starter New Member

    Jan 8, 2010
    3
    0
    Hi,
    I have corrected from 'REGX52' to header file 'REG52.H'. Now it is not showing any error message regarding addressing. But it is showing following error message while i build. error C213 shows near TMOD:

    -------------------------------------
    LEAK TESTER.C(173): error C213: left side of asn-op not an lvalue
    Target not created
    -------------------------------------
    void main (void)
    {
    unsigned char sequence;
    ERROR C213 ===> TMOD = 0x21; // Serial Init
    TH1 = TL1 = 0xff;
    SCON = 0x40;
    TR1 == 1;
    EA == 1;
    EX0 == 1;
    // ES = 1;
    // REN = 1;
    PCON = 0x00;
    ALL_RELAY_OFF;
    delay_milli(10000);
    if(!SW_SAVE)
    reinit_eeprom();
    if((read(AT24CXX,ADD_PGM)) != 0xAA)
    reinit_eeprom();
    get_backup();
    init_disp();
    current_mode = 0;
     
  8. stahta01

    Member

    Jun 9, 2011
    133
    21
    You need to learn to Google; to find directions for your chip and your compiler. Note: Are you sure you set the compiler to use your chip?

    If no, do that first.

    Below is a wild guess on my part; it is not likely to work.

    http://www.techtoys.com.hk/8051/AT89S52-gLCD-STK1/chp2_LEDBlink.pdf



    Try this, and see if it works; this is a guess from the pdf linked above.
    It seems to me that it will not work, but, I am not sure.

    Code ( (Unknown Language)):
    1.  
    2.  [COLOR=red]TMOD = [/COLOR][COLOR=red]TMOD | [/COLOR][COLOR=red]0x21;[/COLOR]
    3. [COLOR=red]TMOD = [/COLOR][COLOR=red]TMOD & [/COLOR][COLOR=red]0x21;[/COLOR]
    4.  
     
Loading...