2003-04-24 12:45 AM
2003-04-24 12:45 AM
Help me to optimize on speed this function of copying from internal memory to external one:
char SRAM_WriteFromBufferToSRAM(unsigned long Addr,unsigned char *buffer, unsigned int count) { unsigned char *ptr; ptr = (unsigned long *)&Addr; PCDR = *(ptr+1) | 0x40; PBDR = *(ptr+2); PADR = *(ptr+3); PDDDR = 0xFF; // output mode do { PDDR = *buffer; buffer++; ClrBit(PCDR,6); // WE=0 SetBit(PCDR,6); // WE=1 asm { INC PADR JRNE loop INC PBDR JRNE loop INC PCDR loop: } } while (--count != 0); } //SRAM_WriteFromBufferToSRAM At present moment I have received the following results with this function: A time of copying one byte - 6us.