1 / 18

TK2633: MICROPROCESSOR & INTERFACING

TK2633: MICROPROCESSOR & INTERFACING. Programming Techniques. LOOPING. The programming technique used to instruct the MPU to repeat task. Continuous loop Conditional loop Repeat task until certain conditions are met. Some loop include indexing along with counter.

hugh
Download Presentation

TK2633: MICROPROCESSOR & INTERFACING

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. TK2633:MICROPROCESSOR & INTERFACING Programming Techniques Dr. Masri Ayob: TK2633

  2. LOOPING • The programming technique used to instruct the MPU to repeat task. • Continuous loop • Conditional loop • Repeat task until certain conditions are met. • Some loop include indexing along with counter. • Indexing: pointing or referencing objects with sequential numbers, i.e. data in memory are accessed by referencing to their memory locations. Dr. Masri Ayob: TK2633

  3. COUNTER • Counter. • Counter is constructed by loading a number to any register. • Then use INR or DCR to increment or decrement the number respectively. • Loop is used to update counter value and every iteration the number is inspected to check whether the number is at maximum or minimum. Dr. Masri Ayob: TK2633 Rajah 1

  4. BLOCK DATA TRANSFERS • In many systems, blocks of information are transferred from one place to another in the microprocessor’s memory. • Transferring Blocks of Bytes. • Transferring Blocks of Words. Dr. Masri Ayob: TK2633 Rajah 1

  5. BLOCK DATA TRANSFERS • Suppose that a block of 10 bytes of data, beginning at memory location 2080H, is transferred to a block of memory beginning at location 2090H. • The simplest method, is to use the LDA and STA instruction to transfer each byte. • Long program • A more efficient way to transfer a block of data uses the programmed-loop and counter. Dr. Masri Ayob: TK2633 Rajah 1

  6. Flowchart • Flowchart required to transfer a block of bytes from one area of memory to another . Dr. Masri Ayob: TK2633

  7. Transfer 10 bytes of data Dr. Masri Ayob: TK2633

  8. BLOCK DATA TRANSFERS • The program uses: • the HL register pair to indirectly address the source block of data. • The DE register pair to indirectly address the destination block. • Transfers use the MOV A,M instruction to load the accumulator from a source block memory location. • Next, the STAX D instruction stores the accumulator data into a destination block memory location. • The B register functions as a counter in this example. Dr. Masri Ayob: TK2633 Rajah 1

  9. BLOCK DATA TRANSFERS • Large- byte block transfer >256 (FF) bytes? • Program requires a register pair as the counter. • Example: • A block of bytes beginning at location 01OOH is transferred to a block beginning at location 2800H. • The length of this block is 300 (12CH) bytes. Dr. Masri Ayob: TK2633

  10. BLOCK DATA TRANSFERS Dr. Masri Ayob: TK2633

  11. Transferring Blocks of Words • In certain applications, 16-bit words of data must be transferred. Dr. Masri Ayob: TK2633

  12. Transferring Blocks of Words Main Program Dr. Masri Ayob: TK2633

  13. Transferring Blocks of Words Dr. Masri Ayob: TK2633

  14. BLOCK EXCHANGES • Block exchanges are similar to block transfers except that the data are taken from one block of memory and exchanged with the data in a second block of memory. • Their main application is in sorting character strings and numeric data. Dr. Masri Ayob: TK2633

  15. Byte Block Exchanges • Suppose that we must exchange the 80H bytes of memory beginning at location 2800H with the 80H bytes of memory beginning at location 2880H. Dr. Masri Ayob: TK2633

  16. Byte Block Exchanges Dr. Masri Ayob: TK2633

  17. Word Block Exchanges: Exercise • Suppose that we must exchange the 500H words of memory beginning at location 9000H with the 500H words of memory beginning at location 9100H. Dr. Masri Ayob: TK2633

  18. Thank youQ&A Dr. Masri Ayob: TK2633

More Related