SER FUNCTION BLOCK

The SER Function block will support up to16 SER cards. Additional blocks may be added if there are more than 16 cards.

For every SER module mounted in the PLC, a variable of the type SerCardDat is required. This variable is used to define all of the configuration parameters for the card. The SER block will use this information to download configuration data to the card and to retrieve event data from the card.

The SER block is also responsible for managing a common buffer into which events are placed. When an event buffer is ready to be read, the SER function block will turn on the BUF_RDY output indicating that data is ready. This output can either be polled by master computer and the data gathered when the SER block indicates a buffer is ready, or the output may be connected to a MSTR block which will automatically send the event data over Modbus Plus to a BM85E Bridge Mux, or a PC with a SA85 card. After the data has been collected, the BufAck input is used to tell the SER block to clear the buffer and to start collecting new event data.

The SER function block will also set the PLC time of day clock from the time in the SER card, or set the time in the SER card from the PLC time of day clock.

                      ____________________

                     |                    |

                     |      SER_X53       |

                     |                    |

              INT ---| PLC_NUM            |                   

              INT ---| DELAY              |                   

              INT ---| BUF_TYPE   BUF_RDY |--- BOOL            

             BOOL ---| BUF_ACK   EVENT_CT |--- INT            

             BOOL ---| SYNC_MTR    BUFFER |--- SER_BUFFER_DEF

             BOOL ---| CONFIG       ERROR |--- BOOL

             BOOL ---| SET_PLC      L_RDY |--- BOOL           

             BOOL ---| SET_SER      L_BUF |--- LOCAL_BUF_DEF           

     SER_CARD_DAT ---| CARD_1             |                   

                   : |                    |                   

     SER_CARD_DEF ---| CARD_16            |                    

                     |____________________|

 

 

 SER FUNCTION BLOCK INPUTS

PLC_NUM
The value of the PLC_NUM input is placed in the output buffer to indicate which PLC the buffer is from.

DELAY
The value of the Delay input is the number of 10mS intervals the block will wait from the last event until the BufRdy output is set true.

BUF_TYPE
The value of BUF_TYPE is used to determine the structure of the output buffer.  There are currently three different buffer types defined. The format of each buffer type is described in section 3.3 of this document.

BUF_ACK
A true value on the BUF_ACK input will clear the event buffer and set the BUF_RDY output false.

SYNC_MTR
A true value on the SYNC_MTR input will configure the first SER card as a time sync master.

CONFIG
A rising edge on the CONFIG input will download the configuration data to all of the cards.

SET_PLC
A rising edge on the SET_PLC input will set the PLC Time of Day clock from the first SER card.

SET_SER
A rising edge on the SET_SER input will set the first SER cards clock from the PLC Time of Day clock.

CARD_1 – CARD_16
The block will accept up to 16 card inputs, which expect a data type of the SerCardDat type.

TYPE

      SerCardDat: STRUCT

            Address0X:              INT;

            Address1X:              INT;

            Enable:                 BOOL;

            Config1:                BOOL;

            ConfigPor:              BOOL;

            FilterInput:            BOOL;

            BatteryEnable:          BOOL;

            Point:                  SerPoint;

TimeQuality:            INT;
      EventCount              INT;

            FirmwareVersion:        INT;

            CardError:              INT;

            SyncLock:               BOOL;

      END_STRUCT;

 

Address0X - Address of First 0x Input in I/O Map
The SERX53 function block must write the commands to the SER module through 0x registers. .  The number entered here is an offset from 0X0000.  Register 0X00001 is addressed  as 1.  Please note that the address entered here must match a 0x address as entered in the PLC's I/O map for the SER module.

Address1X - Address of First 1x Input in I/O Map
The SERX53 function block must read the values from the SER module through 1x inputs.  The number entered here is an offset from 1X0000.  Register 1X0001 is addressed as 1.  Please note that the address entered here must match a 1x address as entered in the PLC's I/O map for the SER module. 

Enable – SER Card Enable
A true value will enable event recording on the SER card. Any unused card inputs on the function block should have a card variable with this value set False.

Config1 – Configure All Points The Same As Point 1
For a FALSE value, all 32 points are configured with the parameters entered individually for every point.  However, if all 32 points operate with the same parameters, these parameters need to be entered only once for point 1.  For a TRUE value, the parameters for point 1 are used to configure all 32 points.

ConfigPor – Configure Card After Power On Reset
Since the SER module cannot preserve any parameterizations through a power cycle, all point parameters are reset to their default values after power is cycled.  If this value is TRUE, the function block will reconfigure the SER card after a Power On Reset.

FilterInput – Use Input Filter On 1X Registers
For a FALSE value, the 1X register input points will be passed to the processor immediately when they change.  For a TRUE value, the filter value for each point will be used to filter the 1X register inputs before they are passed to the processor.                        

BatteryEnable – Enable the Battery Backed Up Memory
For a FALSE value, the card firmware will not save event data when the card is powered down. For a TRUE value, the card firmware will retain old event data and generate a restart event when the card receives power. This is a future option that is not supported by the SER hardware at this time.                

Point – SER point Data
An array of variables of the PointData type which define the configuration of each input point.    

TYPE

                  PointDatat: STRUCT

                        Filter:                 UINT;

                        Debounce:               UINT;

                        Chatter:                BYTE;

                        OffScan:                BOOL;

                  END_STRUCT;

 

Filter – SER Card Input Filter
The purpose of the contact filter time is to eliminate false event messages caused by noise.  The filter time is the amount of time that a point must stay in a new state in order to be recognized as an event.  As an example, if the filter time for a point is set to 25 milliseconds, then when the input changes state it must remain in the new state for 25 milliseconds before and event message is generated.  If the input returns to the previous state in less than 25 milliseconds, the filter is reset and the next time the state changes it will again have to remain in that state for 25 milliseconds before an event message is generated.  The time that is associated with the event is the time at which the point first changed, not the time when the filter recognized the event.  If two input points that different input filter values were to change at the same time, the event messages would be generated at different times but the time that was contained in the event message would be identical.

Debounce – SER Card Input Debounce
The purpose of the contact debounce time is to prevent multiple events from being generated from a single contact closure.  The debounce time is the amount of time that input processing is disabled for a point after an event has been recorded

Chatter – SER Card Input Chatter
This parameter determines the maximum number of status changes allowed per minute before the point is taken off scan. Once a point is taken off scan, it will be put on scan again after being at least one minute below the chatter count.

OffScan – SER Point Scan State
If the offscan value is TRUE the SER card will not process SER data for that point.

 

 

TimeQuality – Current Time Quality – READ ONLY
This register contains the current quality of the SER time stamps. The values are as follows:

Value

Quality

0

Good, accuracy is GMT +/- 1ms

1

Fair, accuracy is GMT +/- 50ms

2

Poor, accuracy is GMT +/- 50ms or worse

3

Bad, no time reference available

EventCount– SER Card Event Count – READ ONLY
The number of events currently in the SER card buffer.

FirmwareVersion – Firmware Version of the SER Card – READ ONLY
This register contains the version of the firmware in the SER card.

CardError – Error Status of Card – READ ONLY
This register contains the SER Card error.  Its primary purpose is to aid debugging during the programming and testing of the program.  Whenever a bit is turned on, a certain error condition is present.

Bit

Error Condition

15

The 0x address entered in the function block is outside the valid 0x addresses as configured in the PLC's configuration.  For example, if the inputs 10001 through 10512 are configured, the highest valid 1x address would be 10449, since the SER module requires 64 1x inputs.

14

The 0x address entered in the function block is outside the valid 0x addresses as configured in the PLC's configuration.  For example, if the outputs 00001 through 01536 are configured, the highest valid 0x address would be 01473, since the SER module requires 64 0x outputs.

8

The Time of Day Clock must be configured.

 

SyncLock – Time Signal Synchronization – READ ONLY
This register contains the current sync status for the SER card. This bit follows the indication of the Red F light on the front of the SER module. For a TRUE value, the card is receiving time sync messages and the Red F light is off.  For a FALSE value, the card is not receiving time sync messages and the Red F light is on.

SER FUNCTION BLOCK OUTPUTS

BUF_RDY
The BUF_RDY output is set true when an event buffer is ready to be read.

EVENT_CT
The EVENT_CT output contains the number of events in the event buffer.

BUFFER
The BUFFER output expects a data type of the SerBuffer type which is defined as follows:

TYPE       

SerBuffer: STRUCT

            PlcNumber:              INT;

            BufferType:             INT;

NumberOfEvents:         INT;

            Nul1:                   INT;

            Nul2:                   INT;

            Nul3:                   INT;

            Nul4:                   INT;

            Nul5:                   INT;

            Nul6:                   INT;

            Version:                INT;

            Events:                 ARRAY [0..89] OF UINT;

      END_STRUCT;

 

ERROR
The ERROR output is set true when there is a configuration error. Refer to the CardError variable in each card definition structure for detailed error information.

L_RDY
The L_RDY output is set true for one scan cycle time when a new event is placed in the Local Buffer.

L_BUF
The L_BUF output expects a buffer of the LocalBuf type, which is defined as follows:

TYPE
      LocalBuf: STRUCT
            EventType:              INT;
            Card:                   INT;
            Point:                  INT;
            DateTime:               UDINT;
            Milliseconds:           INT;
            Quality:                INT:
            CurrentState:           BOOL;
      END_STRUCT;

The local buffer provides a second port for retrieving event data. The event data is only guaranteed to be valid for one scan cycle time.  This port is used by other function blocks that need access to event data.

 EVENT BUFFER STRUCTURE

The event buffer consists of two parts, the header and the buffer proper. The header is located in the first 10 registers. The first register contains the PLC identification, the second register contains the type of event buffer and the third register contains the number of events following. The tenth register contains the SER_x53 function block version number. The other six registers are presently unused.

EVENT BUFFER TYPE 0

The events are stored in an array of registers immediately following the header. The first event will be stored in registers 11 through 13, the second event in registers 14-16, and the nth event in registers (n-1)*3+10 through (n-1)*3+12. Up to 30 events can be stored in a single buffer. The three registers per event are used as follows:

Register

Bits

Usage

1

11-15

SER Card Identification (0..31) (from SER Card Function Block)

1

10

Current Status Value (0 or 1, from SER module)

1

5-9

Status Identifier (0..31, from SER module)

1

0-4

Event Type
1: Status Change
2: Point On Scan
3: Point Off Scan
4: Chatter On Scan
5: Chatter Off Scan
6: Power On Reset
7: External Time Sync Lock
8: External Time Sync Lost
9: SER Card Event Buffer Overflow (from SER module)
10: Scan Buffer Overflow
11: Time Resync Old Time
12: Time Resync New Time
13: Hourly Time Update   

                14: Time Resync New Date
15: Reconfigure  
16: Output Point Change
17: Restart Date
18: Restart Time                 

 

 

Events 1 – 12, 16, 18

2

10-15

Seconds (0..59, from SER module)

2

0-9

Milliseconds (0..999, from SER module)

 

 

Events 13 – 15, 17

2

9-13

Hour (0..23)

2

4-8

Day (1..31)

2

0-3

Month (1..12)

 

 

Events 1 – 12, 16, 18

 

14-15

Time Quality

3

8-12

Hours (0..23, from SER module)

3

0-5

Minutes (0..59, from SER module)

 

 

Events 13 – 15, 17

3

14-15

Time Quality

3

0-12

Year (0..4095)

 

Example:

┌────────┬──────────────────────┬────────────────────────────────────┐

│ Offset │ Value                │ Description                       

├────────┼──────────────────────┼────────────────────────────────────┤

    0        23               │ Message originated in PLC 23      

    1        x                │ unused                            

    2        2                │ Message contains two events       

    3        x                │ unused                            

    4        x                │ unused                            

    5        x                │ unused                            

    6        x                │ unused                            

    7        x                │ unused                             

    8        x                │ unused                            

    9        100              │ Loadable version 1.00             

├────────┼──────────────────────┼────────────────────────────────────┤

   10     15873 =             │ Identifier of first event         

          00111 1 10000 00001 │ SER card 7                        

                              Current status 1                  

                              Status point 16                   

                             Event type 1 (status change)      

   11     39228 =             │ Second/milliseconds of event      

          100110 0100111100   │ 38 seconds/316 milliseconds       

   12     4399 =              │ Hours/minutes of event            

          000 10001 00 101111 │ 17 hours/47 minutes               

                              => Status point 16 on SER card 7  

                                   of PLC 23 changed to value 1  

                                   at 17:47:38.316               

├────────┼──────────────────────┼────────────────────────────────────┤

   13     15873 =             │ Identifier of second event        

          00101 0 00000 01001 │ SER card 5                         

                              Current status not used           

                              Status point not used             

                              Event type 9 (SER buffer overflow) │

   14     39228 =             │ Second/milliseconds of event      

          100110 0101110010   │ 38 seconds/370 milliseconds       

   15     4399 =              │ Hours/minutes of event            

          000 10001 00 101111 │ 17 hours/47 minutes               

                              => Buffer overflow on SER card 5  

                                   of PLC 23 at 17:47:38.370     

└────────┴──────────────────────┴────────────────────────────────────┘

 

 EVENT BUFFER TYPE 1

The events are stored in an array of registers immediately following the header. The buffer will only contain a single event and each data value will be placed in a separate register.

 

Register

Usage

1

Event Type

2

Point

3

Current State

4

Card                      

5

Millisecond

6

Second

7

Minute

8

Hour

9

Day

10

Month

11

Year

12

Quality

 

EVENT BUFFER TYPE 2

The events are stored in an array of registers immediately following the header. Each event takes four registers. The first event will be stored in registers 11 through 14, the second event in registers 15-18, and the nth event in registers (n-1)*4+10 through (n-1)*4+13. Up to 22 events can be stored in a single buffer. The four registers per event are used as follows:

Register

Bits

Usage

1

11-15

SER Card Identification (0..31) (from SER Card Function Block)

1

10

Current Status Value (0 or 1, from SER module)

1

5-9

Status Identifier (0..31, from SER module)

1

0-4

Event Type
1: Status Change
2: Point On Scan
3: Point Off Scan
4: Chatter On Scan
5: Chatter Off Scan
6: Power On Reset
7: External Time Sync Lock
8: External Time Sync Lost
9: SER Card Event Buffer Overflow (from SER module)
10: Scan Buffer Overflow
11: Time Resync Old Time
12: Time Resync New Time
13: Hourly Time Update   

                14: Time Resync New Date
15: Reconfigure  
16: Output Point Change
17: Restart Date
18: Restart Time                 

2

0-9

Milliseconds (0..999, from SER module)

2

14-15

Time Quality

3

0-15

Date Time LSB (32 Bit Long Integer. Number of seconds since 1/1/1984)

4

0-15

Date Time MSB (32 Bit Long Integer. Number of seconds since 1/1/1984)