Good morning
Is there a way to memcpy from SFR's in the C51?
I have tried to memcpy((char*)&buffer, (char*)&CAN0IF2DA1L, 8); but it doesn't work
Other things i tried
memcpy((char*)&buffer, CAN0IF2DA1L, 8); //error C214: illegal pointer conversion
memcpy((char*)&buffer, (char*)&CAN0IF2DA1L, 8); //error C189: '&' on bit/sfr illegal
Any ideas?
Richard
Are the registers even contiguous?
*p++ = CAN0IF2DA1L;*p++ = CAN0IF2DA1H;
...
given that SFR space isn't indirectly accessible, I guess the whole question is moot?
RichardT said:memcpy((char*)&buffer, (char*)&CAN0IF2DA1L, 8 );
and, as we're only talking 8 bytes anyhow, eight direct assignments is almost certainly going to be the quickest solution.
Unless the chip has some DMA tricks ...
But RichardT seems to have lost interest.
Andy Neil said:given that SFR space isn't indirectly accessible, I guess the whole question is moot?
Agreed
Andy Neil said:and, as we're only talking 8 bytes anyhow, eight direct assignments is almost certainly going to be the quickest solution.
Length is dynamic but in my case maximum of 8 bytes
Andy Neil said:Unless the chip has some DMA tricks ...
No tricks here
View all questions in Keil forum