Discussion Forum

Having trouble starting a project

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Kenny Mangarella
Posted
10-Feb-2010 17:19 GMT
Toolset
C51
New! Having trouble starting a project

I start uVision3 and clicked 'New uVision Project' from the Project Menu. A 'Create New Project' window appears. I enter the name of the project (LEDTest) and clicked save. Then a "Select device for Target 1' window appeared. I then double-clicked on Atmel and chose the AT89C55WD as the device and I clicked OK. Then a window saying 'Copy Standard 8051 Startup Code to Project Folder and Add File To Project' appeared and I clicked yes. As soon as I did that, the Project Window displayed. On the 'Target 1' folder are 3 red dots which I know means there's something wrong. I haven't even written code yet and I'm having problems. Does anyone knows how to correct this problem?

Read-Only
Author
Tamir Michael
Posted
10-Feb-2010 17:22 GMT
Toolset
C51
New! RE: Having trouble starting a project

what makes you so sure there is something wrong? start writing your code, uVision is waiting!

Read-Only
Author
Kenny Mangarella
Posted
10-Feb-2010 18:01 GMT
Toolset
C51
New! RE: Having trouble starting a project

Tamir, I wrote some simple code to make an LED blink on and off. I tried to build it but I get 2 errors that to me don't make any sense. Here are the code and the error messages.

01 d: clr p3.1 ;Turn on LED
02 acall Delay ;Half second delay
03 setb p3.1 ;Turn off LED
04 acall Delay ;Half second delay
05 sjmp d ;Start over
06 Delay: mov r1,#255
07 b: mov r2,#255
08 e: djnz r2,e
09 djnz r1,b
10 ret
11 end

Build target 'Target 1'
assembling STARTUP.A51...
assembling LEDTest.a...
F:\LEDTest.a(7): error A8: ATTEMPT TO DEFINE AN ALREADY DEFINED LABEL
F:\LEDTest.a(9): error A46: CODE-ADDRESS EXPECTED
Target not created

Read-Only
Author
Andy Neil
Posted
10-Feb-2010 17:43 GMT
Toolset
None
New! 3 red dots which I know means there's something wrong

Who told you that?

That's not what they mean - see:
http://www.keil.com/support/man/docs/uv3/uv3_ca_filegrp_att.htm

Try starting from here: http://www.keil.com/support/man/docs/uv3/uv3_ex_hello.htm

Read-Only
Author
Kenny Mangarella
Posted
10-Feb-2010 18:20 GMT
Toolset
None
New! RE: 3 red dots which I know means there's something wrong

Andy thank you for that link. So those red dots represent a group of specific options. The color red usually represents a warning. So I assumed that 's what it was. Also I only purchased the A51 kit. So I can't use the 'Hello' project which is written in c language. I still can't see anything wrong with the code I wrote. It's just too simple not to work. I must be lousy at programming since I can't even get an LED to blink. Did you find out what is wrong with the code I wrote?

Read-Only
Author
Andy Neil
Posted
10-Feb-2010 18:59 GMT
Toolset
None
New! So I assumed...

That's the trouble: don't assume - find out for sure!

Writing software requires that you play precisely by the rules: the tools won't give you any leeway at all.
They will do precisely what you say in your source code - they will not attempt to work out what you meant

Therefore the first thing you must do is to study the manuals carefully - so that you know what the rules are!

"It's just too simple not to work"

No that is not true at all, I'm afraid.

Writing a "simple" program requires just as much care, attention, and precision as writing a complex one!

Speaking of care & attention, did you not notice the instructions on how to post source code?
They are clearly stated immediately above the window where you types your message...

http://www.danlhenry.com/caps/keil_code.png

" Did you find out what is wrong with the code I wrote?"

The Assembler told you two things that are wrong with it - so fix those first!

Your first step should be to look-up those error messages in the manual:
http://www.keil.com/support/man/docs/a51/a51_a8.htm
http://www.keil.com/support/man/docs/a51/a51_a46.htm

and be sure to see the linked knowledgebase articles...

Read-Only
Author
Kenny Mangarella
Posted
10-Feb-2010 18:56 GMT
Toolset
C51
New! RE: 3 red dots which I know means there's something wrong

I changed the label 'b' to an 'f' and the error mesages are gone. But 3 warnings poped up. here is the contents of the output window:

assebling LEDTest.a...
linking...
*** WARNING L5: CODE MEMORY SPACE OVERLAP FROM: 0000H TO: 0002H
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: ?C_START MODULE: STARTUP.obj (?C_STARTUP)
*** WARNING L2: REFERRENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ?C_START MODULE: STARTUP.obj (?C_STARTUP) ADDRESS: 001DH
Program Size: data=9.0 xdata=0 code=34
:LEDTest" - 0 Error(s), 3 Warning(s)

Read-Only
Author
Andy Neil
Posted
10-Feb-2010 19:01 GMT
Toolset
C51
New! I changed the label 'b' to an 'f' and the error mesages are gone.

You need to understand why - follow the links for the descriptions of the original error messages...

Read-Only
Author
Kenny Mangarella
Posted
10-Feb-2010 20:27 GMT
Toolset
C51
New! RE: I changed the label 'b' to an 'f' and the error mesages are gone.

I read the contents of the link file (LEDTest.lnk) and it shows zero errors and zero warnings. This is confusing. I compiled this program using an 8051 homemade compiler that I made using Visual Basic. I compared the Link file with HEX code and 2 addresses in the Link file had wrong data. I guess those are the addresses that are causing the problems.

Read-Only
Author
Kenny Mangarella
Posted
10-Feb-2010 22:24 GMT
Toolset
C51
New! RE: I changed the label 'b' to an 'f' and the error mesages are gone.

I finally found the problem. I tried removing the file STARTUP.A51 and the program compiled perfectly. I don't know why but there is something about that file that was causing the problem.

Read-Only
Author
Andy Neil
Posted
10-Feb-2010 22:39 GMT
Toolset
C51
New! I tried removing the file STARTUP.A51 and the program compiled perfectly

" I don't know why "

Because this is the startup code for a 'C' program; so it expects to have a 'C' program to jump into - but you haven't provided one!

Read-Only
Author
Kenny Mangarella
Posted
10-Feb-2010 23:36 GMT
Toolset
C51
New! RE: I tried removing the file STARTUP.A51 and the program compiled perfectly

That explains it. I'm such an idiot. I thought that since it had an A51 extension that it was assembly. Are there any other files that I could add to group 1 that would give me other features that I don't know about? Do I have to put an INCLUDE file at the beginning of my code or does uVision3 do it automatically since I selected a device when setting up the project? I have a lot to learn.

Read-Only
Author
Andy Neil
Posted
11-Feb-2010 00:08 GMT
Toolset
C51
New! I thought that since it had an A51 extension that it was assembly.

"I thought that since it had an A51 extension that it was assembly."

Yes, it is assembly - you can open it and look it at - and that is why it has the A51 extension.

But its specific function is to prepare the system to run a 'C' program, and then to call that 'C' program.

"Are there any other files that I could add to group 1 that would give me other features that I don't know about?"

If you add any random file to any group you will most probably get features that you don't know about!

"Do I have to put an INCLUDE file at the beginning of my code"

No, you don't have to - but it is usually a good way to proceed.

"does uVision3 do it automatically"

Not automatically - but it does give a menu item to make manually adding the "standard" processor include file a one-click operation!

"I selected a device when setting up the project"

That's how it knows which include file to offer in the menu option.
(also how it knew which startup file to offer).

"I have a lot to learn."

Indeed. And it would probably be a lot more effective if you were to take some time to sit down and do some study rather than just stumbling from error to error.

Next Thread | Thread List | Previous Thread Start a Thread | Settings