This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Will it erroneous ??

Hi,
I want to know whether below code will perform expected task or not ?

void test(unsigned char const xdata* buffer);

unsigned char magicString[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

void main(void) { unsigned char i;

while(1) { for(i=0; i<8; i++) { magicString[i] += 1; } test(magicString); }
}

void test(unsigned char const xdata* buffer) { unsigned char j;

for (j=8; j>0; j++) { send(*buffer++); // another function }
}

Will test() and send() function works ok ? Will send() will send all 8 byte of data of magicString or not ? is there any logic mistake ?

Thanks in advance ?

Parents
  • behavior is as sometime processor is getting reset as there is nothing in the code which will cause reset. But as i have seen that my idata is getting corrupted somehow with strange pattern every time, so Program Counter is reset to 0x00 (Reset Vector Address)... and strange thing is that it only due to above code snippet... i doubt for the microcontroller....but not confirmed... so i just raised a question that whether is there something wrong to the above piece of code ? Pointer arithmetic is not proper or casting ... ??

    Well, i am using a microcontroller with 256 byte internal data memory and 2K XRAM. i am using Large memory model which causes all local/global data stored in XRAM. Speed of uController may not cause this issue ....

Reply
  • behavior is as sometime processor is getting reset as there is nothing in the code which will cause reset. But as i have seen that my idata is getting corrupted somehow with strange pattern every time, so Program Counter is reset to 0x00 (Reset Vector Address)... and strange thing is that it only due to above code snippet... i doubt for the microcontroller....but not confirmed... so i just raised a question that whether is there something wrong to the above piece of code ? Pointer arithmetic is not proper or casting ... ??

    Well, i am using a microcontroller with 256 byte internal data memory and 2K XRAM. i am using Large memory model which causes all local/global data stored in XRAM. Speed of uController may not cause this issue ....

Children