Exact match. Not showing close matches.
'[TECH] MPLAB C32 Odd behavior'
Changed to [TECH] since it looks like your problems aren't C32-specific.
All sorts of strange things may be going on here; where are 'i' and
'Channel2Bfr' defined, and what are their types/attributes ? They're not in
your code snippet but would help in diagnosis.
Also, in LoadToBufferCirc(), you have the
if( Pointer >= BufferLen )
Pointer = 0x01;
line. This probably isn't intended behaviour; try something like
if ((Pointer - ChannelBfr) >= BufferLen)
Pointer = ChannelBfr;
You've also got ChannelBfr[Pointer] - that will write Data to some (seemingly
random) location in memory. Do a search for google for 'c pointer arithmetic'
or something similar; it looks like you're confusing pointers with indices.
Pointers are not integers (and ChannelBfr is not a hash :)
And if all that was correct, you'd only end up with the first entry of
ChannelBfr set anyway; Pointer is a non-static local variable, so every time
through the function (100 times called from main()) will just set the same
thing over and over.
Hope this helps.
Apologies, I've just had a better look at your code - telling you fibs I'm
afraid :) I've just noticed that Pointer is a long, not a long * as I first
thought - I read your code wrong, so please ignore. I can see that you'r
using the first element of Channel2Bfr as a current index. D'oh !
More... (looser matching)
- Last day of these posts
- In 2009
, 2010 only
- New search...