Sonsivri

Electronics => General Electronics => Topic started by: sureshsharma2032 on July 01, 2010, 11:35:50 11:35



Title: Help Needed For AT89C2051
Post by: sureshsharma2032 on July 01, 2010, 11:35:50 11:35
Hi to all, I am a beginner in microcontrollers & c compiler programs. By a guided book of " Microcontoller Projects in C for 8051" . I am building my first project but I am having errors. I have attached all the files. I have compiled it in Keil uvision 3. Pls can anyone help me out to get the program working.

Any help would be really appreciated.

I am having this error in Keil :

Build target 'Target 1'
compiling LED Binary Counter.c...
LED BINARY COUNTER.C(1): warning C500: LICENSE ERROR (R208: RENEW LICENSE ID CODE (LIC))
LED BINARY COUNTER.C(29): warning C206: 'wait_a_sec': missing function-prototype
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
    SEGMENT: ?PR?WAIT_A_SECOND?LED_BINARY_COUNTER
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
    SYMBOL:  WAIT_A_SEC
    MODULE:  LED Binary Counter.obj (LED_BINARY_COUNTER)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL:  WAIT_A_SEC
    MODULE:  LED Binary Counter.obj (LED_BINARY_COUNTER)
    ADDRESS: 082EH
Program Size: data=11.0 xdata=0 code=87
creating hex file from "LED Binary Counter"...
"LED Binary Counter" - 0 Error(s), 5 Warning(s).


Title: Re: Help Needed For AT89C2051
Post by: zuisti on July 01, 2010, 12:10:52 12:10
Hi;
I don't working with Keil compilers, but as I see:

You have a function declared at begin:

/* Function to delay about a second */
void wait_a_second()
{
  unsigned int x;
  for(x=0;x<33000;x++);
}

and you try using this:
   wait_a_sec();              /*Wait about a second*/ 

This name-missing will be your problem I think.
Try it!

Cheers
zuisti


Title: Re: Help Needed For AT89C2051
Post by: chinninitin on July 05, 2010, 10:07:53 10:07
Hi,

It seems that there are two problems

1)  License problem that you have to reslove ;-)

2) Code: here is corrected code, you just made mistake in calling and declaring function name  ...sec() and ...second()

#include <AT892051.h>

/* Function to delay about a second */
void wait_a_sec()
{
  unsigned int x;
  for(x=0;x<33000;x++);
}

/* Start of main program */
main()
{
  int LED=1;                   /*initialize count to 1*/

  for( ; ; )                      /*Start of endless loop*/
  {
    P1=~LED;                   /*Invert and output*/
   LED++;                     /*Increment the count*/
   wait_a_sec();              /*Wait about a second*/
  }
}


Regards
Chinni


Title: Re: Help Needed For AT89C2051
Post by: rentau on July 06, 2010, 02:41:23 02:41
about evaluation, your using 2051, soo you shouldn't have any problem, as with 2k limit, re-install your kiel.