Download presentation
Presentation is loading. Please wait.
Published byBrett Perry Modified over 8 years ago
1
MICRO-CONTROLLER MOTOROLA HCS12 Instruction Set Mechatronics Department Faculty of Engineering Ain Shams Univeristy
2
Memory on Chip AB X Y SP PC N Z V C Processor Memory Special Register RAM ROM Memory Port T DDRT
3
MC68HC12 “Stepper Motor Control” Port T 3|2|1|0$242
4
MC68HC12 “Stepper Motor Control” Sizeequ4; PTTequ$240;Address of port T DDRTequ$242;Data direction register for port T org$4000; ------------------------------------------------------------------ mainmovb#$FF, DDRT;Set port T for output Runldaa#size;initialize counter in A ldx#steps;Point to the steps in memory stepmovb1, x+, PTT;step the motor dbneA, step;Decrement A and check if it’s zero brarun; Step Counter Port T is a part of memory having Address $ 240 Data direction register of Port T is a part of memory having Address $ 242 steps1001 steps +11010 steps +21001 steps +30110 Move Data instruction Decision Making Flow Control
5
MC68HC12 “Stepper Motor Control” steps0101 steps +11001 steps +21010 steps +30110 AB X Y SP PC N Z V C !4 ldaa#4ldx#steps Steps Port T movb1, x+, PTT Steps +1 0101 dbneA, step !3 $4003$4005$4008$400B$400F$4008 movb1, x+, PTT $400B Steps +2 1001 $400F dbneA, step !2 $4008 movb1, x+, PTT $400B Steps +3 1010 $400F dbneA, step !1 $4008 movb1, x+, PTT Steps +4 0110 $400B dbneA, step $400F !0 brarun $4003 ldx#stepsldaa#4 !4 Steps $4005$400B
6
HCS12 Instruction Set Move data. Modify data. Decision making. Flow control.
7
Push and Pull instructions $5005…. $5006…. $5007…. $5008…. $5009…. $500A…. $500B…. $500C…. AB X Y SP PC N Z V C $5005 PULA; Stack Pointer Stack $FF Stack PSHA; $5006
8
Bit manipulation instructions $5005…. $5006…. $5007…. $5008…. $5009…. $500A…. $500B…. $500C…. BSET$5005,$6A; $B0 $6A % 1 0 1 1 0 0 0 0 % 0 1 1 0 1 0 1 0 % 1 1 1 1 1 0 1 0 $FA
9
Eng. Mohamed Mahmoud Hamdy Eng. Mostafa Ahmed Arafa Prepared by:
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.