I am using Keil 2 to run a program (a servo driven robotic arm) for the 87C552, I downloaded an example for the PWM usage from Keil.com, in C which works grand, but the compiler does not recognise any PWM refernces in assemblly. Why is this ? Is there any way around it?
I mean if I run the C example in the compiler(as a *.c file) with the correct chip (83/87C552) selected in "device" Keil allows PWM references like a dream. But running assembly (as a *.a file) keil does not recognise PWM references at all Why is this?
If you mean that the assembler doesn't recognise the SFR names associated with PWM then you haven't included the appropriate include file for the device.
Um, hello? Assembly does not use includes. Assembly is where the problem is. not the C!
"Um, hello? Assembly does not use includes. Assembly is where the problem is. not the C!" I wonder what that 'INCLUDE' control does, and what all those files with the extension .inc do then?
"Assembly does not use includes." Looks like that's where you're going wrong, then: you should be using some includes - specifically, the includes that tell the Assembler about the PWM registers!
Let's try getting the terminlogoy straight, so that we can understand what you mean: "if I run the C example in the compiler(as a *.c file) ..." You cannot "run" a 'C' source file. You use a 'C' compiler to Compile the 'C' source file; ie, to translate it into an Object file. " ... Keil allows PWM references like a dream." Do you mean, the compilation completes without errors or warnings? Presumably, it also Links successfully? Does it actually run correctly in your target (or the simulator)? " ... running assembly (as a *.a file) ... " Again, you cannot "run" an assembly language source file. You use an Assembler to Assemble the assembly-language source file; ie, to translate it into an Object file. "keil does not recognise PWM references at all" Do you mean you get lots of errors and/or warnings? If so, why not post the text of those warnings?
Apologies for my lack of experience in programming grammar and terminology. What you specified in you last post is correct Here are the errors:
Build target 'Target 1' assembling test.a... test.a(20): error A45: UNDEFINED SYMBOL (PASS-2) test.a(56): error A45: UNDEFINED SYMBOL (PASS-2) test.a(60): error A45: UNDEFINED SYMBOL (PASS-2) test.a(61): error A45: UNDEFINED SYMBOL (PASS-2) test.a(62): error A45: UNDEFINED SYMBOL (PASS-2) test.a(63): error A45: UNDEFINED SYMBOL (PASS-2) test.a(64): error A45: UNDEFINED SYMBOL (PASS-2) test.a(193): error A45: UNDEFINED SYMBOL (PASS-2) test.a(197): error A45: UNDEFINED SYMBOL (PASS-2) test.a(201): error A45: UNDEFINED SYMBOL (PASS-2) test.a(205): error A45: UNDEFINED SYMBOL (PASS-2) test.a(209): error A45: UNDEFINED SYMBOL (PASS-2) test.a(213): error A45: UNDEFINED SYMBOL (PASS-2) test.a(217): error A45: UNDEFINED SYMBOL (PASS-2) test.a(221): error A45: UNDEFINED SYMBOL (PASS-2) test.a(225): error A45: UNDEFINED SYMBOL (PASS-2) test.a(229): error A45: UNDEFINED SYMBOL (PASS-2) test.a(266): error A45: UNDEFINED SYMBOL (PASS-2) test.a(280): error A45: UNDEFINED SYMBOL (PASS-2) test.a(307): error A45: UNDEFINED SYMBOL (PASS-2) test.a(309): error A45: UNDEFINED SYMBOL (PASS-2) test.a(314): error A45: UNDEFINED SYMBOL (PASS-2) test.a(316): error A45: UNDEFINED SYMBOL (PASS-2) test.a(340): error A45: UNDEFINED SYMBOL (PASS-2) test.a(343): error A45: UNDEFINED SYMBOL (PASS-2) test.a(346): error A45: UNDEFINED SYMBOL (PASS-2) test.a(349): error A45: UNDEFINED SYMBOL (PASS-2) test.a(352): error A45: UNDEFINED SYMBOL (PASS-2) test.a(355): error A45: UNDEFINED SYMBOL (PASS-2) test.a(358): error A45: UNDEFINED SYMBOL (PASS-2) test.a(361): error A45: UNDEFINED SYMBOL (PASS-2) test.a(364): error A45: UNDEFINED SYMBOL (PASS-2) test.a(367): error A45: UNDEFINED SYMBOL (PASS-2) Target not created
If I add an include into the code (reg51.h) more errors are generated on top of the others, here are the new ones:
Build target 'Target 1' assembling test.a... C:\KEIL\C51\INC\REG51.H(10): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(11): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(12): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(13): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(14): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(15): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(16): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(17): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(18): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(19): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(20): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(21): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(22): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(23): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(24): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(25): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(26): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(27): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(28): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(29): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(30): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(35): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(36): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(37): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(38): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(39): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(40): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(41): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(44): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(45): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(46): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(47): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(48): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(49): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(50): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(51): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(54): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(55): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(56): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(57): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(58): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(59): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(62): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(63): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(64): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(65): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(66): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(69): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(70): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(71): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(72): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(73): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(74): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(75): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(76): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(79): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(80): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(81): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(82): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(83): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(84): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(85): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL C:\KEIL\C51\INC\REG51.H(86): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
If I include reg552.h instead, I get only the second set of errors
C:\KEIL\C51\INC\REG552.H(10): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
test.a(367): error A45: UNDEFINED SYMBOL (PASS-2)
All signns point to you having fraternal twins in your .a51 code both the 'default' SFRdef and, when added the 552 SFRdef. I do not know about using the 'canned' versions, but I need to insert $NOMOD51 Before including my SFR definition file in .a51 modules. Try it Erik
"I need to insert $NOMOD51 Before including my SFR definition file in .a51 modules." The A51 Assembler has the standard 8051 registers & SFRs built-in. Therefore, you don't need an include file if all you use is those "standard" symbols. Obviously, if you then include a file which also defines those "built-in" symbols, you will get an error like "ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL!" The $NOMOD51 directive removes the built-in definitions: http://www.keil.com/support/man/docs/a51/a51_nomod51.htm Note that C51 does not predefine any SFRs.
Wow thanks guys I am using
$NOMOD51 $INCLUDE (REG552.H)
yeeha :D Big one to ya guys
know to see if I can remember how its supposed to run, I wrote some of it about 5 months ago! No problem, you commented it beautifully - right? Erik
Ummm, But of course.... :)