aLec06_LogicShift - Introduction to Embedded Microcomputer...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Embedded Microcomputer Systems Lecture 6.1 Jonathan W. Valvano Required equipment (you will need to buy these) 1) You will need a voltmeter (any cheap one will do, spending $10 to $20 is sufficient) (HKN), 2) A wire stripper for 22 or 24 gauge wire 3) Soldering iron and solder (if you have a friend with one, borrowing is OK) Recap 9S12 decomposes the execution into bus cycles Stack stores temp data and subroutine return address Subroutines provide a mechanism for modularity Parallel port, direction registers Overview Logical operations Shift operations Arithmetic operations (introduction) 2.6. Logical operations A B A&B A|B A^B 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 Table 2.14. Logical operations. A B A&B AND Gate 74HC08 A B A|B OR Gate 74HC32 A B A^B EOR Gate 74HC86 A A NOT Gate 74HC04 Figure 2.12. implemented with discrete digital gates. A ~A 0 1 1 0 Table 3.11. Logical complement. anda #w ;RegA=RegA&w anda u ;RegA=RegA&[u] anda U ;RegA=RegA&[U] oraa #w ;RegA=RegA|w oraa u ;RegA=RegA|[u] oraa U ;RegA=RegA|[U] eora #w ;RegA=RegA^w eora u ;RegA=RegA^[u] eora U ;RegA=RegA^[U] coma ;RegA=~RegA The and operation to extract, or mask , individual bits Pressed = PTT&0x40; // true if the switch is pressed Interface of a switch to a microcomputer input. ldaa PTT ;read input Port T anda #$40 ;clear all bits except bit 6 staa Pressed ;true iff the switch is pressed a 7 a 6 a 5 a 4 a 3 a 2 a 1 a 0 value of PTT 0 1 0 0 0 0 0 0 $40 constant 0 a 6 0 0 0 0 0 0 result of the anda instruction I n p u t p o r t μ C +5V 10k Ω 22 Ω 7 4 H C 1 4 5 μ F P T 6 q p I n p u t p o rt μ C +5V 10k Ω PT 6 q
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Introduction to Embedded Microcomputer Systems Lecture 6.2 Jonathan W. Valvano Question 1 . Assume an input switch is interfaced to Port T bit 5. Write assembly code that reads the switch and branches to location ItsSet if the switch is set (PT5 is 1).
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

aLec06_LogicShift - Introduction to Embedded Microcomputer...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online