Searching \ for '[TECH] MPLAB C32 Odd behavior' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/microchip/languages.htm?key=mplab
Search entire site for: 'MPLAB C32 Odd behavior'.

Exact match. Not showing close matches.
PICList Thread
'[TECH] MPLAB C32 Odd behavior'
2009\05\03@124206 by Peter Restall

flavicon
face

Hello Listas,

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.

Regards,

Pete Restall

2009\05\03@134004 by Peter Restall

flavicon
face

Listas,

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 !

Regards,

Pete Restall

More... (looser matching)
- Last day of these posts
- In 2009 , 2010 only
- Today
- New search...