S7 cycling messages to a HMI?

uptown47

Lifetime Supporting Member
Join Date
Feb 2008
Location
Over there, next to those boxes
Posts
1,146
Hi

I'm trying to make messages cycle on a display.

My marker double word holding the messages is MD100.

If I have more than one bit of MD100 on I would like to show the corresponding message for 2 seconds and then move on to the next message.

For instance... MB103 equals ...00001011

Then I would like M103.0 to be on for 2 seconds, then M103.1 and then M103.3.

I have tried to make a (pathetic) start to an FB that will allow me to pass in the MD and give me the correct Marker bits as an output every 2 seconds but I've come to an ungraceful stop unfortunately.

Here's what I've got so far...

Code:
       L     1
      T     #MASK
M001: L     #MESSAGE_WORD_1
      L     #MASK
      AW    
      JP    MESS
      JU    M002
MESS: L     #MESSAGE_WORD_1
      LAR1  
// SOMEHOW TRANSMIT OUT OF THE BLOCK THE BIT THAT IS ON FOR 2 SECS
      L     #MESS_TIME
      SE    T     99
      NOP   0
      NOP   0
      NOP   0
      A     T     99
// = M #MESSAGE_WORD_1.BIT ??
M002: L     #MASK
      SLD   1
      T     #MASK
// SOMEHOW CHECK IF WE HAVE CHECKED EVERY BIT OF #MASK
      JU    M001

I wondered if anyone can point me in the right direction on how to go about this.

Many thanks

;-)
 
Here's one implementation tested using plcsim. Note that two separate MDs are required, one for the dwAlarmsActive and another for dwHMIAlarms. I used MD104 and MD100

Code:
FUNCTION_BLOCK FB 1
TITLE =
VERSION : 0.1

VAR_INPUT
  dwAlarmsActive : DWORD ; 
END_VAR
VAR_OUTPUT
  dwHMIAlarms : DWORD ;  
END_VAR
VAR
  sfb2secTimer : "TON"; 
  bEdgeStore : BOOL ; 
  bPulse : BOOL ; 
  iBitCount : INT ; 
END_VAR
VAR_TEMP
  dwAlarmsActiveT : DWORD ; 
  dwHMIT : DWORD ; 
END_VAR
BEGIN
NETWORK
TITLE =2 sec pulse
      AN    #sfb2secTimer.Q; 
      =     #sfb2secTimer.IN; 
      CALL #sfb2secTimer (
           PT                       := T#2S);
      A     #sfb2secTimer.Q; 
      FP    #bEdgeStore; 
      =     #bPulse; 
NETWORK
TITLE =scan alarms active and turn on 1 bit every 2 secs
      L     0; //any alarms active ?
      L     #dwAlarmsActive; 
      ==D   ; 
      JC    none; //if none then all bits off
      A     #bPulse; //2 sec pulse ?
      JCN   exit; //no then exit
      T     #dwAlarmsActiveT; //copy active alarms to temp
next: L     #iBitCount; //increment bit count
      +     1; 
      AW    W#16#1F; //limit to bits 0-31
      T     #iBitCount; 
      LAR1  P##dwAlarmsActiveT; //point to alarms active
      +AR1  ; //select bit
      A      [AR1,P#0.0]; //bit set ?
      JCN   next; //no index to next bit
      L     0; //else
      T     #dwHMIT; //0 result
      LAR1  P##dwHMIT; //select same bit in result
      L     #iBitCount; 
      +AR1  ; 
      S      [AR1,P#0.0]; //and set bit
      L     #dwHMIT; //copy temp to output
      JU    op; 
none: L     0; //no bits on so zero output
op:   T     #dwHMIAlarms; 
      JU    exit; 
exit: SET   ; 
      SAVE  ; 
END_FUNCTION_BLOCK
 
Thanks for that LD. I'm getting some errors when I try and compile it saying "Invalid declaration for symbol sfb2secTimer" and "Type conflict for TON".
Do I need a Special block in my software for TON or something? I notice that its 'calling' it from the code?

Many thanks for your sterling efforts.

;-)
 
You need SFB4 in your blocks folder, or replace "TON" with SFB4 in the source code.
 
Last edited:

Similar Topics

Hello everyone. I am working on designing a call light/alarm system I have roughly 20 stations that will each have their own call switch. Then...
Replies
20
Views
440
I'm working on a system with three Panelview 7's connected in a DLR. The system started having miscellaneous DLR faults and they were supposedly...
Replies
1
Views
486
In a data block, if the tag is ticked in the "Retain" column", is it meant to be retained after cycling the power to the PLC? I'm finding that...
Replies
2
Views
733
Hey everyone, I've tried the search function for similar issues but couldn't find any relevant info. Issue: I have a Controllogix 1756-L72/A...
Replies
4
Views
1,614
I made a small update to the PLC logic (GX developer). Then I wrote the updated code to the PLC (I did Online/write to PLC). I thought that would...
Replies
6
Views
1,521
Back
Top Bottom