S7 index bit

curlyandshemp

Lifetime Supporting Member
Join Date
Jul 2005
Location
Toronto
Posts
1,903
excuse the ignorance if this has been covered before, but I cannot find any past posts regarding the following code required in S7.

I need the equivalent of this Clgx rung to test an indexed bit into an input byte and output the result to the corresponding indexed bit in a Flag byte.

Thanks


simple_offset.jpg
 
Hello,

not really sure what you need, but did you search form for "tidbits"?

Regards
 
Do you mean something like this ?

bitbyte.JPG



Code:
FUNCTION FC 6 : VOID
TITLE =
VERSION : 0.1

VAR_INPUT
  bBit0 : BOOL ; 
  bBit1 : BOOL ; 
  bBit2 : BOOL ; 
  bBit3 : BOOL ; 
  bBit4 : BOOL ; 
  bBit5 : BOOL ; 
  bBit6 : BOOL ; 
  bBit7 : BOOL ; 
END_VAR
VAR_OUTPUT
  byByte : BYTE ; 
END_VAR
BEGIN
NETWORK
TITLE =combine 8 bits into 1 byte
	  L	 P##byByte; 
	  LAR1  ; 
	  A	 #bBit0; 
	  =	  [AR1,P#0.0]; 
	  A	 #bBit1; 
	  =	  [AR1,P#0.1]; 
	  A	 #bBit2; 
	  =	  [AR1,P#0.2]; 
	  A	 #bBit3; 
	  =	  [AR1,P#0.3]; 
	  A	 #bBit4; 
	  =	  [AR1,P#0.4]; 
	  A	 #bBit5; 
	  =	  [AR1,P#0.5]; 
	  A	 #bBit6; 
	  =	  [AR1,P#0.6]; 
	  A	 #bBit7; 
	  =	  [AR1,P#0.7]; 
	  SET   ; 
	  SAVE  ; 
END_FUNCTION
 

Similar Topics

Hi , I have a small problem with one of the integers that is storing a setting that is adjusted by an E700 HMI and stored in the programme. The...
Replies
0
Views
3,053
I have watched for many years how people come up with ways of finding the bit numbers of bits that are set. RSLogix5000 has a FBC which works and...
Replies
10
Views
10,651
hi everyone i need help with a bit shift application i am setting up on an assembly machine index table . i have a good understanding of the bsl...
Replies
3
Views
4,073
Hi everybody. I got some problems about how to perform this task Now, I got an FB where I have this code snippet that looks like: L P##DBD_134...
Replies
5
Views
1,128
I am using a function block that has a in/out parameter that is a structure. The structure has an array as one of the elements. I can index the...
Replies
1
Views
736
Back
Top Bottom