Technical Forum

STEP 7 Additional Software

SCL Logic

Thread Starter: Anshu Ganesan   Started: 8/29/2012 5:58 AM   Replies: 1

« Previous thread Next thread »
Page 1 of 1 (2 items)
  8/29/2012, 5:58 AM
Joined 12/14/2010
Last visit: 6/6/2013
Posts: 81
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 

Dear All,


Here i have four no of softbit as below

STYLE1:bool
STYLE2:bool
STYLE3:bool
STYLE4:bool

if i selected style-1 (status=true), remaining styles2,3,4 status are 0 suppose those any one styles status are 1.

if i selected style-2 (status=true), remaining styles1,3,4 status are 0 suppose those any one styles status are 1.

if i selected style-3 (status=true), remaining styles1,2,4 status are 0 suppose those any one styles status are 1.

if i selected style-4 (status=true), remaining styles1,2,3 status are 0 suppose those any one styles status are 1.


I Was tried but not working.logic as below


S1TEMP2:STYLE1 AND NOT S1TEMP1;
S1TEMP1:=STYLE1;


S2TEMP2:STYLE2 AND NOT S2TEMP1;
S2TEMP1:=STYLE2;


S3TEMP2:STYLE3 AND NOT S3TEMP1;
S3TEMP1:=STYLE3;


S4TEMP2:STYLE4 AND NOT S4TEMP1;
S4TEMP1:=STYLE4;


STYLE1:=NOT S2TEMP2 AND NOT S3TEMP2 AND NOT S4TEMP2;
STYLE2:=NOT S1TEMP2 AND NOT S3TEMP2 AND NOT S4TEMP2;
STYLE3:=NOT S1TEMP2 AND NOT S2TEMP2 AND NOT S4TEMP2;
STYLE4:=NOT S1TEMP2 AND NOT S2TEMP2 AND NOT S3TEMP2;


Kindly give us solution.




=== Edited by Ganesan_K @ 8/29/2012 6:01 AM [GMT ] ===



“Change will not come if we wait for some other person or some other time. We are the ones we have been waiting for. We are the change that we seek”
Top
  8/29/2012, 1:41 PM
Joined 10/31/2005
Last visit: 6/13/2013
Posts: 2107
Rating:
Rated: Excellent [4.08 out of 5 / rated 200 time(s)]. (200) 
Users with special expertise supervising conferences
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 

Example for 3rd bit

.....

CONST

 MASK_STYLE_3 := 2#00000100

....

Style := 1*BOOL_TO_INT(Style_1_bool) +  2*BOOL_TO_INT(Style_2_bool) + 4*BOOL_TO_INT(Style_3_bool) .....

.....

Style_3_selected := (Style =   MASK_STYLE_3); 

....

Top
Page 1 of 1 (2 items)
Actions