Spaceman1972

Hi,

Can anyone help please.

I work in a machine shop which has around 2000 tools. Each tool has an idendity chip on it. The manufacturer Balluff supplied some free software to read/write to the chips. I would lke to read/write the chips myself but when I read the chip with my software using comport I/O I dont get all the data. Also I have tried to decode the data using unicode and that doesn't seem to work either. I am having a bad day.

This is what the balluff software reads, the 4 digits on the right are the byte positions (I think).

0000 00 36 33 41 48 4B 39 39 39 39 31 30 30 30 31 58
0016 58 58 58 58 58 58 58 50 52 4F 42 45 00 00 00 00
0032 00 00 00 00 4D 2B 30 30 30 2E 30 30 30 2B 32 33
0048 33 2E 30 30 36 2B 30 30 36 2E 30 30 30 2B 30 30
0064 33 2E 30 30 30 2B 30 33 2E 30 30 30 2B 39 39 39
0080 39 2B 39 39 39 39 2B 30 30 31 30 58 58 32 30 30
0096 32 2F 30 39 2F 33 30 00 00 00 00 00 00 00 00 00
0112 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0128 58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0144 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0176 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0192 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0208 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0224 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0256 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0272 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0288 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0304 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0336 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0352 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0368 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0384 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0416 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0432 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0448 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0464 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0480 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

When the balluff software converts it to characters it gets this:

.63AHK999910001X
XXXXXXXPROBE....
....M+000.000+23
3.006+006.000+00
3.000+03.000+999
9+9999+0010XX200
2/09/30.........
................
X...............
................
................
................
................
................
................
................
................
................
................
................
................
................
................
................
................
................
................
................
................
................
................

When I read the chip using Vis 2005 Express, Comport read I get:

00 36 33 41 48 4B 39 39 39 39 31 30 30 30 31 58
58 58 58 58 58 58 58 50 52 4F 42 45 00 00 00 00
2D

It doesn't matter about the four digit line number at the start because that is the byte postions but why can't I read the whole of the chip data.

Also how do I decode the data into readable format

thanks

Mark



Re: Visual Basic Express Edition Hex Chip Data Into Readable String

Spaceman1972

Well i have found out the 2D is a check sum. How can I read the data after the check sum

thanks

Mark





Re: Visual Basic Express Edition Hex Chip Data Into Readable String

ReneeC

Spaceman,

Your problem is an interestingone - and a couple of things are still needed.

What interface are you using

We also need to know how you are attempting to do this. May we see your code






Re: Visual Basic Express Edition Hex Chip Data Into Readable String

Spaceman1972

Thanks for your intertest.

The data is stored on a 1cm disc which holds binary data. The reader is a box that transmits the data through the com port. I don't think the box is doing any calculations. Their website is http://www.balluff.com/Balluff/.

My code is here

Private Sub Receiver(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs) Handles COMPort.DataReceived
Dim RXByte, Nibble As Byte
Dim RXArray(3000) As Char
Dim I As Integer = 0
Do
RXByte = COMPort.ReadByte
Nibble = (RXByte >> 4) + 48
If Nibble > 57 Then
Nibble = Nibble + 7
End If
RXArray(I) = Chr(Nibble)
I = I + 1
Nibble = (RXByte And 15) + 48
If Nibble > 57 Then
Nibble = Nibble + 7
End If
RXArray(I) = Chr(Nibble)
I = I + 1
RXArray(I) = " "
I = I + 1

Loop Until (COMPort.BytesToRead = 0)
Me.BeginInvoke(New StringSubPointer(AddressOf Display), RxString)

Private Sub PortSelection(ByVal sender As Object, ByVal e As EventArgs) Handles COMPortsBox.SelectedIndexChanged
If COMPort.IsOpen Then
COMPort.RtsEnable = False
COMPort.DtrEnable = False
COMPort.Close()
Application.DoEvents()
Sleep(200)
End If
COMPort.PortName = COMPortsBox.Text
COMPort.BaudRate = 9600
COMPort.WriteTimeout = 2000
COMPort.StopBits = StopBits.One
COMPort.ReadBufferSize = 16384
Try
COMPort.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try
BaudRateBox.Text = COMPort.BaudRate.ToString
BitsBox.Text = COMPort.DataBits.ToString
ParityBox.Text = COMPort.Parity.ToString
FlowControlBox.Text = COMPort.Handshake.ToString
If COMPort.IsOpen Then
COMPort.RtsEnable = True
COMPort.DtrEnable = True
End If
End Sub

Thanks goes to Carsten Kanstrup for his example which has helped me greatly.

Any ideas

Cheers

Mark





Re: Visual Basic Express Edition Hex Chip Data Into Readable String

Carsten Kanstrup

It seems that the Balluff chip only transmits 32 bytes plus checksum at a time. You probably need to send some kind of command to get the next 32 bytes and so on, or you need to tell the chip how many bytes you want.

You probably need to contact Balluff to get the right transmission protocol. You also need this to be able to verify the checksum.





Re: Visual Basic Express Edition Hex Chip Data Into Readable String

Spaceman1972

Hi Carsten,

Thank you for your advice.

I discovered that the chip data uses a CRC16 check sum, I believe this is a standard check sum. Could you do anything with this

Thanks

Mark





Re: Visual Basic Express Edition Hex Chip Data Into Readable String

Carsten Kanstrup

Check it of course. This is what a CRC check is for. However, a CRC16 gives a 16-bit result (probably &H3CF8 in your case - not quite sure), so 2D cannot be a CRC16 check.





Re: Visual Basic Express Edition Hex Chip Data Into Readable String

Spaceman1972

Thanks for your help. I can now read the whole chip. It was because the hardware was only set to read 32 bytes.

The read routine I have converts the binary into hex. How can I convert it into ascii

thanks

Mark





Re: Visual Basic Express Edition Hex Chip Data Into Readable String

Carsten Kanstrup

Dim ASCIIChar As Char = Chr(RXByte).





Re: Visual Basic Express Edition Hex Chip Data Into Readable String

Spaceman1972

Sorry I dont want to sound stupid but where do I insert your code to convert the bytes read into ascii instead of hex. The code is above in my original answer.

Cheers

Mark





Re: Visual Basic Express Edition Hex Chip Data Into Readable String

Carsten Kanstrup

Just replace the hex conversion:

Nibble = (RXByte >> 4) + 48
If Nibble > 57 Then
Nibble = Nibble + 7
End If
RXArray(I) = Chr(Nibble)
I = I + 1
Nibble = (RXByte And 15) + 48
If Nibble > 57 Then
Nibble = Nibble + 7
End If
RXArray(I) = Chr(Nibble)
I = I + 1

with

RXArray(I) = Chr(RXByte)

I = I + 1





Re: Visual Basic Express Edition Hex Chip Data Into Readable String

Spaceman1972

Thank you Carsten, you have been very helpful as always.

Mark