First of all I think the method
CalcChksum
needs to appear above your
main
. Or you'll at least need to forward-declare it.
Other than that, calling
CalcChksum
like this;
unsigned char *ser = serNum;
checksum = CalcChksum(*ser,13);
Is incorrect,
CalcChksum
is declared like;
unsigned short CalcChksum(unsigned char *ptr, int bytecnt)
So the first parameter should be a
char*
, by putting as asterisk in front of
ser
you're de-referencing that from an
unsigned char *
to a
unsigned char
.
Change the call to
checksum = CalcChksum(ser,13);
Hope this helps,
Fredrik