Inline Assembly: Keil vs CCS
C code is C code. The same C code will work in Keil or CCS with no modifications. The only issue is with inline assembly. Each IDE has its own syntax for handling inline assembly. Below is an example of how to write inline assembly for Keil and CCS.
KEIL CCS
__asm void Delay(unsigned long ulCount) {
subs r0, #1 bne Delay bx lr } |
void Delay(unsigned long ulCount)
{ __asm ( ” subs r0, #1\n” ” bne Delay\n” ” bx lr\n”); } |
NOTE: the CCS code requires the quotation marks with a new line character ‘\n’ at the end of each assembly line. This is a clever hack around to enable multiple lines to be written as one line. In essence KEIL allows straight inline assembly, where as in CCS you have to specify it as a string that will then be inserted. If you have to use Assembly in CCS I recommend having it in a separate file, inline assembly can be difficult to debug.