1 / 26

ECT 464

ECT 464 . Lecture 23 Siemens Instructions 2. Today’s Quote: When confronted with a Goliath-sized problem, which way do you respond: “He’s too big to hit” or, like David, “He’s too big to miss.”

virgo
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 23 Siemens Instructions 2

  2. Today’s Quote: When confronted with a Goliath-sized problem, which way do you respond: “He’s too big to hit” or, like David, “He’s too big to miss.” The LORD who delivered me from the paw of the lion and the paw of the bear will deliver me from the hand of this Philistine."       Saul said to David, "Go, and the LORD be with you." 1 Samuel 17:37

  3. Comparison Instructions

  4. Comparison Instructions The compare instructions are used to compare two values: IN1 = IN2 EQU IN1 >= IN2 GRE IN1 <= IN2 LEQ IN1 > IN2 GRT IN1 < IN2 LES IN1 <> IN2 NEQ Compare Byte operations are unsigned. Compare Integer operations are signed. Compare Double Word operations are signed. Compare Real operations are signed.

  5. Comparison Example 1

  6. Comparison Example 2

  7. Compare String

  8. Compare String The Compare String instruction compares two strings of ASCII characters: IN1 = IN2 IN1 <> IN2 When the comparison is true, the Compare instruction turns the contact (LAD) or output (FBD) on, or the compare instruction Loads, ANDs or ORs a 1 with the value on the top of the stack (STL).

  9. Conversion Instructions

  10. Numerical Conversions The Byte to Integer (BTI), Integer to Byte (ITB), Integer to Double Integer (ITD), Double Integer to Integer (DTI), Double Integer to Real (DTR), BCD to Integer (BCDI) and Integer to BCD (IBCD) instructions convert an input value IN to the specified format and stores the output value in the memory location specified by OUT. For example, you can convert a double integer value to a real number. You can also convert between integer and BCD formats.

  11. Numerical Conversion Example

  12. Round & Truncate The Round instruction (ROUND) converts a real value IN to a double integer value and places the rounded result into the variable specified by OUT. The Truncate instruction (TRUNC) converts a real number IN into a double integer and places the whole-number portion of the result into the variable specified by OUT.

  13. Seven Segment The Segment instruction (SEG) allows you to generate a bit pattern that illuminates the segments of a seven-segment display.

  14. ASCII Conversion The ASCII to Hexadecimal instruction (ATH) converts a number LEN of ASCII characters, starting at IN, to hexadecimal digits starting at OUT. The Hexadecimal to ASCII instruction (HTA) converts the hexadecimal digits, starting with the input byte IN, to ASCII characters starting at OUT. The number of hexadecimal digits to be converted is specified by length LEN. The maximum number of ASCII characters or hexadecimal digits that can be converted is 255. Valid ASCII input Valid ASCII input characters are alphanumeric characters 0 to 9 with a hex code value of 30 to 39, and uppercase characters A to F with a hex code value of 41 to 46.

  15. ASCII Conversion

  16. ASCII Example 1

  17. ASCII Example 2

  18. ASCII Example 3

  19. String Conversion

  20. String Conversion Converting Numerical Values to String The Integer to String (ITS), Double Integer to String (DTS), and Real to String (RTS) instructions convert integers, double integers, or real number values (IN) to an ASCII string (OUT). Operation of the Integer to String The Integer to String instruction (ITS) converts an integer word IN to an ASCII string with a length of 8 characters. The format (FMT) specifies the conversion precision to the right of the decimal, and whether the decimal point is to be shown as a comma or a period. The resulting string is written to 9 consecutive bytes starting at OUT.

  21. String Conversion

  22. String Conversion The Substring to Integer (STI), Substring to Double Integer (STD), and Substring to Real (STR) instructions convert a string value IN, starting at the offset INDX, to an integer, double integer or real number value OUT.

  23. String Conversion Example

  24. Encoder and Decoder

  25. Encoder and Decoder Encode The Encode instruction (ENCO) writes the bit number of the least significant bit set of the input word IN into the least significant “nibble” (4 bits) of the output byte OUT. Decode The Decode instruction (DECO) sets the bit in the output word OUT that corresponds to the bit number represented by the least significant “nibble” (4 bits) of the input byte IN. All other bits of the output word are set to 0.

  26. Encoder and Decoder

More Related