cancel
Showing results for 
Search instead for 
Did you mean: 

Help with optimization

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

Help with optimization

1 REPLY 1
coor
Associate II
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.