Hi Stefano,
the macros are evaluated / calculated at preprocess step.
To generate this file you must select the .c file and with the pop-up menu click on Preprocess.
I've created an example based on your code.
test.h
#define BUSCLOCK 20971520
#define TPM_PRESCALER 32 //assicurarsi che il registro TPM_SC sia configurato con prescaler a 32
#define TPM_CLOCK (BUSCLOCK/TPM_PRESCALER)
**********************
main.c
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
#include "test.h"
long test_long;
void main(void) {
EnableInterrupts;
/* include your code here */
test_long=TPM_CLOCK;
for(;;) {
__RESET_WATCHDOG(); /* feeds the dog */
} /* loop forever */
/* please make sure that you never leave main */
}
*********************
preprocess extract:
long test_long ;
void main ( void ) {
__asm CLI ; ;
test_long = ( 20971520 / 32 ) ;
for ( ; ; ) {
{ __asm sta _SRS . Byte ; } ;
}
}
Attached the example I used -> For S08QE128.
Regards
Pascal