Checksum...
Archiver
Posts: 46,084
Hello Stampers,
How are you all today ?.
I have a query regarding a data checksum.
In the existing version of our data transfer setup, we do a checksum as
follows...
'_______________
checksum var byte
dataout var byte
for counter = 0 to 31 'get 32 bytes of data
get counter, dataout '
serout dataout 'send the data byte
checksum = checksum + dataout 'add to the checksum byte
next
serout checksum 'send the checksum byte
'______________
That works fine. But we are now sending data as ascii words and bytes, such
as,
serout dec wordofdata (or byteofdata)
I dont know how we can checksum this into a byte or word value. We are
receiving the data in VB6 on a pc.
Is there a simple answer ?
Cheers,
Chris Anderson
Western Australia
How are you all today ?.
I have a query regarding a data checksum.
In the existing version of our data transfer setup, we do a checksum as
follows...
'_______________
checksum var byte
dataout var byte
for counter = 0 to 31 'get 32 bytes of data
get counter, dataout '
serout dataout 'send the data byte
checksum = checksum + dataout 'add to the checksum byte
next
serout checksum 'send the checksum byte
'______________
That works fine. But we are now sending data as ascii words and bytes, such
as,
serout dec wordofdata (or byteofdata)
I dont know how we can checksum this into a byte or word value. We are
receiving the data in VB6 on a pc.
Is there a simple answer ?
Cheers,
Chris Anderson
Western Australia
Comments
Checksum VAR WORD
DataValue VAR WORD
FOR Counter = 0 to 3
DataValue = 1234
SEROUT ... [noparse][[/noparse]DEC DataValue]
CheckSum = CheckSum + DataValue
NEXT
SEROUT ...[noparse][[/noparse] DEC CheckSum]
The only problem with this approach is:
how do you know where numbers begin and end?
Putting a 'comma' between values is the
'normal' VB way of doing it, I suppose.
The point is, as long as your VB side
can re-generate the decimal value that
is going to be sent to it as a CheckSum,
this approach will work.
--- In basicstamps@yahoogroups.com, Chris Anderson <fuel@b...> wrote:
> Hello Stampers,
> How are you all today ?.
> I have a query regarding a data checksum.
>
> In the existing version of our data transfer setup, we do a
checksum as
> follows...
> '_______________
> checksum var byte
> dataout var byte
>
> for counter = 0 to 31 'get 32 bytes
of data
> get counter, dataout '
> serout dataout 'send the
data byte
> checksum = checksum + dataout 'add to the checksum byte
> next
> serout checksum 'send the
checksum byte
> '______________
> That works fine. But we are now sending data as ascii words and
bytes, such
> as,
>
> serout dec wordofdata (or byteofdata)
>
> I dont know how we can checksum this into a byte or word value. We
are
> receiving the data in VB6 on a pc.
>
> Is there a simple answer ?
>
> Cheers,
> Chris Anderson
> Western Australia
The only problem I can see (or am I looking at it the wrong way), is that if
I send the word value 12345 as a decimal, The checksum will store its 2 byte
value, but it actually sends 5 bytes out as ascii.
Then when the pc receives it, it will pick up 5 bytes of data.
Regards,
Chris
Original Message
From: "Allan Lane" <allan.lane@h...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, September 18, 2003 5:57 AM
Subject: [noparse][[/noparse]basicstamps] Re: Checksum...
> I believe you can do:
> Checksum VAR WORD
> DataValue VAR WORD
>
> FOR Counter = 0 to 3
> DataValue = 1234
>
> SEROUT ... [noparse][[/noparse]DEC DataValue]
> CheckSum = CheckSum + DataValue
> NEXT
> SEROUT ...[noparse][[/noparse] DEC CheckSum]
>
> The only problem with this approach is:
> how do you know where numbers begin and end?
> Putting a 'comma' between values is the
> 'normal' VB way of doing it, I suppose.
>
> The point is, as long as your VB side
> can re-generate the decimal value that
> is going to be sent to it as a CheckSum,
> this approach will work.
>
> --- In basicstamps@yahoogroups.com, Chris Anderson <fuel@b...> wrote:
> > Hello Stampers,
> > How are you all today ?.
> > I have a query regarding a data checksum.
> >
> > In the existing version of our data transfer setup, we do a
> checksum as
> > follows...
> > '_______________
> > checksum var byte
> > dataout var byte
> >
> > for counter = 0 to 31 'get 32 bytes
> of data
> > get counter, dataout '
> > serout dataout 'send the
> data byte
> > checksum = checksum + dataout 'add to the checksum byte
> > next
> > serout checksum 'send the
> checksum byte
> > '______________
> > That works fine. But we are now sending data as ascii words and
> bytes, such
> > as,
> >
> > serout dec wordofdata (or byteofdata)
> >
> > I dont know how we can checksum this into a byte or word value. We
> are
> > receiving the data in VB6 on a pc.
> >
> > Is there a simple answer ?
> >
> > Cheers,
> > Chris Anderson
> > Western Australia
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
value as a string, you can take it in and use the Val() function to
convert it. Of course, with variable-length values you know need some
kind of separating chacter that you can use to parse the data.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: Chris Anderson [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=zYmNp8y8xtAAuTR7BaXRDZpbHok1YsMUSXYF12C9cL9dQmAkaIFJxHAE5np18mpRiWErfWawBGQpQN5a]fuel@b...[/url
Sent: Wednesday, September 17, 2003 5:06 PM
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] Re: Checksum...
Cheers Allan,
The only problem I can see (or am I looking at it the wrong way), is
that if I send the word value 12345 as a decimal, The checksum will
store its 2 byte value, but it actually sends 5 bytes out as ascii. Then
when the pc receives it, it will pick up 5 bytes of data.
Regards,
Chris
Original Message
From: "Allan Lane" <allan.lane@h...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, September 18, 2003 5:57 AM
Subject: [noparse][[/noparse]basicstamps] Re: Checksum...
> I believe you can do:
> Checksum VAR WORD
> DataValue VAR WORD
>
> FOR Counter = 0 to 3
> DataValue = 1234
>
> SEROUT ... [noparse][[/noparse]DEC DataValue]
> CheckSum = CheckSum + DataValue
> NEXT
> SEROUT ...[noparse][[/noparse] DEC CheckSum]
>
> The only problem with this approach is:
> how do you know where numbers begin and end?
> Putting a 'comma' between values is the
> 'normal' VB way of doing it, I suppose.
>
> The point is, as long as your VB side
> can re-generate the decimal value that
> is going to be sent to it as a CheckSum,
> this approach will work.
>
> --- In basicstamps@yahoogroups.com, Chris Anderson <fuel@b...> wrote:
> > Hello Stampers,
> > How are you all today ?.
> > I have a query regarding a data checksum.
> >
> > In the existing version of our data transfer setup, we do a
> checksum as
> > follows...
> > '_______________
> > checksum var byte
> > dataout var byte
> >
> > for counter = 0 to 31 'get 32 bytes
> of data
> > get counter, dataout '
> > serout dataout 'send the
> data byte
> > checksum = checksum + dataout 'add to the checksum byte
> > next
> > serout checksum 'send the
> checksum byte
> > '______________
> > That works fine. But we are now sending data as ascii words and
> bytes, such
> > as,
> >
> > serout dec wordofdata (or byteofdata)
> >
> > I dont know how we can checksum this into a byte or word value. We
> are
> > receiving the data in VB6 on a pc.
> >
> > Is there a simple answer ?
> >
> > Cheers,
> > Chris Anderson
> > Western Australia
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
> and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
Briefly, What does the Val function actually do to the data received ?
Cheers,
Chris
Original Message
From: "Jon Williams" <jwilliams@p...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, September 18, 2003 6:22 AM
Subject: RE: [noparse][[/noparse]basicstamps] Re: Checksum...
> So long as your VB program understands that it is receiving the numeric
> value as a string, you can take it in and use the Val() function to
> convert it. Of course, with variable-length values you know need some
> kind of separating chacter that you can use to parse the data.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
>
Original Message
> From: Chris Anderson [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=LN72Msd0sGslFQ1BzTAlkMtzAP5hern4v7GZsO2ffMJRUt5bZ26sqx7WwQ5S43FuTNfRkQBuEYdbLVId]fuel@b...[/url
> Sent: Wednesday, September 17, 2003 5:06 PM
> To: basicstamps@yahoogroups.com
> Subject: Re: [noparse][[/noparse]basicstamps] Re: Checksum...
>
>
> Cheers Allan,
> The only problem I can see (or am I looking at it the wrong way), is
> that if I send the word value 12345 as a decimal, The checksum will
> store its 2 byte value, but it actually sends 5 bytes out as ascii. Then
> when the pc receives it, it will pick up 5 bytes of data.
>
> Regards,
> Chris
>
>
>
Original Message
> From: "Allan Lane" <allan.lane@h...>
> To: <basicstamps@yahoogroups.com>
> Sent: Thursday, September 18, 2003 5:57 AM
> Subject: [noparse][[/noparse]basicstamps] Re: Checksum...
>
>
> > I believe you can do:
> > Checksum VAR WORD
> > DataValue VAR WORD
> >
> > FOR Counter = 0 to 3
> > DataValue = 1234
> >
> > SEROUT ... [noparse][[/noparse]DEC DataValue]
> > CheckSum = CheckSum + DataValue
> > NEXT
> > SEROUT ...[noparse][[/noparse] DEC CheckSum]
> >
> > The only problem with this approach is:
> > how do you know where numbers begin and end?
> > Putting a 'comma' between values is the
> > 'normal' VB way of doing it, I suppose.
> >
> > The point is, as long as your VB side
> > can re-generate the decimal value that
> > is going to be sent to it as a CheckSum,
> > this approach will work.
> >
> > --- In basicstamps@yahoogroups.com, Chris Anderson <fuel@b...> wrote:
> > > Hello Stampers,
> > > How are you all today ?.
> > > I have a query regarding a data checksum.
> > >
> > > In the existing version of our data transfer setup, we do a
> > checksum as
> > > follows...
> > > '_______________
> > > checksum var byte
> > > dataout var byte
> > >
> > > for counter = 0 to 31 'get 32 bytes
> > of data
> > > get counter, dataout '
> > > serout dataout 'send the
> > data byte
> > > checksum = checksum + dataout 'add to the checksum byte
> > > next
> > > serout checksum 'send the
> > checksum byte
> > > '______________
> > > That works fine. But we are now sending data as ascii words and
> > bytes, such
> > > as,
> > >
> > > serout dec wordofdata (or byteofdata)
> > >
> > > I dont know how we can checksum this into a byte or word value. We
> > are
> > > receiving the data in VB6 on a pc.
> > >
> > > Is there a simple answer ?
> > >
> > > Cheers,
> > > Chris Anderson
> > > Western Australia
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the Subject
> > and
> Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p....
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
monitor your comm input string waiting for the terminating character
(the character that separates values. Everything ahead of that
character should be digits and you can apply use the Val function to
extract it.
So ... you may want to do somethng like this when sending data to the
PC:
SEROUT pin, baud, [noparse][[/noparse]DEC value, ", "]
What you can do is use your OnComm event to look at the last character
received to see if it is a comma.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: Chris Anderson [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=vd3tIq3mAmqyEZeblLRpLN2HrEL7YsaA6KnBM_vgjMKYwjEHaevDviYwAvLI2iyZV8ZWVjm_oAFQKmqghw]fuel@b...[/url
Sent: Wednesday, September 17, 2003 5:27 PM
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] Re: Checksum...
Hello Jon, and thanks,
Briefly, What does the Val function actually do to the data received ?
Cheers,
Chris
Original Message
From: "Jon Williams" <jwilliams@p...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, September 18, 2003 6:22 AM
Subject: RE: [noparse][[/noparse]basicstamps] Re: Checksum...
> So long as your VB program understands that it is receiving the
> numeric value as a string, you can take it in and use the Val()
> function to convert it. Of course, with variable-length values you
> know need some kind of separating chacter that you can use to parse
> the data.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
>
Original Message
> From: Chris Anderson [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=vd3tIq3mAmqyEZeblLRpLN2HrEL7YsaA6KnBM_vgjMKYwjEHaevDviYwAvLI2iyZV8ZWVjm_oAFQKmqghw]fuel@b...[/url
> Sent: Wednesday, September 17, 2003 5:06 PM
> To: basicstamps@yahoogroups.com
> Subject: Re: [noparse][[/noparse]basicstamps] Re: Checksum...
>
>
> Cheers Allan,
> The only problem I can see (or am I looking at it the wrong way), is
> that if I send the word value 12345 as a decimal, The checksum will
> store its 2 byte value, but it actually sends 5 bytes out as ascii.
> Then when the pc receives it, it will pick up 5 bytes of data.
>
> Regards,
> Chris
>
>
>
Original Message
> From: "Allan Lane" <allan.lane@h...>
> To: <basicstamps@yahoogroups.com>
> Sent: Thursday, September 18, 2003 5:57 AM
> Subject: [noparse][[/noparse]basicstamps] Re: Checksum...
>
>
> > I believe you can do:
> > Checksum VAR WORD
> > DataValue VAR WORD
> >
> > FOR Counter = 0 to 3
> > DataValue = 1234
> >
> > SEROUT ... [noparse][[/noparse]DEC DataValue]
> > CheckSum = CheckSum + DataValue
> > NEXT
> > SEROUT ...[noparse][[/noparse] DEC CheckSum]
> >
> > The only problem with this approach is:
> > how do you know where numbers begin and end?
> > Putting a 'comma' between values is the
> > 'normal' VB way of doing it, I suppose.
> >
> > The point is, as long as your VB side
> > can re-generate the decimal value that
> > is going to be sent to it as a CheckSum,
> > this approach will work.
> >
> > --- In basicstamps@yahoogroups.com, Chris Anderson <fuel@b...>
> > wrote:
> > > Hello Stampers,
> > > How are you all today ?.
> > > I have a query regarding a data checksum.
> > >
> > > In the existing version of our data transfer setup, we do a
> > checksum as
> > > follows...
> > > '_______________
> > > checksum var byte
> > > dataout var byte
> > >
> > > for counter = 0 to 31 'get 32 bytes
> > of data
> > > get counter, dataout '
> > > serout dataout 'send the
> > data byte
> > > checksum = checksum + dataout 'add to the checksum byte
> > > next
> > > serout checksum 'send the
> > checksum byte
> > > '______________
> > > That works fine. But we are now sending data as ascii words and
> > bytes, such
> > > as,
> > >
> > > serout dec wordofdata (or byteofdata)
> > >
> > > I dont know how we can checksum this into a byte or word value. We
> > are
> > > receiving the data in VB6 on a pc.
> > >
> > > Is there a simple answer ?
> > >
> > > Cheers,
> > > Chris Anderson
> > > Western Australia
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> > Subject and
> Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p....
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
> and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
We actually already send the comma's to create the csv file.
I think you are saying...
1- We send the data as "dec wordofdata",","
2- We checksum wordofdata at the stamp.
3- VB takes each value before a comma and converts it to a number.
4- We then use simple division of 65535 etc to end up with a word value for
the checksum.
Is that feasible ?
Regards,
Chris
Original Message
From: "Jon Williams" <jwilliams@p...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, September 18, 2003 6:32 AM
Subject: RE: [noparse][[/noparse]basicstamps] Re: Checksum...
> Val will convert string data into a number. What you'll have to do is
> monitor your comm input string waiting for the terminating character
> (the character that separates values. Everything ahead of that
> character should be digits and you can apply use the Val function to
> extract it.
>
> So ... you may want to do somethng like this when sending data to the
> PC:
>
> SEROUT pin, baud, [noparse][[/noparse]DEC value, ", "]
>
> What you can do is use your OnComm event to look at the last character
> received to see if it is a comma.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: Chris Anderson [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=GEl1cylLMK7YIh5Yhl8ytF5FK8-n7JbYhzhs8B0RqHCw_xEQKXKG7rv4ULkcY60IEg6OGYNB1EvRxzDeDQ]fuel@b...[/url
> Sent: Wednesday, September 17, 2003 5:27 PM
> To: basicstamps@yahoogroups.com
> Subject: Re: [noparse][[/noparse]basicstamps] Re: Checksum...
>
>
> Hello Jon, and thanks,
>
> Briefly, What does the Val function actually do to the data received ?
>
> Cheers,
> Chris
>
>
Original Message
> From: "Jon Williams" <jwilliams@p...>
> To: <basicstamps@yahoogroups.com>
> Sent: Thursday, September 18, 2003 6:22 AM
> Subject: RE: [noparse][[/noparse]basicstamps] Re: Checksum...
>
>
> > So long as your VB program understands that it is receiving the
> > numeric value as a string, you can take it in and use the Val()
> > function to convert it. Of course, with variable-length values you
> > know need some kind of separating chacter that you can use to parse
> > the data.
> >
> > -- Jon Williams
> > -- Applications Engineer, Parallax
> > -- Dallas Office
> >
> >
> >
> >
Original Message
> > From: Chris Anderson [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=GEl1cylLMK7YIh5Yhl8ytF5FK8-n7JbYhzhs8B0RqHCw_xEQKXKG7rv4ULkcY60IEg6OGYNB1EvRxzDeDQ]fuel@b...[/url
> > Sent: Wednesday, September 17, 2003 5:06 PM
> > To: basicstamps@yahoogroups.com
> > Subject: Re: [noparse][[/noparse]basicstamps] Re: Checksum...
> >
> >
> > Cheers Allan,
> > The only problem I can see (or am I looking at it the wrong way), is
> > that if I send the word value 12345 as a decimal, The checksum will
> > store its 2 byte value, but it actually sends 5 bytes out as ascii.
> > Then when the pc receives it, it will pick up 5 bytes of data.
> >
> > Regards,
> > Chris
> >
> >
> >
Original Message
> > From: "Allan Lane" <allan.lane@h...>
> > To: <basicstamps@yahoogroups.com>
> > Sent: Thursday, September 18, 2003 5:57 AM
> > Subject: [noparse][[/noparse]basicstamps] Re: Checksum...
> >
> >
> > > I believe you can do:
> > > Checksum VAR WORD
> > > DataValue VAR WORD
> > >
> > > FOR Counter = 0 to 3
> > > DataValue = 1234
> > >
> > > SEROUT ... [noparse][[/noparse]DEC DataValue]
> > > CheckSum = CheckSum + DataValue
> > > NEXT
> > > SEROUT ...[noparse][[/noparse] DEC CheckSum]
> > >
> > > The only problem with this approach is:
> > > how do you know where numbers begin and end?
> > > Putting a 'comma' between values is the
> > > 'normal' VB way of doing it, I suppose.
> > >
> > > The point is, as long as your VB side
> > > can re-generate the decimal value that
> > > is going to be sent to it as a CheckSum,
> > > this approach will work.
> > >
> > > --- In basicstamps@yahoogroups.com, Chris Anderson <fuel@b...>
> > > wrote:
> > > > Hello Stampers,
> > > > How are you all today ?.
> > > > I have a query regarding a data checksum.
> > > >
> > > > In the existing version of our data transfer setup, we do a
> > > checksum as
> > > > follows...
> > > > '_______________
> > > > checksum var byte
> > > > dataout var byte
> > > >
> > > > for counter = 0 to 31 'get 32 bytes
> > > of data
> > > > get counter, dataout '
> > > > serout dataout 'send the
> > > data byte
> > > > checksum = checksum + dataout 'add to the checksum byte
> > > > next
> > > > serout checksum 'send the
> > > checksum byte
> > > > '______________
> > > > That works fine. But we are now sending data as ascii words and
> > > bytes, such
> > > > as,
> > > >
> > > > serout dec wordofdata (or byteofdata)
> > > >
> > > > I dont know how we can checksum this into a byte or word value. We
> > > are
> > > > receiving the data in VB6 on a pc.
> > > >
> > > > Is there a simple answer ?
> > > >
> > > > Cheers,
> > > > Chris Anderson
> > > > Western Australia
> > >
> > >
> > > To UNSUBSCRIBE, just send mail to:
> > > basicstamps-unsubscribe@yahoogroups.com
> > > from the same email address that you subscribed. Text in the
> > > Subject and
> > Body of the message will be ignored.
> > >
> > >
> > > Your use of Yahoo! Groups is subject to
> > > http://docs.yahoo.com/info/terms/
> > >
> > >
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the Subject
> > and Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> > This message has been scanned by WebShield. Please report SPAM to
> > abuse@p....
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the Subject
> > and
> Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p....
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
you'll want to use the modulus operator. When you retrieve a data value
from the stream you can update your (VB) checksum value like this:
checkSum = (checkSum + newVal) Mod 256
If you use a word-sized checksum that the Mod value will be 65536.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: Chris Anderson [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=oP8GFYquypz-xF_jWe0NQ2Afe6z6TQJkpd4EhnyB5R2GOUgqmhhGZS7MKWDdpZYpx-YrjiFpIIousw]fuel@b...[/url
Sent: Wednesday, September 17, 2003 5:40 PM
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] Re: Checksum...
Cheers, Jon,
We actually already send the comma's to create the csv file.
I think you are saying...
1- We send the data as "dec wordofdata",","
2- We checksum wordofdata at the stamp.
3- VB takes each value before a comma and converts it to a number.
4- We then use simple division of 65535 etc to end up with a word value
for the checksum.
Is that feasible ?
Regards,
Chris
Original Message
From: "Jon Williams" <jwilliams@p...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, September 18, 2003 6:32 AM
Subject: RE: [noparse][[/noparse]basicstamps] Re: Checksum...
> Val will convert string data into a number. What you'll have to do is
> monitor your comm input string waiting for the terminating character
> (the character that separates values. Everything ahead of that
> character should be digits and you can apply use the Val function to
> extract it.
>
> So ... you may want to do somethng like this when sending data to the
> PC:
>
> SEROUT pin, baud, [noparse][[/noparse]DEC value, ", "]
>
> What you can do is use your OnComm event to look at the last character
> received to see if it is a comma.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: Chris Anderson [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=oP8GFYquypz-xF_jWe0NQ2Afe6z6TQJkpd4EhnyB5R2GOUgqmhhGZS7MKWDdpZYpx-YrjiFpIIousw]fuel@b...[/url
> Sent: Wednesday, September 17, 2003 5:27 PM
> To: basicstamps@yahoogroups.com
> Subject: Re: [noparse][[/noparse]basicstamps] Re: Checksum...
>
>
> Hello Jon, and thanks,
>
> Briefly, What does the Val function actually do to the data received ?
>
> Cheers,
> Chris
>
>
Original Message
> From: "Jon Williams" <jwilliams@p...>
> To: <basicstamps@yahoogroups.com>
> Sent: Thursday, September 18, 2003 6:22 AM
> Subject: RE: [noparse][[/noparse]basicstamps] Re: Checksum...
>
>
> > So long as your VB program understands that it is receiving the
> > numeric value as a string, you can take it in and use the Val()
> > function to convert it. Of course, with variable-length values you
> > know need some kind of separating chacter that you can use to parse
> > the data.
> >
> > -- Jon Williams
> > -- Applications Engineer, Parallax
> > -- Dallas Office
> >
> >
> >
> >
Original Message
> > From: Chris Anderson [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=oP8GFYquypz-xF_jWe0NQ2Afe6z6TQJkpd4EhnyB5R2GOUgqmhhGZS7MKWDdpZYpx-YrjiFpIIousw]fuel@b...[/url
> > Sent: Wednesday, September 17, 2003 5:06 PM
> > To: basicstamps@yahoogroups.com
> > Subject: Re: [noparse][[/noparse]basicstamps] Re: Checksum...
> >
> >
> > Cheers Allan,
> > The only problem I can see (or am I looking at it the wrong way), is
> > that if I send the word value 12345 as a decimal, The checksum will
> > store its 2 byte value, but it actually sends 5 bytes out as ascii.
> > Then when the pc receives it, it will pick up 5 bytes of data.
> >
> > Regards,
> > Chris
> >
> >
> >
Original Message
> > From: "Allan Lane" <allan.lane@h...>
> > To: <basicstamps@yahoogroups.com>
> > Sent: Thursday, September 18, 2003 5:57 AM
> > Subject: [noparse][[/noparse]basicstamps] Re: Checksum...
> >
> >
> > > I believe you can do:
> > > Checksum VAR WORD
> > > DataValue VAR WORD
> > >
> > > FOR Counter = 0 to 3
> > > DataValue = 1234
> > >
> > > SEROUT ... [noparse][[/noparse]DEC DataValue]
> > > CheckSum = CheckSum + DataValue
> > > NEXT
> > > SEROUT ...[noparse][[/noparse] DEC CheckSum]
> > >
> > > The only problem with this approach is:
> > > how do you know where numbers begin and end?
> > > Putting a 'comma' between values is the
> > > 'normal' VB way of doing it, I suppose.
> > >
> > > The point is, as long as your VB side
> > > can re-generate the decimal value that
> > > is going to be sent to it as a CheckSum,
> > > this approach will work.
> > >
> > > --- In basicstamps@yahoogroups.com, Chris Anderson <fuel@b...>
> > > wrote:
> > > > Hello Stampers,
> > > > How are you all today ?.
> > > > I have a query regarding a data checksum.
> > > >
> > > > In the existing version of our data transfer setup, we do a
> > > checksum as
> > > > follows...
> > > > '_______________
> > > > checksum var byte
> > > > dataout var byte
> > > >
> > > > for counter = 0 to 31 'get 32
bytes
> > > of data
> > > > get counter, dataout '
> > > > serout dataout 'send the
> > > data byte
> > > > checksum = checksum + dataout 'add to the checksum byte
> > > > next
> > > > serout checksum 'send the
> > > checksum byte
> > > > '______________
> > > > That works fine. But we are now sending data as ascii words and
> > > bytes, such
> > > > as,
> > > >
> > > > serout dec wordofdata (or byteofdata)
> > > >
> > > > I dont know how we can checksum this into a byte or word value.
> > > > We
> > > are
> > > > receiving the data in VB6 on a pc.
> > > >
> > > > Is there a simple answer ?
> > > >
> > > > Cheers,
> > > > Chris Anderson
> > > > Western Australia
> > >
> > >
> > > To UNSUBSCRIBE, just send mail to:
> > > basicstamps-unsubscribe@yahoogroups.com
> > > from the same email address that you subscribed. Text in the
> > > Subject and
> > Body of the message will be ignored.
> > >
> > >
> > > Your use of Yahoo! Groups is subject to
> > > http://docs.yahoo.com/info/terms/
> > >
> > >
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> > Subject and Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> > This message has been scanned by WebShield. Please report SPAM to
> > abuse@p....
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> > Subject and
> Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p....
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject
> and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
Cheers from sunny West Oz