ME576 Computer Control of Manufacturing Processes Lab7 Supplement Microprocessor (6809) X 16 bits Y 16 bits U stack pointer H stack pointer PC A (8 bits) B (8 bits) N Z V C Index registers (for indexed addressing modes) Accumulator Operations Arithmetic Addition ADD ADDB ex) A * B D Subtraction SUB SUBB ex) ex) A-MA B-MB Rotation and shift Arithmetic shift to the right ASR ASRB Logic or arithmetic shift to left LSL, LSLB A+IA B+IB Multiplication MUL ex) A + M A ex) B + B B Logic shift to the right A-IA B-IB ME576 Computer Control of Manufacturing Processes Lab7 Supplement Logic instruction Logic AND AND : Logic AND between A&M or A&I ANDB : Logic AND between B&M or B&I Logic OR OR : Logic OR between A&M or A&I ORB : Logic OR between B&M or B&I Exclusive OR XOR : Logic XOR between A&M or A&I XORB : Logic XOR between B&M or B&I Incrementing, decrementing, reset Incrementing INC INCB Decrementing DEC DECB Reset to zero CLR: CLRB: Reset A or M to zero Reset B to zero Complement to 1 INV: INVB: One's complement A or M Two's complement B Complement to 2 NEG: NEGB: Two's complement A or M Two's complement B Incrementing accumulator A or M by 1 Incrementing accumulator B by 1 Data Transfer Loading LD LDB IA II D IB MA MM D MB AM BM D MM Store in memory ST STB ME576 Computer Control of Manufacturing Processes Lab7 Supplement PLC Processor address field RAM (8K) Variable field $0000 ~ $1FFFF Inputs / outputs (8K) Input/output, DAC, ADC, timer, etc. $2000 ~ $3FFFF EEPROM EEPROM User program EEPROM EPROM PLC monitor Processing cycle: 20 msec Input/output Boards Can be used in bytes and bits read by byte directly on the input/output modules read by bits in a working field of the PC memory transfer if value other than stored value transfer of bit Bits working field INPUT/OUPUT board ME576 Computer Control of Manufacturing Processes Lab7 Supplement RAM STRUCTURE E.0 ~ E.FF: 256 outside inputs A.0 ~ A.FF: 256 outside outputs B.0 ~ B.7F: 128 internal variables/bits (B.0 ~ B.10) T.0 ~ T.F: 32 bytes for 16 delays C.0 ~ C.F: 32 bytes for 16 counters B.100 ~ B.4FF: 1024 internal variables/stored bit PC program structure TS0 monitor SP0-61 TS1 TS2 TS3 TS5 TS4 monitor TF0 TF15 monitor TSO: 20 ms scanning TS1-TS4: 100 ms/each TS0 TS0, TS1 TS0, TS2 TS0, TS3 TS0, TS4 ME576 Computer Control of Manufacturing Processes Lab7 Supplement Operators for Programming Suffix Operation on E. Input 0-FF bit A. Output 0-FF bit S Sequence 1-9999 EN. Input 0-1F byte AN. Output 0-1F byte B. Internal variables (Initialization) Internal variables 0-7F bit 80-FF bit B. I. M. Immediate values (decimal) Numerical internal variables 0-255 0-FF Reserved variables (do not use) B.0 to B.F : for intermediate calculations M.0 to M.F : for special assignment byte ME576 Computer Control of Manufacturing Processes Lab7 Supplement Examples 1. LD Loading of Accumulator A Operator over bit. b7 b1 b0 operand ex.) ex.) LD E.1: read and loading in accumulator A of status of input 1. If E.1 = 0 bit 7 = 0 If E.1 = 1 bit 7 = 1 LD B.10: read and loading in accumulator of A of status of memory B.10. B.F. B.10 Operation over byte ex). LD EN.0 : Reading of input register 0 and storing in accumulator register ex). LD I. 128 : Loading of immediate value into accumulator A (decimal). ex). LD I. $80 : Loading of immediate value accumulator A (hexadecimal). into ME576 Computer Control of Manufacturing Processes 2. ST: Storage of accumulator A in memory. ex). ex). ex). 3. AND: LD E.1 ST A.1 LD E.2 E.2 (A) ST B.10 (A) B.10 LD EN.3 EN.3 (A) ST M.3A (A) M.3A Logic and between memory and accumulator A. E.1 ex). E.2 B.10 ( ) LD E.1 E.1 (A) AND E.2 (E.1)(E.2) (A) ST B.10 (A) B.10 Lab7 Supplement ME576 Computer Control of Manufacturing Processes ex). LD EN.2 AND EN.3 ST AN.4 EN.2 = $79 4. EN.3 = $85 0 1 1 1 1 0 0 1 $79 1 0 0 0 0 1 0 1 $85 0 0 0 0 0 0 0 1 $01 OR then Lab7 Supplement AN.4 = $01 Logic OR between memory and Accumulator A. E.2 A.1 ( ) E.3 EN.0 = $79 EN.1 = $85 AN.0 = (?) ME576 Computer Control of Manufacturing Processes 5. INV Complement of A or M. Exercise E.0 E.3 E.1 A.1 ( ) E.2 ( ) EN.0 EN.1 AN.0 EN.0 = $79 EN.1 = $85 AN.0 = (?) Lab7 Supplement