| ??? 06/05/02 09:04 Read: times |
#23934 - RE: 8051 vs microchip pic |
"Remember C is C. No matter what your target board is based on (PC,8051 or PIC)."
Well, yes and no: 'C' is 'C' - but to get anywhere with these sort of processors, you are going to need certain processor-specific to the standard language. Keil C51 provides extensions such as bit, sbit, sfr, the memory-space keywords data, xdata, etc, a pointer implementation to cope with the different memory spaces, etc, etc, etc... I'm sure all the other 8051-targetted compilers provide similar extensions. By careful design, you can isolate these compiler-dependencies; eg, #if defined( __C51__ ) // For Keil C51, use the m-space keyword extensions #define DATA data #define IDATA idata #define PDATA pdata #define XDATA xdata #else // For other compilers, remove the m-space keyword extensions #define DATA #define IDATA #define PDATA #define XDATA #endif and similarly for all the other extensions. |



