Re: Bitwise AND
From: Almon B. Strowger (strowger_at_NOSPAM.kook.com)
Date: 05/22/04
- Next message: Avinash: "RE: Which version of VB.net allows for creation of Pocket PC applications"
- Previous message: Arshad Mehmood: "Re: RTC on Pocket PC 2003"
- In reply to: Jonathan: "Bitwise AND"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 22 May 2004 00:05:18 -0700
Hi,
Try doing the AND after each add and see if it
works. Long is 64 bits. Integer is 32, so it is
probably a better choice. I'm not a VB.NET
person, but if your checksum really is supposed
to be that straightforward, the only thing I can
imagine that is happening is that you're causing
an overflow exception and that is what is causing
the problem. I THINK in VB.NET you can only
turn off overflow checking down to the source file
level (with a compiler switch) and not at the
statement level, but I'm not an expert. In any case,
if this is indeed the problem, my suggestion above
should prevent any overflow from happening.
Hope this helps...
Almon B. Strowger
KOOK Pocket Software
"Jonathan" <anonymous@discussions.microsoft.com> wrote in message
news:B65B751A-B4B8-4A73-85C8-73C5AE7C9703@microsoft.com...
> I am working on my application accept data through the serial port on the
PPC. I have a two byte checksum at the end of my data. I have added the sum
of all the preceeding characters but it never equals my check sum. I think
the problem is with the bitwise AND that I am uisng. This is because the
problem only occurs with the large packets of data. I did save the data and
imported into Excel. I found that it is good, but my comparisons are off. I
also know that the check sum is being calculated correctly on the PPC. The
character sum is off.
>
> I am using this code for the charsum:
>
> Dim CharSum as Long
> Dim CheckSum as Long
>
> ..................
>
> CharSum = CharSum And 65535
>
> if CharSum = CheckSum Then
> ..........
>
> I noticed in Vb.net there were several new types introduced. Is a Long a
16, 32, or 64 bit number? I know that a long with specific bits can be
defined, but I just used a plain Long. The number stored in CharSum could
easily reach 32 bits, or even 64. Am I using the wrong number types? Thanks
for the help.
- Next message: Avinash: "RE: Which version of VB.net allows for creation of Pocket PC applications"
- Previous message: Arshad Mehmood: "Re: RTC on Pocket PC 2003"
- In reply to: Jonathan: "Bitwise AND"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|