Keil™, An ARM® Company

Discussion Forum

a problem with macro definition

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

DetailsMessage
Read-Only
Author
jason xu
Posted
10-Jul-2003 01:24
Toolset
C51
New! a problem with macro definition
#define FLASH_BASE 0x080000

#define RECORD_SIZE 32
#define RECORDS_PER_SECTOR (FLASH_SECTOR_SIZE / RECORD_SIZE)
#define MAX_RECORD_NUM 30135
#define MAX_RECORD_ADDR (MAX_RECORD_NUM * RECORD_SIZE + FLASH_BASE)

i found that MAX_RECORD_ADDR is 0x7B6E0 (the correct value is 0x16B6E0).

Why?????
Read-Only
Author
Stefan Duncanson
Posted
10-Jul-2003 03:11
Toolset
C51
New! RE: a problem with macro definition
Probably because 30135 and 32 are treated as 16 bit integers. Do this instead:

#define MAX_RECORD_NUM 30135L

Stefan
Read-Only
Author
Keil Support Intl.
Posted
10-Jul-2003 03:43
Toolset
C51
New! RE: a problem with macro definition
See also: http://www.keil.com/support/docs/225.htm
This explains why you get this results.

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