I have the following code lines that worked well with SDCC compiler: data at 0x90 unsigned char motor1 = 0; // PORT 1 (90h) data at 0xB0 unsigned char motor2; // PORT 3 (B0h) But, when it does't compile with Keil. I'm trying to control a step motor by setting the values of these ports. How can I declare these variables in a way Keil compiles OK? Thank you.
data at 0x90 unsigned char motor1 = 0; // PORT 1 (90h) data at 0xB0 unsigned char motor2; // PORT 3 (B0h) just P1 = ??; No crummy "data at .." Erik
I don't want to include the reg51.h file im my code because I have space constraints, in that case, can I declare P1 as: sfr P1 = 0x90; Is that correct? Thank you.
"I don't want to include the reg51.h file im my code because I have space constraints..." reg51.h, or any other header file for that matter, unless improperly constructed, does not result in memory being allocated for any data or code objects it declares.
"the following code lines that worked well with SDCC compiler ... it does't compile with Keil" Of course it doesn't - that's because it's SDCC-specifc syntax; not Keil syntax. If you want to compile with Keil, you must use Keil syntax! "How can I declare these variables in a way Keil compiles OK?" Read the Manual! Do the tutorials.