.h in assemblym works beautifully as far as #define, sfr and sbit being useful in assembly. Now I have a case of conditional compile that I need reflected in an assembly module. I have tried to make the assembly IF and $IF work based on a #define. Using IF it works if I do a #define 1 or #define 0, that, however wil require replacing all #ifdefs in the C. $IF seems not to react to #define any suggestions? Erik
If you have recent versions of Keil assembler (older versions didn't work): You can write the same syntax of conditional expressions as in C, e.g. #if instead of "old" $IF In include file "numbers.h" (which is used by assembly and c modules) you define:
#define DEVELOP 2
#include <numbers.h> #if ( DEVELOP >= 1 ) MOV A,P3 MOV SBUF,A #else MOV var,#0 #endif
works like a champ, I wish it was documented. Thanx Erik
http://www.keil.com/support/man/docs/a51/a51_mp_c.htm
Oh, well, the same problem as with most other documentation. If you do not know which word to search on (I used a51 and conditional) you will get nowhere. This is not a problem specific to Keil, but why do you need to look something up if you know what it is. Erik
"If you do not know which word to search on (I used a51 and conditional) you will get nowhere." I would have thought that looking in the A51 manual chapter entitled 'Macro processor' subsection 'C preprocessor' was fairly obvious, really. Using 'a51' as a search term in the a51 manual also seems a bit daft. Or did it not occur to you to look in the manual?
I did, but after a few "page not found" I went global. as stated earlier, somehow my assembler manual got purloined. ): Erik
"as stated earlier, somehow my assembler manual got purloined" ...and the dog ate my homework. I find the online manuals quite easy to use as they are structured pretty well. Start from the main contents list and follow your nose.