[?]: Convert 38bit bin-value to dec value

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Post Reply
Apollo11
Posts: 4
Joined: Thu May 06, 2010 6:46 pm

[?]: Convert 38bit bin-value to dec value

Post by Apollo11 » Tue Feb 08, 2011 10:50 am

Hi!
I have a problem how to convert a 38-bit binary value to a dec-value.

The PLC is a Siemens 400-cpu and have a 32-bit accumulator, so the solution must use 2 DoubleInteger variables to show the dec value.

Do anyone have a solution or tip how to solve this problem.

Who will be the first to solve my problem? (clap)

//Apollo11

Homeroid_BL
Posts: 252
Joined: Fri Apr 03, 2009 3:24 pm
Location: Bosnia and Herzegovina

Re: [?]: Convert 38bit bin-value to dec value

Post by Homeroid_BL » Tue Feb 08, 2011 7:04 pm

More precisely, please.
38-bit or 32-bit or 64-bit binary?

Apollo11
Posts: 4
Joined: Thu May 06, 2010 6:46 pm

Re: [?]: Convert 38bit bin-value to dec value

Post by Apollo11 » Wed Feb 09, 2011 8:53 am

A RFID-reader sends a serialnumber in 38-bit Binary-code this value should be converted to datatype=dec in the PLC-system.

In some way I need to find a solution who can work with bigger value than 32-bit.

Because the Siemens-system has only a 32-bit accumulator to work with.

dehell
Posts: 104
Joined: Sat Jun 13, 2009 12:25 pm
Location: Europe

Re: [?]: Convert 38bit bin-value to dec value

Post by dehell » Wed Feb 09, 2011 5:02 pm

Hi,
Could you explain how and where the data are send to the Siemens PLC?

Apollo11
Posts: 4
Joined: Thu May 06, 2010 6:46 pm

Re: [?]: Convert 38bit bin-value to dec value

Post by Apollo11 » Thu Feb 10, 2011 10:53 am

OK!
The RFID-reader sends the data over a Profibus-connection.
The data are 12-byte long in binary-code. In this data-area you can read out following data.
Binarycode from left to right.
Codetype = bit 1-8 bit (8-bit long) convert to 0-255 dec, no problem.
FilterType = bit 9-11 (3-bit long) convert to 0-7 dec, no problem.
PartionTable = bit 12-14 (3-bit long) convert to 0-7 dec, no problem.
CompanyPrefix = bit 15-28 (14-bit long) convert to 0-16384 dec, no problem.
SerialNo = bit 29-66 (38-bit long) this value is bigger than 32-bit and that is my problem because the PLC-system is built to handle max 32-bit each programaccess.

benthouse
Posts: 31
Joined: Tue Nov 06, 2007 3:48 pm
Location: Europe

Re: [?]: Convert 38bit bin-value to dec value

Post by benthouse » Sat Feb 26, 2011 5:31 pm

which type of RFID reader is used?
I'm looking for readers which can be conneced to Profibus-DP directly.

For me it's only necessary to identifiactie the RFID Taf (unique) number in a PLC program.

Waiting for your answer....

Regards,
Benthouse (fback)

Apollo11
Posts: 4
Joined: Thu May 06, 2010 6:46 pm

Re: [?]: Convert 38bit bin-value to dec value

Post by Apollo11 » Mon Mar 07, 2011 2:57 pm

Sorry for the late answer.
The RFID reader from a company called Vilant (www.vilant.com).
You need for now a gateway between the reader and your profibus-system.
Everything can be deliverd by Vilant.

//Apollo11

Coyote
Posts: 40
Joined: Wed Sep 06, 2006 10:07 am
Location: Slovenia

Re: [?]: Convert 38bit bin-value to dec value

Post by Coyote » Sun Mar 27, 2011 12:00 pm

Change the way of thinking, RFID key for sure doesn't use a CPU that is better than Siemens CPU4xx, so you can use more than one byte, dint, ... array of bits,..

dehell
Posts: 104
Joined: Sat Jun 13, 2009 12:25 pm
Location: Europe

Re: [?]: Convert 38bit bin-value to dec value

Post by dehell » Mon Mar 28, 2011 7:08 am

Hi,
Another way to solve your problem : use string (convert byte area into string)
Then, use SCL for programming with string , it is more easy...

Post Reply