Merging DI to GI
Hello,
I am trying to make a record with 8 signaldis, which I want to split from an signalgi. In PLC code, I often make a word with handshakes and I assign values to the individual bits (e.g. handshake.%X0 := TRUE;).
Is it possible to do anything like this in the robot? I was thinking maybe you could use AliasIO (e.g. AliasIO BitInByte(Handshake,1), Handshake.X0;) but with no luck...
Tagged:
0
Comments
-
Are you wanting the record to be like 0,1,0,0,1,0,0,1? or to hold the actual value of the group?Lee Justice0
-
Did you took a look at "BitSet"/"BitClear" Instruction?
0 -
lemster68 said:Are you wanting the record to be like 0,1,0,0,1,0,0,1? or to hold the actual value of the group?Yes I want to split the signal without having 8 individual bits in the IO configuration.So for example the input Handskake should be an GI which holds the value 20, and then I want my record to hold the values [0,0,0,1,0,1,0,0].0
-
If you want to assign individual bitvalues with Set/Reset, then you will have to define them as individual DOutputs in the IO-config.Also with some clever named Constants, and a wrapper-routine, how much less readable isSetBit HANDSHAKE, X0;toSet Handshake.X0?
1 -
Here's a low tech start for parsing the GI to get discrete 1's & 0's [ in a string ]
VAR num nDataConversion;
VAR byte by_dataStorage;
VAR stringdig stBytes;nDataConversion:=gi_BitExtract;by_dataStorage:=nDataConversion;stBytes:=ByteToStr(by_dataStorage\Bin);0 -
For readability, you can use a RoutineFor example:
PROC Set_Handshake_X0()<br> BitSet ...<br>ENDPROC
PROC SetHandshakeX0()<br> BitSet ...<br>ENDPROC<br><br>OR<br><br>
0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings