GIÁO TRÌNH VI ĐIỀU KHIỂN part 9
Số trang: 20
Loại file: pdf
Dung lượng: 280.40 KB
Lượt xem: 15
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Tham khảo tài liệu giáo trình vi điều khiển part 9, công nghệ thông tin, hệ điều hành phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
GIÁO TRÌNH VI ĐIỀU KHIỂN part 9Giáo trình Vi điều khiển Phụ lục 4 – Mô tả tập lệnhThe first two operands allow four addressing mode combinations: the Accumulatormay be compared with any directly addressed byte or immediate data, and any indirectRAM location or working register can be compared with an immediate constant.Example: The Accumulator contains 34H. Register 7 contains 56H. The firstinstruction in the sequence, CJNE R7, # 60H, NOT_EQ ; . . . . . . . . ;R7 = 60H. NOT_EQ: JC REQ_LOW ;IF R7 < 60H. ; . . . . . . . . ;R7 > 60H.sets the carry flag and branches to the instruction at label NOT_EQ. By testing thecarry flag, this instruction determines whether R7 is greater or less than 60H.If the data being presented to Port 1 is also 34H, then the following instruction, WAIT: CJNE A, P1,WAITclears the carry flag and continues with the next instruction in sequence, since theAccumulator does equal the data read from P1. (If some other value was being inputon P1, the program loops at this point until the P1 data changes to 34H.) 7.1. CJNE A,direct,relBytes: 3Cycles: 2Encoding: 1 0 1 1 0 1 0 1 direct address relative addressOperation: (PC) ← (PC) + 3IF (A) < > (direct) THEN (PC) ← (PC) + relative offsetIF (A) < (direct) THEN (C) ← 1ELSE (C) ← 0 7.2. CJNE A,#data,relBytes: 3Cycles: 2Encoding: 1 0 1 1 0 1 0 0 immediate data relative addressOperation: (PC) ← (PC) + 3IF (A) < > data THEN (PC) ← (PC) + relative offsetIF (A) < data THEN (C) ← 1ELSE (C) ← 0 7.3. CJNE Rn,#data,relPhạm Hùng Kim Khánh Trang 201 Sưu t m b i: www.daihoc.com.vnGiáo trình Vi điều khiển Phụ lục 4 – Mô tả tập lệnhBytes: 3Cycles: 2Encoding: 1 0 1 1 1 r r r immediate data relative addressOperation: (PC) ← (PC) + 3IF (Rn) < > data THEN (PC) ← (PC) + relative offsetIF (Rn) < data THEN (C) ← 1ELSE (C) ← 0 7.4. CJNE @Ri,data,relBytes: 3Cycles: 2Encoding: 1 0 1 1 0 1 1 i immediate data relative addressOperation: (PC) ← (PC) + 3IF ((Ri)) < > data THEN (PC) ← (PC) + relative offsetIF ((Ri)) < data THEN (C) ← 1ELSE (C) ← 0 8. CLR AFunction: Clear AccumulatorDescription: CLR A clears the Accumulator (all bits set to 0). No flags are affectedExample: The Accumulator contains 5CH (01011100B). The following instruction, CLR Aleaves the Accumulator set to 00H (00000000B).Bytes: 1Cycles: 1Encoding: 11100100Operation: CLR(A) ← 0 9. CLR bitFunction: Clear bitDescription: CLR bit clears the indicated bit (reset to 0). No other flags are affected.CLR can operate on the carry flag or any directly addressable bit.Phạm Hùng Kim Khánh Trang 202 Sưu t m b i: www.daihoc.com.vnGiáo trình Vi điều khiển Phụ lục 4 – Mô tả tập lệnhExample: Port 1 has previously been written with 5DH (01011101B). The followinginstruction, CLR P1.2leaves the port set to 59H (01011001B). 9.1. CLR CBytes: 1Cycles: 1Encoding: 11000011Operation: CLR(C) ← 0 9.2. CLR bitBytes: 2Cycles: 1Encoding: 1 1 0 0 0 0 1 0 bit addressOperation: CLR(bit) ← 0 10. CPL AFunction: Complement AccumulatorDescription: CPLA logically complements each bit of the Accumulator (one’scomplement). Bits which previously contained a 1 are changed to a 0 and vice-versa.No flags are affected.Example: The Accumulator contains 5CH (01011100B). The following instruction, CPL Aleaves the Accumulator set to 0A3H (10100011B).Bytes: 1Cycles: 1Encoding: 11110100Operation: CPL(A) ← NOT (A) 11. CPL bitFunction: Complement bitDescription: CPL bit complements the bit variable specified. A bit that had been a 1is changed to 0 and vice-versa. No other flags are affected. CLR can operate on thecarry or any directly addressable bit.Note: When this instruction is used to modify an output pin, the value used as theoriginal data is read from the output data latch, not the input pin.Phạm Hùng Kim Khánh Trang 203 Sưu t m b i: www.daihoc.com.vnGiáo trình Vi điều khiển Phụ lục 4 – Mô tả tập lệnhExample: Port 1 has previously been written with 5BH (01011101B). The followinginstruction sequence, CPL P1.1 CPL P1.2leaves the port set to 5BH (01011011B). 11.1. CPL CBytes: 1Cycle ...
Nội dung trích xuất từ tài liệu:
GIÁO TRÌNH VI ĐIỀU KHIỂN part 9Giáo trình Vi điều khiển Phụ lục 4 – Mô tả tập lệnhThe first two operands allow four addressing mode combinations: the Accumulatormay be compared with any directly addressed byte or immediate data, and any indirectRAM location or working register can be compared with an immediate constant.Example: The Accumulator contains 34H. Register 7 contains 56H. The firstinstruction in the sequence, CJNE R7, # 60H, NOT_EQ ; . . . . . . . . ;R7 = 60H. NOT_EQ: JC REQ_LOW ;IF R7 < 60H. ; . . . . . . . . ;R7 > 60H.sets the carry flag and branches to the instruction at label NOT_EQ. By testing thecarry flag, this instruction determines whether R7 is greater or less than 60H.If the data being presented to Port 1 is also 34H, then the following instruction, WAIT: CJNE A, P1,WAITclears the carry flag and continues with the next instruction in sequence, since theAccumulator does equal the data read from P1. (If some other value was being inputon P1, the program loops at this point until the P1 data changes to 34H.) 7.1. CJNE A,direct,relBytes: 3Cycles: 2Encoding: 1 0 1 1 0 1 0 1 direct address relative addressOperation: (PC) ← (PC) + 3IF (A) < > (direct) THEN (PC) ← (PC) + relative offsetIF (A) < (direct) THEN (C) ← 1ELSE (C) ← 0 7.2. CJNE A,#data,relBytes: 3Cycles: 2Encoding: 1 0 1 1 0 1 0 0 immediate data relative addressOperation: (PC) ← (PC) + 3IF (A) < > data THEN (PC) ← (PC) + relative offsetIF (A) < data THEN (C) ← 1ELSE (C) ← 0 7.3. CJNE Rn,#data,relPhạm Hùng Kim Khánh Trang 201 Sưu t m b i: www.daihoc.com.vnGiáo trình Vi điều khiển Phụ lục 4 – Mô tả tập lệnhBytes: 3Cycles: 2Encoding: 1 0 1 1 1 r r r immediate data relative addressOperation: (PC) ← (PC) + 3IF (Rn) < > data THEN (PC) ← (PC) + relative offsetIF (Rn) < data THEN (C) ← 1ELSE (C) ← 0 7.4. CJNE @Ri,data,relBytes: 3Cycles: 2Encoding: 1 0 1 1 0 1 1 i immediate data relative addressOperation: (PC) ← (PC) + 3IF ((Ri)) < > data THEN (PC) ← (PC) + relative offsetIF ((Ri)) < data THEN (C) ← 1ELSE (C) ← 0 8. CLR AFunction: Clear AccumulatorDescription: CLR A clears the Accumulator (all bits set to 0). No flags are affectedExample: The Accumulator contains 5CH (01011100B). The following instruction, CLR Aleaves the Accumulator set to 00H (00000000B).Bytes: 1Cycles: 1Encoding: 11100100Operation: CLR(A) ← 0 9. CLR bitFunction: Clear bitDescription: CLR bit clears the indicated bit (reset to 0). No other flags are affected.CLR can operate on the carry flag or any directly addressable bit.Phạm Hùng Kim Khánh Trang 202 Sưu t m b i: www.daihoc.com.vnGiáo trình Vi điều khiển Phụ lục 4 – Mô tả tập lệnhExample: Port 1 has previously been written with 5DH (01011101B). The followinginstruction, CLR P1.2leaves the port set to 59H (01011001B). 9.1. CLR CBytes: 1Cycles: 1Encoding: 11000011Operation: CLR(C) ← 0 9.2. CLR bitBytes: 2Cycles: 1Encoding: 1 1 0 0 0 0 1 0 bit addressOperation: CLR(bit) ← 0 10. CPL AFunction: Complement AccumulatorDescription: CPLA logically complements each bit of the Accumulator (one’scomplement). Bits which previously contained a 1 are changed to a 0 and vice-versa.No flags are affected.Example: The Accumulator contains 5CH (01011100B). The following instruction, CPL Aleaves the Accumulator set to 0A3H (10100011B).Bytes: 1Cycles: 1Encoding: 11110100Operation: CPL(A) ← NOT (A) 11. CPL bitFunction: Complement bitDescription: CPL bit complements the bit variable specified. A bit that had been a 1is changed to 0 and vice-versa. No other flags are affected. CLR can operate on thecarry or any directly addressable bit.Note: When this instruction is used to modify an output pin, the value used as theoriginal data is read from the output data latch, not the input pin.Phạm Hùng Kim Khánh Trang 203 Sưu t m b i: www.daihoc.com.vnGiáo trình Vi điều khiển Phụ lục 4 – Mô tả tập lệnhExample: Port 1 has previously been written with 5BH (01011101B). The followinginstruction sequence, CPL P1.1 CPL P1.2leaves the port set to 5BH (01011011B). 11.1. CPL CBytes: 1Cycle ...
Tìm kiếm theo từ khóa liên quan:
giáo trinh vi điều khiển tài liệu vi điều khiển bài giảng vi điều khiển đề cương vi điều khiển tài liệu điện tửTài liệu liên quan:
-
Giáo trình Vi điều khiển (Nghề: Cơ điện tử - Trình độ: Cao đẳng) - Trường Cao đẳng nghề Ninh Thuận
127 trang 286 0 0 -
Cơ Sở Điện Học Truyền Thông - Tín Hiệu Số part 1
9 trang 184 0 0 -
Giáo trình Vi điều khiển (Nghề: Điện công nghiệp - Cao đẳng) - Trường Cao đẳng Cơ giới (2022)
144 trang 156 0 0 -
Tài liệu thực hành Vi điều khiển 8051
55 trang 106 0 0 -
Điều khiển số (Digital Control Systems) - ĐH Bách Khoa Hà Nội
110 trang 58 0 0 -
Giáo trình Vi điều khiển - ThS. Phạm Hùng Kim Khánh
194 trang 52 0 0 -
Giáo trình hoàn chỉnh vi điều khiển PIC 14
8 trang 48 0 0 -
93 trang 43 0 0
-
Giáo trình Thí nghiệm điện tử công suất - ĐH Công Nghiệp Tp HCM
238 trang 42 0 0 -
Công tác bổ sung tài liệu tại Thư viện Khoa học Xã hội
6 trang 41 0 0