Address analysis: ISTACK will provide a "STEP Address Counter (SAC)" and a "Relative STEP Address Counter (REL-SAC)". Convert the hexadecimal address to decimal and accurately locate the erroneous program statement based on the length of the data block (DB).
Common Error ID Interpretation:
NNN: Indicates a statement that the CPU cannot execute. The most common reason is that programmers used instructions that are not supported by this version of the CPU, or the program was damaged during transmission. In old systems, if the battery has been replaced, please be sure to download the program again to ensure its integrity.
TRAF: Transmission error. This usually occurs in accessing a data block (DB), such as attempting to read a non-existent DB, or accessing a data word (DW) that exceeds the defined length of the DB (e.g. the DB only has 10 words, but the program attempts to read the 11th word).
ZYK: Scan cycle timeout. The program execution time of S5-95U exceeds its watchdog time (default 300ms). The reason may be that the program contains a dead loop, or that too many interrupt/time drivers (OB3/OB13) are called within one cycle. The solution is to optimize the program or divide the long program into multiple program blocks (PB).
PEU: External I/O bus failure. When set to "PBUS J", if no external I/O bus is detected or the module on the bus does not match the configuration, the PLC will report this error and stop in STOP mode. Check the connection cable and terminal resistance of the IM 316/315 interface module.
SUF (S5-95U only): Replacement error. Usually, when calling a function block (FB), the actual parameters passed to FB do not match the parameter types defined by the called FB. For example, FB requires a KT type time constant, but you give an integer of KF type when calling it.
Step 3: Use BSTACK to track the program path
When dealing with runtime errors such as TRAF or SUF, BSATCK (block stack) is more effective than ISTACK. BSTACK records the nested path of program execution. Assuming ISTACK indicates that the error occurred in function block FB2, BSTACK will show you the complete chain of calling FB2: OB1->PB2->FB2. At the same time, it will also display which data block (DB) is open when calling FB2. This is crucial for troubleshooting errors such as' DB access out of bounds'.
In depth application of core functions and fault prediction
The S5-95U is equipped with many practical functions that even today seem quite useful, and mastering them can effectively predict and prevent system failures.
Real time response: interrupts and high-speed counters
Application scenario: A sensor signal is required to trigger an emergency stop, or an encoder pulse is needed for precise positioning.
Configuration: Interrupt inputs (I34.0-I34.3) and counter inputs (Counter A/B) need to be enabled in the OBI: and OBC: parameter blocks of DB1. For example, IP 0 indicates enabling I34.0 as a rising edge interrupt; CAP 500 indicates the activation of counter A, which generates an interrupt when the count reaches 500.
Fault prediction: The input frequency of the counter is strictly limited. The manual clearly states that when a programmer or OP (operation panel) is connected, the maximum frequency of counter A will decrease from 5kHz. The calculation formula is: frequency=1/[(0.5ms+additional interruption reaction time) * current count value]. If you find that high-speed counting always loses pulses, you should check if the human-machine interface is connected through the programmer interface and re evaluate the counting frequency.
Accuracy and efficiency of analog processing
Input processing (FB250): The onboard analog input range is 0-10V, with a resolution of 10 bits. Directly reading the original value (0-1024) is meaningless. FB250 must be called for scaling. For example, converting a 0-10V temperature sensor signal directly to an engineering value of 0.0-200.0 ° C.
Key parameter: KNKT is used to define channel types. For onboard input, KY=0.4 (unipolar) must be set. OGR and UGR define the upper and lower limits of the engineering values you want.
Optimize scanning cycle: By default, all analog inputs are read into the Process Image Area (PII), which increases the scanning cycle. In the OBA: parameter block of DB1, AI parameters can control the number of channels read into PII. For example, AI 4 indicates that the first four channels are cyclically read in. If your program does not require values for all channels every cycle, it is recommended to set this value to 0 and then perform a single read by setting EINZ=1 for FB250 when a channel needs to be read in the program, which can significantly improve CPU utilization.
Time sensitive application: Real time clock
Scenario: Scheduled start stop, accumulated equipment running time, event logging.
Key point: The positions of the clock data area and status word need to be defined in the CLP: parameter block of DB1. STW defines the position of the status word, and CLK defines the clock data area. For precise control, it is recommended to store the clock data area in a dedicated, power-off hold data block.