need help with programming

Status
Not open for further replies.

jakshay

New Member
hello//
i m working on the fowllowing program....



#include<reg52.h>
#include<math.h>
#include<stdio.h>
sbit ale =P2^4;
sbit oe=P2^5;
sbit sc=P2^6;
sbit eoc=P2^7;
sfr MYDATA = 0xB0;

void msdelay(unsigned int itime)
{
unsigned int i,j;
for(i=0;i<itime;i++)
for (j=0;j<1275;j++);
}
void display(unsigned int value)
{
if(value<=0x14)
P3=0x01;
else if(value<=0x46)
P3=0x03;
else if(value<=0x64)
P3=0x07;
else if(value<=0x82)
P3=0x0F;
else if(value<=0xa0)
P3=0x1F;
else if(value<=0xB4)
P3=0x3F;
else if(value<=0xdC)
P3=0x7F;
else
P3=0xFF;
}
void main(void)
{
unsigned char value;
MYDATA=0xff;
eoc=1;
ale=0;
oe=0;
sc=0;
while(1)
{
ale=1;
msdelay(1);
sc=1;
msdelay(1);
ale=0;
sc=0;
while(eoc==1);
while(eoc==0);
oe=0;
msdelay(1);
value=MYDATA;
oe=0;
display(value);
}
}



when trying to build target in keil....
i am getting the fowllowing errors/warnings.......

Build target 'Target 1'
assembling STARTUP.A51...
compiling hanuman.c...
linking...
*** WARNING L16: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS
NAME: VOIDMAIN/HANUMAN
*** ERROR L127: UNRESOLVED EXTERNAL SYMBOL
SYMBOL: MAIN
MODULE: D:\KEIL\C51\LIB\C51S.LIB (?C_INIT)
*** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: MAIN
MODULE: D:\KEIL\C51\LIB\C51S.LIB (?C_INIT)
ADDRESS: 10008C3H
Program Size: data=9.0 xdata=0 const=0 code=326
Target not created










will be very grateful if i get any lead....

thanx in advance


j.akshay
 
Not sure which device you're compiling this for, but I selected an AT89S52 and it compiled just fine for me w/o any errors
PS, you should really use code tags to make your code readable on the forum:
Code:
#include<reg52.h>
#include<math.h>
#include<stdio.h>
sbit ale =P2^4;
sbit oe=P2^5;
sbit sc=P2^6;
sbit eoc=P2^7;
sfr MYDATA = 0xB0;

void msdelay(unsigned int itime)
{
  unsigned int i,j;
  for(i=0;i<itime;i++)
  for (j=0;j<1275;j++);
}

void display(unsigned int value)
{
  if(value<=0x14)
    P3=0x01;
  else if(value<=0x46)
    P3=0x03;
  else if(value<=0x64)
    P3=0x07;
  else if(value<=0x82)
    P3=0x0F;
  else if(value<=0xa0)
    P3=0x1F;
  else if(value<=0xB4)
    P3=0x3F;
  else if(value<=0xdC)
    P3=0x7F;
  else
    P3=0xFF;
}

void main(void)
{
  unsigned char value;
  MYDATA=0xff;
  eoc=1;
  ale=0;
  oe=0;
  sc=0;
  while(1)
  {
    ale=1;
    msdelay(1);
    sc=1;
    msdelay(1);
    ale=0;
    sc=0;
    while(eoc==1);
    while(eoc==0);
    oe=0;
    msdelay(1);
    value=MYDATA;
    oe=0;
    display(value);
  }
}
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…