Hello. I am working on porting some code for the nRF24E1 from the SDCC compiler to the Keil compiler. I have the code compiling fine, but I had to comment out some inline assembly functions that are used for a time delay. Can anyone offer any suggestions on getting the inline assembly working properly? This code works fine in the SDCC compiler but I am having problems getting it to compile correctly in the Keil Compiler. The delay function is used for minimum time delays. Below is my code.
void Delay1us(unsigned char i) // n from 1 - 255 = n(us) + 4(us) Delay { // n = 0 = 256 + 4us = 260us Delay @ 16Mhz Clock // 16 Cycle Overhead and 4 Cycle Loop count = i; asm MOV R7, _count // Two Instruction Cycles @ 16MHz = 500nS LOOP: nop // One Instruction Cycle djnz R7, LOOP // Three Instruction Cycles @ 16Mhz = 750nS endasm; }
Below is my information about microVision and Keil compiler.
IDE-Version: µVision3 V3.72 Copyright (c) Keil Elektronik GmbH / Keil Software, Inc. 1995 - 2008
Tool Version Numbers: Toolchain: C51 Compiler/Assembler Kit Version: 8.17 Toolchain Path: C:\Keil\C51\BIN\ C Compiler: C51.Exe V8.17 Assembler: A51.Exe V8.01 Linker/Locator: BL51.Exe V6.15 Librarian: LIB51.Exe V4.24 Hex Converter: OH51.Exe V2.6 CPU DLL: S8051.DLL V3.64 Dialog DLL: DP51.DLL V2.53
Please let me know if anyone has any suggestions or comments. Thanks for your help.