Google Answers Logo
View Question
 
Q: XORing bytes in NSBasic-CE ( No Answer,   2 Comments )
Question  
Subject: XORing bytes in NSBasic-CE
Category: Computers > Programming
Asked by: gummerson-ga
List Price: $100.00
Posted: 05 Jul 2004 18:57 PDT
Expires: 13 Jul 2004 21:39 PDT
Question ID: 370098
I have written an application in NSBasic for Palm which communicates
with a proprietry device using RS232.

I need to port this to an IPAQ and have purchased NSBasic-CE.

My problem is that there is no function to handle XORing of bytes to
calculate the BCC in the data strings, and NSBasic does not appear to
have such a library (there was one for the Palm version).

Is there a library available for this task, or BASIC code to do the
job, or another suggestion?

Request for Question Clarification by studboy-ga on 07 Jul 2004 07:54 PDT
Hi Gummerson-GA:

This BASIC code computes the BCC--let me know if this works for you:

http://www.pbcrypto.com/view.php?algorithm=crc16

Clarification of Question by gummerson-ga on 08 Jul 2004 17:45 PDT
Thanks for your reply- however ..............
 
This algorithm creates a "Cyclic CRC", not an "XOR BCC" and uses
direct "machine language" inserted inline in the basic code (
unfortunately therefore only suitable for an IBM type of PC for which
the algorithm was written).

Request for Question Clarification by mathtalk-ga on 13 Jul 2004 18:45 PDT
Hi, gummerson-ga:

Have you considered a simple (or not so simple) look-up array?

Probably some space can be saved at the expense of time (typical
trade-off).  Is such an approach of interest?  What is the limit of
memory you'd be willing to devote to such a look-up table?

regards, mathtalk-ga

Clarification of Question by gummerson-ga on 13 Jul 2004 21:35 PDT
Thank you for your suggestion, we have considered a look up table
however the application has to run in a PDA which would likely have
insufficient memory.
Answer  
There is no answer at this time.

Comments  
Subject: Re: XORing bytes in NSBasic-CE
From: crythias-ga on 05 Jul 2004 21:59 PDT
 
According to MATHWORLD http://mathworld.wolfram.com/XOR.html

A XOR B = (A AND NOT B) OR (NOT A AND B)
or
A XOR B = (A OR B) AND (NOT A OR NOT B)

But, this is an interesting quote:
http://www.nsbasic.com/palm/info/technotes/TN03.htm
3. Checksum

The NMEA 0183 Standard allows for an optional checksum. The checksum
is preceded by the asterisk (*) character placed after the last data
field. It is a two-character field equal to the hex value obtained by
XOR'ing all the character bytes of the sentence.

This is impossible to calculate (at least in any straightforward
manner) in NSBasic. I've had to do a lot of error checking and
validation of data as a workaround. George Henne says that bit
manipulation is also in the works.

-=-=-=-
I don't know for sure if the statement is accurate based upon the
information I've given you above, and I don't have NSBasic, so I don't
know if it will work for you. I am not a Google Answers Researcher.

Google Search: 
xor
nsbasic xor
Subject: Re: XORing bytes in NSBasic-CE
From: crythias-ga on 08 Jul 2004 18:15 PDT
 
gummerson-ga, Is there no possibility that using the AND/NOT/OR
formulas above will obtain your result, or do you not have those
functions as well?

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy