On Sun, 2006-01-01 at 22:00 -0800, William Chops Westfield wrote: > On Jan 1, 2006, at 3:26 PM, Herbert Graf wrote: > > >> Try enabling "Integer Promotions" in the C18 > >> preferences and see if that helps. > > > > BINGO! > > Good. If this is an ip checksum routing, you were missing > the code that does the end-around carry folding in between > the loop at the complement... The code I included was only relavent to the problem I had. It is indeed an IP checksum routine, and after a little more debugging my packet sniffers show the correct checksum on the wire! Of course, then the next step was a UDP checksum routine. Spent some time trying to figure out why it wasn't working right, and then I discovered if you set it to 0x0000 machines recognize that as "no checksum"! :) > Also, while this is a sort of standard unix ip checksum > algorithm, it's a REALLY BAD algorithm to use on a CPU > that doesn't natively support 32bit integers. It dates > back to vaxen and 68000s, and is not good for PICs... > (alas, C is not so good for implementing the IP checksum > algorithm, because it doesn't give you access to the 'extra' > carry bit..) I was trying to think of a better way to do it, but in C alone I don't really see anything immensely better. I suppose I could inline an assembly routine, but I'd rather not spend the extra time for something I don't need. It's no matter, the app is more of a test bench then anything, and code size, speed and efficiency don't matter in the least, it just has to work. TTYL ----------------------------- Herbert's PIC Stuff: http://repatch.dyndns.org:8383/pic_stuff/ -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist