Keil Logo Arm Logo

Sharing #defines and EQU statements

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

Details Message
Read-Only
Author
Phil Ouellette
Posted
27-Nov-2001 02:46 GMT
Toolset
C51
New! Sharing #defines and EQU statements
Does anyone know if there is a way to make a #define in 'C' visible to A51 code (or visa-versa)? I know how to make a header file in Hi-Tech C51 that will let 'C' and 'A51 definitions coexist, but can't figure out how to this with Keil.

In Hi-Tech's C51 compiler you can create a common ('C' and 'A51') header file like this:

; #define C_1 1
; #define C_2 2
; #define C_3 3

;#if (0)
ASSEM_1 EQU 1
ASSEM_2 EQU 2
ASSEM_3 EQU 3
;#endif

But when I try this in Keil it chokes on the ; before the #define.

Any ideas?
Read-Only
Author
Support Intl Keil
Posted
27-Nov-2001 07:38 GMT
Toolset
C51
New! RE: Sharing #defines and EQU statements
A51 Version 6 adds a C preprocessor to the assembler. Therefore it is possible to use #define statements also in the assembler language. If you have an older version of our tools you should consider to upgrade it.
Read-Only
Author
Leonhard Fuchs
Posted
27-Nov-2001 10:39 GMT
Toolset
C51
New! RE: Sharing #defines and EQU statements
$SET (WATCHDOG = 1)

$IF (WATCHDOG = 1)
  SRVWDT      ; SERVICE WATCHDOG
$ENDIF

if you do not write the line
$SET (WATCHDOG = 1)
you are able to pass the specific "variable" with the command line : SET(WATCHDOG=1). You can define different targets for example one with watchdog and an other without watchdog.

...Leo
Read-Only
Author
Marques Girardelli
Posted
30-Nov-2001 00:00 GMT
Toolset
C51
New! RE: Sharing #defines and EQU statements
Assuming you have version 6 or newer of A51/C51, just take the semi-colons out of your code example and it should assemble fine. The C preprocessor in A51 will process those lines.

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

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.