1 / 43

ECT 464

ECT 464. Lecture 26 Siemens Instructions 5. Today’s Quote: In order to receive the direction from God you must be able to receive the correction from God.

eve-whitney
Download Presentation

ECT 464

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECT 464 Lecture 26 Siemens Instructions 5

  2. Today’s Quote: In order to receive the direction from God you must be able to receive the correction from God. And you have forgotten that word of encouragement that addresses you as sons:    "My son, do not make light of the Lord's discipline,       and do not lose heart when he rebukes you,  because the Lord disciplines those he loves,       and he punishes everyone he accepts as a son." Hebrews 12:5-6

  3. Jump Instructions

  4. Jump Instructions The Jump to Label instruction (JMP) performs a branch to the specified label N within the program. The Label instruction (LBL) marks the location of the jump destination N. You can use the Jump instruction in the main program, in subroutines, or in interrupt routines. The Jump and its corresponding Label instruction must always be located within the same segment of code (either the main program, a subroutine, or an interrupt routine). You cannot jump from the main program to a label in either a subroutine or an interrupt routine. Likewise, you cannot jump from a subroutine or interrupt routine to a label outside that subroutine or interrupt routine. You can use a Jump instruction within an SCR segment, but the corresponding Label instruction must be located within the same SCR segment.

  5. Jump Example

  6. Sequence Control Relay

  7. Sequence Control Relay SCR instructions provide you with a simple yet powerful state control programming technique that fits naturally into a LAD, FBD, or STL program. Whenever your application consists of a sequence of operations that must be performed repetitively, SCRs can be used to structure your program so that it corresponds directly to your application. As a result, you can program and debug your application more quickly and easily. The Load SCR instruction (LSCR) loads the SCR and logic stacks with the value of the S bit referenced by the instruction N. The SCR segment is energized or de-energized by the resulting value of the SCR stack. The value of the SCR stack is copied to the top of the logic stack so that boxes or output coils can be tied directly to the left power rail without an intervening contact.

  8. Sequence Control Relay

  9. Shift and Rotate Instructions

  10. Shift and Rotate Instructions The Shift instructions shift the input value IN right or left by the shift count N and load the result in the output OUT. The Shift instructions fill with zeros as each bit is shifted out. If the shift count (N) is greater than or equal to the maximum allowed (8 for byte operations, 16 for word operations, and 32 for double word operations), the value is shifted the maximum number of times for the operation. If the shift count is greater than 0, the overflow memory bit (SM1.1) takes on the value of the last bit shifted out. The zero memory bit (SM1.0) is set if the result of the shift operation is zero. Byte operations are unsigned. For word and double word operations, the sign bit is shifted when you use signed data types.

  11. Shift and Rotate Instructions The Rotate instructions rotate the input value (IN) right or left by the shift count (N) and load the result in the memory location (OUT). The rotate is circular. If the shift count is greater than or equal to the maximum for the operation (8 for a byte operation, 16 for a word operation, or 32 for a double-word operation), the S7-200 performs a modulo operation on the shift count to obtain a valid shift count before the rotation is executed. This result is a shift count of 0 to 7 for byte operations, 0 to 15 for word operations, and 0 to 31 for double-word operations. If the shift count is 0, a rotate operation is not performed. If the rotate operation is performed, the value of the last bit rotated is copied to the overflow bit (SM1.1). If the shift count is not an integer multiple of 8 (for byte operations), 16 (for word operations), or 32 (for double-word operations), the last bit rotated out is copied to the overflow memory bit (SM1.1). The zero memory bit (SM1.0) is set when the value to be rotated is zero. Byte operations are unsigned. For word and double word operations, the sign bit is shifted when you use signed data types.

  12. Shift and Rotate Example

  13. Shift Register Bit

  14. Shift Register Bit The Shift Register Bit instruction shifts a value into the Shift Register. This instruction provides an easy method for sequencing and controlling product flow or data. Use this instruction to shift the entire register one bit, once per scan. The Shift Register Bit instruction shifts the value of DATA into the Shift Register. S_BIT specifies the least significant bit of the Shift Register. N specifies the length of the Shift Register and the direction of the shift (Shift Plus = N, Shift Minus = --N). Each bit shifted out by the SHRB instruction is placed in the overflow memory bit (SM1.1). This instruction is defined by both the least significant bit (S_BIT) and the number of bits specified by the length (N).

  15. Shift Register Bit

  16. Swap Bytes The Swap Bytes instruction exchanges the most significant byte with the least significant byte of the word IN.

  17. Swap Bytes The Swap Bytes instruction exchanges the most significant byte with the least significant byte of the word IN.

  18. String Instructions

  19. String Instructions String Length The String Length instruction (SLEN) returns the length of the string specified by IN. Copy String The Copy String instruction (SCPY) copies the string specified by IN to the string specified by OUT. Concatenate String The Concatenate String instruction (SCAT) appends the string specified by IN to the end of the string specified by OUT.

  20. String Example

  21. Substrings The Copy Substring from String instruction (SSCPY) copies the specified number of characters N from the string specified by IN, starting at the index INDX, to a new string specified by OUT.

  22. Substrings The Find String Within String instruction (SFND) searches for the first occurrence of the string IN2 within the string IN1. The search begins at the starting position specified by OUT. If a sequence of characters is found that matches exactly the string IN2, the position of the first character in the sequence for the string is written to OUT. If the string IN2 was not found in the string IN1, the instruction OUT is set to 0. The Find First Character Within String instruction (CFND) searches the string IN1 for the first occurrence of any character from the character set described in the string IN2. The search begins at starting position OUT. If a matching character is found, the position of the character is written to OUT. If no matching character is found, OUT is set to 0.

  23. Substrings

  24. Substrings

  25. Tables The Add To Table instruction adds word values (DATA) to a table (TBL). The first value of the table is the maximum table length (TL). The second value is the entry count (EC), which specifies the number of entries in the table. New data are added to the table after the last entry. Each time new data are added to the table, the entry count is incremented. A table can have up to 100 data entries.

  26. Tables

  27. FIFO’s and LIFO’s First-In-First-Out The First-In-First-Out instruction (FIFO) moves the oldest (or first) entry in a table to the output memory address by removing the first entry in the table (TBL) and moving the value to the location specified by DATA. All other entries of the table are shifted up one location. The entry count in the table is decremented for each instruction execution. Last-In-First-Out The Last-In-First-Out instruction (LIFO) moves the newest (or last) entry in the table to the output memory address by removing the last entry in the table (TBL) and moving the value to the location specified by DATA. The entry count in the table is decremented for each instruction execution.

  28. FIFO’s and LIFO’s

  29. Memory Fill The Memory Fill instruction (FILL) writes N consecutive words, beginning at address OUT, with the word value contained in address IN.

  30. Table Find The Table Find instruction (FND) searches a table for data that matches certain criteria. The Table Find instruction searches the table TBL, starting with the table entry INDX, for the data value or pattern PTN that matches the search criteria defined by CMD. The command parameter CMD is given a numeric value of 1 to 4 that corresponds to =, <>, <, and >, respectively. If a match is found, the INDX points to the matching entry in the table. To find the next matching entry, the INDX must be incremented before invoking the Table Find instruction again. If a match is not found, the INDX has a value equal to the entry count. A table can have up to 100 data entries. The data entries (area to be searched) are numbered from 0 to a maximum value of 99.

  31. Timer Instructions On-Delay Timer Retentive On-Delay Timer The On-Delay Timer (TON) and Retentive On-Delay Timer (TONR) instructions count time when the enabling input is on. The timer number (Txx) determines the resolution of the timer, and the resolution is now shown in the instruction box. Off-Delay Timer The Off-Delay Timer (TOF) is used to delay turning an output off for a fixed period of time after the input turns off. The timer number (Txx) determines the resolution of the timer, and the resolution is now shown in the instruction box.

  32. Timer Resolutions

  33. Timer Examples

  34. Timer Examples

  35. Timer Examples

  36. Timer Examples

  37. IEC Timer On-Delay Timer The On-Delay Timer (TON) instruction counts time when the enabling input is on. Off-Delay Timer The Off-Delay Timer (TOF) delays turning an output off for a fixed period of time after the input turns off. Pulse Timer The Pulse Timer (TP) generates pulses for a specific duration.

  38. IEC Timer

  39. Interval Timer

  40. Interval Timer Beginning Interval Time The Beginning Interval Time (BITIM) instruction reads the current value of the built-in 1 millisecond counter and stores the value in OUT. The maximum timed interval for a DWORD millisecond value is 2 raised to the 32 power or 49.7 days. Calculate Interval Time The Calculate Interval Time (CITIM) instruction calculates the time difference between the current time and the time provided in IN. The difference is stored in OUT. The maximum timed interval for a DWORD millisecond value is 2 raised to the 32 power or 49.7 days. CITIM automatically handles the one millisecond timer rollover that occurs within the maximum interval, depending on when the BITIM instruction was executed.

  41. Interval Timer

  42. Subroutines The Call Subroutine instruction (CALL) transfers control to the subroutine SBR_N. You can use a Call Subroutine instruction with or without parameters. After the subroutine completes its execution, control returns to the instruction that follows the Call Subroutine. The Conditional Return from Subroutine instruction (CRET) terminates the subroutine based upon the preceding logic.

  43. Subroutines

More Related