Binary

I know how to do it in S5, but cannot remember if you can point indirectly to databits, however, in S5 (probably work in S7/TIA then
L KF 0
T MW10
T MW12 // set the pointers to 0
L DB10.DBD20 //source double word
T MD 200 //transfer to bits
L DB10.DBW22 // load the destination word
T MW 204 // Transfer to bits
Loop:
DO MW10 // do means process indirectly the base of the word pointed to
L M0.0 // indirectly load the bit in temp double word
DO MW 12
T M0.0 transfer indirectly to the destination word

L MW10 // increment the pointers
L Kf 2
+F
T MW10
L MW12
L KF 1
+F
T MW12
L kF 16 //test for all 16 done
<F JC = loop // if not loop back
L MW 10
T DB10.DBW22 // update the destination word
BE
I'm a bit rusty on S7 but I think this would work it will is S7
 
As suggested by drbitboy, you could use lookup tables, here's an example using 2 lookups

decode.jpg
 
Last edited:

Similar Topics

Hi folks, I'm trying to parse a binary string on a Red Lion DA30D using a Raw UDP/IP input port. I've done this before with ASCII strings so I do...
Replies
38
Views
881
So here's my situation, I have been tasked with modifying the logic to mimic a button press in the PLC. I have two identical machines however one...
Replies
6
Views
518
Hello, I am trying to convert a incoming string that is in Binary format (See attachment) to a DINT. Any ideas? When I use the STOD command it...
Replies
6
Views
2,149
How can I read individual binary bits from a SLC500 within FTH SE? With the Tag Browser I can get to the Binary Files and get each Integer from...
Replies
5
Views
1,577
Guys, I have googled this for about an hour now and can't find what I am looking for. I need a module which will take 8 inputs, and convert this...
Replies
8
Views
2,684
Back
Top Bottom