Click to See Complete Forum and Search --> : wrong output !!!


karthigesh
February 10th, 2003, 10:18 PM
DEAR PARESH ,

its me again...
jus finished my presentation and realised that program is not working correctly...
i need to hand it up by thursday morning...

this is my problem :

there is this checksum function, it should output either a (FF) or (01) but it is giving an output like (5a)

please do check for on wat is wrong wif the part !!!


void CheckSum(byte[]cmd, int size)
{
int i;
byte sum = 0; for (i=0; i<size-2; i++)
{
sum = (byte)(sum + cmd[i]);
}

cmd[size-2] = (byte)(sum & 0xff); //LOBYTE(sum)
cmd[size-1] = (byte)(sum >>8); //HIBYTE(sum)

MessageBox.Show("CheckSum"+cmd[size-1].ToString());

}

------------------------------------------------------------------------------------
please help me edit if u think that there is any problem .....

thanking you in advance !


karthik...

pareshgh
February 10th, 2003, 10:33 PM
wait for a while. for which input its giving such results.
could you have some input values..

Paresh

karthigesh
February 10th, 2003, 10:47 PM
its giving this kind of irrelevant output lik (5a) or (aa)
where it is only supposed to show (ff) or (01) ...

anyway i have attached my whole project for u to view...

thanks again !

pareshgh
February 10th, 2003, 10:52 PM
I asked how are you invoking this function ? for what values.
for what input , you are expecting what output. if I know atleast that I would help you..


Paresh

karthigesh
February 11th, 2003, 12:23 AM
the input will come from the fingerprint detecting device...

is that what you were asking ?
did i answer ur question ?

pareshgh
February 11th, 2003, 12:26 AM
no.. if u r already passing byte and u have that info already then why do u need conversion..

what result u r expecting..

give me some actual value and result

Paresh

karthigesh
February 11th, 2003, 12:33 AM
it is only supposed to show (ff) or (01)

these (ff) and (01) are hexadecimal values...

anyway do u have a yahoo id ...

can i communicate wif u thru that ?

karthik...

pareshgh
February 11th, 2003, 01:01 PM
u r welcome..
pareshgh@yahoo.com