Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Moved] Errors in code written in Keil Uvision 3

Status
Not open for further replies.

mithun065285

Newbie level 1
Joined
Apr 29, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
india
Activity points
1,289
i hv written a program part of it i am showing below

Code:
#include<reg51.h>
#include<string.h>
sbit rs=p3^1;
sbit en=p3^0;
sbit rw=p3^2;
sbit b=p0^7;
sbit led1=p2^0;
sbit led2=p2^1;
sbit led3=p2^2;
sbit led4=p2^3;
sbit PWM=p2^4;
sbit RL1=p2^5;
sbit RL2=p2^6;


i got following error.pls help me out.

Code:
error C202: 'p3': undefined identifier
error C202: 'p0': undefined identifier
error C202: 'p2': undefined identifier
error C202: 'rs': undefined identifier
error C202: 'rw': undefined identifier
error C202: 'p0': undefined identifier
error C202: 'en': undefined identifier
error C202: 'PWM': undefined identifier
error C202: 'b': undefined identifier
error C202: 'led1': undefined identifier
error C202: 'led2': undefined identifier
error C202: 'led3': undefined identifier
error C202: 'led4': undefined identifier
error C202: 'RL1': undefined identifier
error C202: 'RL2': undefined identifier
Target not created
 
Last edited by a moderator:

keil uvision3 error

Port 1 should be written as P1 and not p1.

Use capital P

Nandhu
 
  • Like
Reactions: rkrish

    rkrish

    Points: 2
    Helpful Answer Positive Rating
Re: keil uvision3 error

Open the file reg51 to know how the port can be used.
 
  • Like
Reactions: rkrish

    rkrish

    Points: 2
    Helpful Answer Positive Rating
Re: keil uvision3 error

Open the file reg51 to know how the port can be used.

I hv written

Code:
#include <reg51x.h>
sbit led=P1^1;
sbit switch=P1^0;
void main()
{
	if(switch=1)
	{
		led=1;
	}
	else
	{
		led=0;
	}
}


Errors are,
Code:
led.c(8): error C202: 'led': undefined identifier
led.c(12): error C202: 'led': undefined identifier
Target not created

In main program, switch is in blue colour but led in black colour (ordinary colour)
 
Last edited by a moderator:

Re: keil uvision3 error

you cannot use sbit switch = P1^0 because switch is a reserved keyword used in switch case: statements. change switch to sw. Also change switch=1 to sw ==1

Maybe your licence has expired and you don't have reg51x.h on your system.

See if you are getting error reg51x.h file not found in the output window.

Try to change #include <reg51x.h> to #include <reg51.h> and see if that works.
 
Last edited:

Re: keil uvision3 error

you cannot use sbit change = P1^0 because change is a earmarked key phrase used in switch case: statements. alter switch the signal from sw. Furthermore modify switch=1 in order to sw ==1

Perhaps your licence has run out and also you don't possess reg51x.l on your method.

Find out if you are receiving problem reg51x.h record not really perfectly located at the end result window.

Try to change #include <reg51x.h> in order to #include <reg51.h> to see in the event that functions.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top