Merging DI to GI
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...
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
Paba ✭Did you took a look at "BitSet"/"BitClear" Instruction?
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?
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>
- 10.4K All Categories
- 5.3K RobotStudio
- 346 UpFeed
- 15 Tutorials
- 8 RobotApps
- 281 PowerPacs
- 404 RobotStudio S4
- 1.7K Developer Tools
- 238 ScreenMaker
- 2.6K Robot Controller
- 246 IRC5
- 36 OmniCore
- 6 RCS (Realistic Controller Simulation)
- 3 RobotStudio AR Viewer
- 691 RAPID Programming
- 14 Wizard Easy Programming
- 101 Collaborative Robots
- 3 Job listings