I don't use structured text too much, but wanted to loop some items, so i thought i should try it. Got a hang up.
What i am trying to do is to check FIFO_ALM_RSLT_WORD array individual bits to see which one is set first, and copy some text and time values into a UDT Fifo and exit after first item is found.
How do i address bit level for looping? FIFO_ALM_RSLT_WORD[0].SUBSCRIPT, so i can check all bits. Would appreciate the help.
What i am trying to do is to check FIFO_ALM_RSLT_WORD array individual bits to see which one is set first, and copy some text and time values into a UDT Fifo and exit after first item is found.
How do i address bit level for looping? FIFO_ALM_RSLT_WORD[0].SUBSCRIPT, so i can check all bits. Would appreciate the help.
Code:
BMS1_ALM_LOG_NEW.YEAR := PLC_Year;
BMS1_ALM_LOG_NEW.MONTH := PLC_Month;
BMS1_ALM_LOG_NEW.DAY := PLC_Day;
BMS1_ALM_LOG_NEW.HOUR := PLC_Hour;
BMS1_ALM_LOG_NEW.MIN := PLC_Min;
BMS1_ALM_LOG_NEW.SEC := PLC_Second;
SUBSCRIPT0:=0;
SUBSCRIPT1:=0;
FOR SUBSCRIPT0:=0 to 31 by 1 do
IF FIFO_ALM_RSLT_WORD[0].SUBSCRIPT0 then
COP(FIFO_ALM_STRING_ARRAY[SUBSCRIPT0], BMS1_ALM_LOG_NEW.ALM, 1);
RET( );
END_IF;
END_FOR;
FOR SUBSCRIPT1:=0 to 31 by 1 do
IF FIFO_ALM_RSLT_WORD[1].SUBSCRIPT1 then
COP(FIFO_ALM_STRING_ARRAY[SUBSCRIPT1], BMS1_ALM_LOG_NEW.ALM, 1);
RET( );
END_IF;
END_FOR;
RET( );
Last edited: