Skip to main content
coor
Associate
April 24, 2003
Question

Help with optimization

  • April 24, 2003
  • 1 reply
  • 545 views
Posted on April 24, 2003 at 09:45

Help with optimization

This topic has been closed for replies.

1 reply

coor
coorAuthor
Associate
April 24, 2003
Posted on April 24, 2003 at 09:45

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.