Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSComm Visual Basic LRC ?? 1

Status
Not open for further replies.

MGjaltema

IS-IT--Management
Nov 20, 2002
12
NL
Hello All,

I've a question. I'm using Visual Basic 6 to connect a PC to a payment terminal. I need to send info to the terminal using a serial connection. So i've used the MSComm control. Now I have a 'message' i need to send like <STX> 00 C1 00 <ETX> <LRC>, where <LRC> is a XOR of data + <ETX>. Can some one tell me how to do this...

I'm really stuck, so a little help is better then nothing...

Thanks !

 
If you're looking for the <STX> and <ETX> codes then try the standard ASCII codes (all listed here):

To do the XOR just loop through the data using XOR (assuming your data is in an array aryData):

For a = lbound(aryData) to Ubound(aryData)
LRC = LRC xor aryData(a)
Next
LRC = LRC xor 3 ' 3 is ASCII for ETX
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top