Reference Guide M68HC11ERG/AD Rev. 2, 10/2003 M68HC11E Series Programming Reference Guide Block Diagram XTAL EXTAL E IRQ OSC INTERRUPT LOGIC MODE CONTROL ROM OR EPROM (SEE TABLE) EEPROM (SEE TABLE) M68HC11 CPU RAM (SEE TABLE) STROBE AND HANDSHAKE PARALLEL I/O SERIAL COMMUNICATION INTERFACE SCI SERIAL PERIPHERAL INTERFACE SPI VDD VSS VRH VRL TxD RxD ADDRESS/DATA SS SCK MOSI MISO BUS EXPANSION ADDRESS R/W AS PULSE ACCUMULATOR COP PAI OC2 OC3 OC4 OC5/IC4/OC1 IC1 IC2 PERIODIC INTERRUPT IC3 CLOCK LOGIC TIMER SYSTEM XIRQ/VPPE* RESET STRB STRA MODA/ MODB/ LIR VSTBY A/D CONVERTER * VPPE applies only to devices with EPROM/OTPROM. DEVICE MC68HC11E0 MC68HC11E1 MC68HC11E9 MC68HC711E9 MC68HC11E20 MC68HC711E20 MC68HC811E2 RAM 512 512 512 512 768 768 256 PE7/AN7 PE6/AN6 PE5/AN5 PE4/AN4 PE3/AN3 PE2/AN2 PE1/AN1 PE0/AN0 PORT E PD5/SS PD4/SCK PD3/MOSI PD2/MISO PD1/TxD PD0/RxD STRA/AS PORT C STRB/R/W PORT B PC7/ADDR7/DATA7 PC6/ADDR6/DATA6 PC5/ADDR5/DATA5 PC4/ADDR4/DATA4 PC3/ADDR3/DATA3 PC2/ADDR2/DATA2 PC1/ADDR1/DATA1 PC0/ADDR0/DATA0 PORT D PORT A PB7/ADDR15 PB6/ADDR14 PB5/ADDR13 PB4/ADDR12 PB3/ADDR11 PB2/ADDR10 PB1/ADDR9 PB0/ADDR8 CONTROL PA7/PAI PA6/OC2/OC1 PA5/OC3/OC1 PA4/OC4/OC1 PA3/OC5/IC4/OC1 PA2/IC1 PA1/IC2 PA0/IC3 CONTROL ROM — — 12 K — 20 K — — EPROM — — — 12 K — 20 K — EEPROM — 512 512 512 512 512 2048 © Motorola, Inc., 2003 M68HC11ERG/AD Devices Covered in This Reference Guide Device RAM ROM EPROM EEPROM MC68HC11E0 512 — — — MC68HC11E1 512 — — 512 MC68HC11E9 512 12K — 512 MC68HC711E9 512 — 12K 512 MC68HC11E20 768 20K — 512 MC68HC711E20 768 — 10K 512 MC68HC811E2 256 — — 2048 M68HC11E Series Programming Model 7 15 A 0 7 B 0 0 D 8-BIT ACCUMULATORS A & B OR 16-BIT DOUBLE ACCUMULATOR D IX INDEX REGISTER X IY INDEX REGISTER Y SP STACK POINTER PROGRAM COUNTER PC 7 S 0 X H I N Z V C CONDITION CODES CARRY/BORROW FROM MSB OVERFLOW ZERO NEGATIVE I-INTERRUPT MASK HALF CARRY (FROM BIT 3) X-INTERRUPT MASK STOP DISABLE 2 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD Crystal Dependent Timer Summary Crystal Dependent Timer Summary Common XTAL Frequencies Selected Crystal 4.0 MHz 8.0 MHz 12.0 MHz CPU Clock (E) 1.0 MHz 2.0 MHz 3.0 MHz Cycle Time (1/E) 1000 ns 500 ns 333 ns Pulse Accumulator (in Gated Mode) (E/26) (E/214) 1 count — overflow — 64.0 µs 16.384 ms PR[1:0] 21.330 µs 5.491 ms Main Timer Count Rates (E/1) (E/216) 00 1 count— overflow — 1.0 µs 65.536 ms 500 ns 32.768 ms 333 ns 21.845 ms (E/4) (E/218) 01 1 count— overflow — 4.0 µs 262.14 ms 2.0 µs 131.07 ms 1.333 µs 87.381 ms (E/8) (E/219) 10 1 count— overflow — 8.0 µs 524.29 ms 4.0 µs 262.14 ms 2.667 µs 174.76 ms (E/16) (E/220) 11 1 count— overflow — 16.0 µs 1.049 s 8.0 µs 524.29 ms 5.333 µs 349.52 ms RTR[1:0] (E/213) (E/214) (E/215) (E/216) 00 01 10 11 CR[1:0] MOTOROLA 32.0 µs 8.192 ms Periodic (RTI) Interrupt Rates 8.192 ms 16.384 ms 32.768 ms 65.536 ms 4.096 ms 8.192 ms 16.384 ms 32.768 ms 2.731 ms 5.461 ms 10.923 ms 21.845 ms COP Watchdog Timeout Rates (E/215) (E/217) (E/219) (E/221) 00 01 10 11 32.768 ms 131.072 ms 524.288 ms 2.097 s 16.384 ms 65.536 ms 262.14 ms 1.049 s 10.923 ms 43.691 ms 174.76 ms 699.05 ms (E/215) Timeout tolerance (–0 ms/+...) 32.8 ms 16.4 ms 10.9 ms M68HC11E Series Programming Reference Guide 3 M68HC11ERG/AD Interrupt Vector Assignments Vector Address Interrupt Source FFC0, C1 – FFD4, D5 Reserved CCR Mask Bit Local Mask — — FFD6, D7 SCI serial system(1) • SCI receive data register full • SCI receiver overrun • SCI transmit data register empty • SCI transmit complete • SCI idle line detect I FFD8, D9 SPI serial transfer complete I SPIE FFDA, DB Pulse accumulator input edge I PAII FFDC, DD Pulse accumulator overflow I PAOVI FFDE, DF Timer overflow I TOI FFE0, E1 Timer input capture 4/output compare 5 I I4/O5I FFE2, E3 Timer output compare 4 I OC4I FFE4, E5 Timer output compare 3 I OC3I FFE6, E7 Timer output compare 2 I OC2I FFE8, E9 Timer output compare 1 I OC1I FFEA, EB Timer input capture 3 I IC3I FFEC, ED Timer input capture 2 I IC2I FFEE, EF Timer input capture 1 I IC1I FFF0, F1 Real-time interrupt I RTII FFF2, F3 IRQ (external pin) I None FFF4, F5 XIRQ pin X None FFF6, F7 Software interrupt None None FFF8, F9 Illegal opcode trap None None FFFA, FB COP failure None NOCOP FFFC, FD Clock monitor fail None CME FFFE, FF RESET None None RIE RIE TIE TCIE ILIE 1. Interrupts generated by SCI; read SCSR to determine source. Refer to HPRIO register to determine priority of interrupt. 4 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Memory Maps M68HC11E Series Memory Maps $0000 0000 512 BYTES RAM EXT EXT $1000 01FF 1000 64-BYTE REGISTER BLOCK 103F $B600 EXT EXT BF00 BOOT ROM BFC0 BFFF BFFF SPECIAL MODES INTERRUPT VECTORS $D000 FFC0 FFFF $FFFF EXPANDED BOOTSTRAP NORMAL MODES INTERRUPT VECTORS SPECIAL TEST Figure 1. Memory Map for MC68HC11E0 0000 $0000 512 BYTES RAM EXT EXT $1000 01FF 1000 EXT EXT 103F B600 $B600 64-BYTE REGISTER BLOCK 512 BYTES EEPROM B7FF EXT BF00 BOOT ROM BFC0 EXT BFFF BFFF SPECIAL MODES INTERRUPT VECTORS $D000 FFC0 FFFF $FFFF EXPANDED BOOTSTRAP NORMAL MODES INTERRUPT VECTORS SPECIAL TEST Figure 2. Memory Map for MC68HC11E1 MOTOROLA M68HC11E Series Programming Reference Guide 5 M68HC11ERG/AD 0000 $0000 512 BYTES RAM EXT EXT $1000 01FF 1000 EXT EXT B600 $B600 64-BYTE REGISTER BLOCK 103F 512 BYTES EEPROM B7FF EXT EXT BF00 BOOT ROM BFFF BFFF $D000 D000 BFC0 12 KBYTES ROM/EPROM FFC0 FFFF FFFF $FFFF SINGLE CHIP EXPANDED BOOTSTRAP SPECIAL MODES INTERRUPT VECTORS NORMAL MODES INTERRUPT VECTORS SPECIAL TEST Figure 3. Memory Map for MC68HC(7)11E9 0000 $0000 768 BYTES RAM EXT EXT $1000 02FF 1000 EXT EXT 9000 $9000 64-BYTE REGISTER BLOCK 103F 8 KBYTES ROM/EPROM * AFFF EXT EXT $B600 B600 512 BYTES EEPROM B7FF EXT EXT BF00 BOOT ROM BFFF $D000 BFC0 SPECIAL MODES INTERRUPT VECTORS BFFF D000 12 KBYTES ROM/EPROM * FFC0 $FFFF FFFF FFFF NORMAL MODES INTERRUPT VECTORS SINGLE BOOTSTRAP SPECIAL EXPANDED CHIP TEST * 20 Kbytes ROM/EPROM are contained in two segments of 8 Kbytes and 12 Kbytes each. Figure 4. Memory Map for MC68HC(7)11E20 6 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Memory Maps $0000 0000 256 BYTES RAM EXT EXT $1000 00FF 1000 64-BYTE REGISTER BLOCK 103F EXT EXT BF00 BOOT ROM BFFF BFC0 SPECIAL MODES INTERRUPT VECTORS BFFF 2048 BYTES EEPROM $F800 F800 FFFF $FFFF SINGLE CHIP EXPANDED BOOTSTRAP FFC0 FFFF NORMAL MODES INTERRUPT VECTORS SPECIAL TEST Figure 5. Memory Map for MC68HC811E2 MOTOROLA M68HC11E Series Programming Reference Guide 7 8 Opcode Maps M68HC11ERG/AD Page 1 DIR ACCA MSB M68HC11E Series Programming Reference Guide LSB ACCB INH INH REL INH ACCA ACCB IND,X EXT IMM DIR IND,X EXT IMM DIR IND,X EXT 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 0 1 2 3 4 5 6 7 8 9 A B C D E F 0000 0 TEST SBA BRA TSX 0001 1 NOP CBA BRN 0010 2 IDIV BRSET 0011 3 EDIV 0100 4 0101 MOTOROLA SUB 0 INS CMP 1 BHI PULA SBC 2 BRCLR BLS PULB COM LSRD BSET BCC DES LSR 5 ASLD BCLR BCS TXS 0110 6 TAP TAB BNE PSHA ROR 0111 7 TPA TBA BEQ PSHB ASR 1000 8 INX PAGE 2 BVC PULX ASL EOR 8 1001 9 DEX DAA BVS RTS ROL ADC 9 1010 A CLV PAGE 3 BPL ABX DEC ORA A 1011 B SEV ABA BMI RTI ADD B 1100 C CLC BSET BGE PSHX INC 1101 D SEC BCLR BLT MUL TST 1110 E CLI BRSET BGT WAI 1111 F SEI BRCLR BLE SWI 0 1 2 3 IND,X NEG SUBD BIT 5 LDA 6 STA JSR XGDX 6 7 8 PAGE 4 C STD D LDX STS 9 7 LDD LDS CLR 5 4 CPX BSR 3 AND STA JMP 4 ADDD A STOP B C E STX D E F F MOTOROLA Page 2 (18XX) ACCA INH MSB LSB M68HC11E Series Programming Reference Guide 0000 0 0001 INH IND,Y ACCB IMM DIR IND,X EXT IMM DIR IND,X EXT 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 0 1 2 3 4 5 6 7 8 9 A B C D E F TSY NEG SUB SUB 0 1 CMP CMP 1 0010 2 SBC SBC 2 0011 3 COM SUBD ADDD 3 0100 4 LSR AND AND 4 0101 5 BIT BIT 5 0110 6 ROR LDA LDA 6 0111 7 ASR STA STA 7 1000 8 INY ASL EOR EOR 8 1001 9 DEY RDL ADC ADC 9 1010 A DEC ORA ORA A 1011 B ADD ADD B 1100 C BSET LDD C 1101 D BCLR TST JSR STD D 1110 E BRSET JMP LDS 1111 F BRCLR CLR TYS PULY ABY 0 1 PSHY 2 4 5 6 CPY XGDY 7 8 LDY STS 9 A E STY B C D E F F 9 M68HC11ERG/AD Opcode Maps IND,Y 3 INC 10 Page 3 (1AXX) MSB LSB M68HC11ERG/AD ACCA ACCB IMM DIR IND,X EXT IND,X 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 0 1 2 3 4 5 6 7 8 9 A B C D E F M68HC11E Series Programming Reference Guide 0000 0 0 0001 1 1 0010 2 2 0011 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8 8 1001 9 9 1010 A A 1011 B B 1100 C 1101 D 1110 E LDY E 1111 F STY F CPD 3 CPY C D 0 1 2 3 4 5 6 7 8 9 A B C D E F MOTOROLA MOTOROLA Page 4 (CDXX) ACCA ACCB IND,Y MSB LSB IND,Y 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 0 1 2 3 4 5 6 7 8 9 A B C D E F M68HC11E Series Programming Reference Guide 0000 0 0 0001 1 1 0010 2 2 0011 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8 8 1001 9 9 1010 A A 1011 B B 1100 C 1101 D 1110 E LDX E 1111 F STX F CPD 3 CPX C D 1 2 3 4 5 6 7 8 9 A B C D E F 11 M68HC11ERG/AD Opcode Maps 0 M68HC11ERG/AD Simple Branches Mnemonic Opcode Cycles BRA 20 3 BRN 21 3 BSR 8D 7 Simple Conditional Branches Test True False Instruction Opcode Instruction Opcode N=1 BMI Z=1 BEQ 2B BPL 2A 27 BNE 26 V=1 BVS C=1 BCS 29 BVC 28 25 BCC 24 Instruction Opcode Instruction Opcode r>m BGT 2E BLE 2F Signed Conditional Branches Test True False r≥m BGE 2C BLT 2D r=m BEQ 27 BNE 26 r≤m BLE 2F BGT 2E r<m BLT 2D BGE 2C Unsigned Conditional Branches Test True Instruction False Opcode Instruction Opcode r>m BHI 22 BLS 23 r≥m BHS/BCC 24 BL0/BCS 25 r=m BEQ 27 BNE 26 r≤m BLS 23 BHI 22 r<m BLO/BCS 25 BHS/BCC 24 Bit Manipulation Branches BRCLR Branch if all selected bits are clear (opcode) (operand addr) (mask) (rel offset) M • mm = 0? M = operand in memory; mm = mask BRSET Branch if all selected bits are set (opcode) (operand addr) (rel offset) (M) • mm = 0? M = operand in memory; mm = mask 12 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD Instruction Set Instruction Set Refer to Table 1, which shows all the M68HC11 instructions in all possible addressing modes. For each instruction, the table shows the operand construction, the number of machine code bytes, and execution time in CPU E-clock cycles. Table 1. Instruction Set (Sheet 1 of 8) Addressing Mode Mnemonic Operation Description ABA Add Accumulators A+B⇒A INH ABX Add B to X IX + (00 : B) ⇒ IX INH ABY Add B to Y IY + (00 : B) ⇒ IY INH ADCA (opr) Add with Carry to A A+M+C⇒A A A A A A IMM DIR EXT IND,X IND,Y ADCB (opr) Add with Carry to B B+M+C⇒B B B B B B IMM DIR EXT IND,X IND,Y ADDA (opr) Add Memory to A A+M⇒A A A A A A IMM DIR EXT IND,X IND,Y ADDB (opr) Add Memory to B B+M⇒B B B B B B IMM DIR EXT IND,X IND,Y ADDD (opr) Add 16-Bit to D D + (M : M + 1) ⇒ D ANDA (opr) AND A with Memory A•M⇒A A A A A A IMM DIR EXT IND,X IND,Y ANDB (opr) AND B with Memory B•M⇒B B B B B B IMM DIR EXT IND,X IND,Y ASL (opr) Arithmetic Shift Left C ASLA C ASLB b0 b7 b0 Arithmetic Shift Left B C ASLD b7 Arithmetic Shift Left A b7 b0 Arithmetic Shift Left D IMM DIR EXT IND,X IND,Y EXT IND,X IND,Y 0 Instruction Opcode Condition Codes Operand Cycles S X H I N Z V C 1B — 2 — — ∆ — ∆ ∆ ∆ ∆ 3A — 3 — — — — — — — — 18 3A — 4 — — — — — — — — ii dd hh ll ff ff 2 3 4 4 5 — — ∆ — ∆ ∆ ∆ ∆ 18 89 99 B9 A9 A9 ii dd hh ll ff ff 2 3 4 4 5 — — ∆ — ∆ ∆ ∆ ∆ 18 C9 D9 F9 E9 E9 ii dd hh ll ff ff 2 3 4 4 5 — — ∆ — ∆ ∆ ∆ ∆ 18 8B 9B BB AB AB ii dd hh ll ff ff 2 3 4 4 5 — — ∆ — ∆ ∆ ∆ ∆ 18 CB DB FB EB EB jj kk dd hh ll ff ff 4 5 6 6 7 — — — — ∆ ∆ ∆ ∆ 18 C3 D3 F3 E3 E3 ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ 0 — 18 84 94 B4 A4 A4 ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ 0 — 18 C4 D4 F4 E4 E4 hh ll ff ff 6 6 7 — — — — ∆ ∆ ∆ ∆ 18 78 68 68 A INH 48 — 2 — — — — ∆ ∆ ∆ ∆ B INH 58 — 2 — — — — ∆ ∆ ∆ ∆ INH 05 — 3 — — — — ∆ ∆ ∆ ∆ 0 0 0 C b7 A b0 b7 B b0 MOTOROLA M68HC11E Series Programming Reference Guide 13 M68HC11ERG/AD Table 1. Instruction Set (Sheet 2 of 8) Addressing Mode Mnemonic Operation Description ASR Arithmetic Shift Right ASRA Arithmetic Shift Right A ASRB Arithmetic Shift Right B BCC (rel) Branch if Carry Clear ?C=0 BCLR (opr) (msk) Clear Bit(s) M • (mm) ⇒ M BCS (rel) Branch if Carry Set ?C=1 BEQ (rel) Branch if = Zero ?Z=1 BGE (rel) Branch if ∆ Zero ?N⊕V=0 BGT (rel) Branch if > Zero ? Z + (N ⊕ V) = 0 BHI (rel) Branch if Higher BHS (rel) b7 b0 EXT IND,X IND,Y C Instruction Opcode 18 77 67 67 Operand hh ll ff ff Condition Codes Cycles S X H I N Z V C 6 6 7 — — — — ∆ ∆ ∆ ∆ A INH 47 — 2 — — — — ∆ ∆ ∆ ∆ B INH 57 — 2 — — — — ∆ ∆ ∆ ∆ REL 24 rr 3 — — — — — — — — DIR IND,X IND,Y 15 1D 1D dd mm ff mm ff mm 6 7 8 — — — — ∆ ∆ 0 — 25 rr 3 — — — — — — — — REL 27 rr 3 — — — — — — — — REL 2C rr 3 — — — — — — — — REL 2E rr 3 — — — — — — — — ?C+Z=0 REL 22 rr 3 — — — — — — — — Branch if Higher or Same ?C=0 REL 24 rr 3 — — — — — — — — BITA (opr) Bit(s) Test A with Memory A•M A A A A A IMM DIR EXT IND,X IND,Y ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ 0 — 18 85 95 B5 A5 A5 BITB (opr) Bit(s) Test B with Memory B•M B B B B B IMM DIR EXT IND,X IND,Y ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ 0 — 18 C5 D5 F5 E5 E5 BLE (rel) Branch if ∆ Zero ? Z + (N ⊕ V) = 1 REL 2F rr 3 — — — — — — — — BLO (rel) Branch if Lower ?C=1 REL 25 rr 3 — — — — — — — — BLS (rel) Branch if Lower or Same ?C+Z=1 REL 23 rr 3 — — — — — — — — BLT (rel) Branch if < Zero ?N⊕V=1 REL 2D rr 3 — — — — — — — — BMI (rel) Branch if Minus ?N=1 REL 2B rr 3 — — — — — — — — BNE (rel) Branch if not = Zero ?Z=0 REL 26 rr 3 — — — — — — — — b7 b7 b0 b0 C C 18 REL BPL (rel) Branch if Plus ?N=0 REL 2A rr 3 — — — — — — — — BRA (rel) Branch Always ?1=1 REL 20 rr 3 — — — — — — — — BRCLR(opr) (msk) (rel) Branch if Bit(s) Clear ? M • mm = 0 DIR IND,X IND,Y 13 1F 1F dd mm rr ff mm rr ff mm rr 6 7 8 — — — — — — — — BRN (rel) Branch Never ?1=0 REL 21 rr 3 — — — — — — — — BRSET(opr) (msk) (rel) Branch if Bit(s) Set ? (M) • mm = 0 DIR IND,X IND,Y dd mm rr ff mm rr ff mm rr 6 7 8 — — — — — — — — 18 12 1E 1E BSET (opr) (msk) Set Bit(s) M + mm ⇒ M DIR IND,X IND,Y dd mm ff mm ff mm 6 7 8 — — — — ∆ ∆ 0 — 18 14 1C 1C BSR (rel) Branch to Subroutine See Figure 3–2 REL 8D rr 6 — — — — — — — — BVC (rel) Branch if Overflow Clear ?V=0 REL 28 rr 3 — — — — — — — — 14 18 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD Instruction Set Table 1. Instruction Set (Sheet 3 of 8) Addressing Mode Instruction Mnemonic Operation Description BVS (rel) Branch if Overflow Set ?V=1 REL 29 CBA Compare A to B A–B INH 11 CLC Clear Carry Bit 0⇒C INH 0C CLI Clear Interrupt Mask 0⇒I INH 0E CLR (opr) Clear Memory Byte 0⇒M EXT IND,X IND,Y 7F 6F 6F CLRA Clear Accumulator A 0⇒A A INH 4F CLRB Clear Accumulator B 0⇒B B INH CLV Clear Overflow Flag 0⇒V CMPA (opr) Compare A to Memory A–M CMPB (opr) Compare B to Memory B–M COM (opr) Ones Complement Memory Byte $FF – M ⇒ M COMA Ones Complement A $FF – A ⇒ A A INH 43 COMB Ones Complement B $FF – B ⇒ B B INH 53 CPD (opr) Compare D to Memory 16-Bit D–M:M +1 IMM DIR EXT IND,X IND,Y CPX (opr) Compare X to Memory 16-Bit IX – M : M + 1 CPY (opr) Compare Y to Memory 16-Bit IY – M : M + 1 DAA Decimal Adjust A Adjust Sum to BCD DEC (opr) Decrement Memory Byte M–1⇒M DECA Decrement Accumulator A A–1⇒A A INH 4A DECB Decrement Accumulator B B–1⇒B B INH 5A MOTOROLA S X H I N Z V C 3 — — — — — — — — — 2 — — — — ∆ ∆ ∆ ∆ — 2 — — — — — — — 0 — 2 — — — 0 — — — — 6 6 7 — — — — 0 1 0 0 — 2 — — — — 0 1 0 0 5F — 2 — — — — 0 1 0 0 INH 0A — 2 — — — — — — 0 — A A A A A IMM DIR EXT IND,X IND,Y ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ ∆ ∆ 18 81 91 B1 A1 A1 B B B B B IMM DIR EXT IND,X IND,Y ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ ∆ ∆ 18 C1 D1 F1 E1 E1 hh ll ff ff 6 6 7 — — — — ∆ ∆ 0 1 18 73 63 63 — 2 — — — — ∆ ∆ 0 1 — 2 — — — — ∆ ∆ 0 1 18 Operand Condition Codes Cycles EXT IND,X IND,Y Opcode rr hh ll ff ff 1A 1A 1A 1A CD 83 93 B3 A3 A3 jj kk dd hh ll ff ff 5 6 7 7 7 — — — — ∆ ∆ ∆ ∆ IMM DIR EXT IND,X IND,Y jj kk dd hh ll ff ff 4 5 6 6 7 — — — — ∆ ∆ ∆ ∆ CD 8C 9C BC AC AC IMM DIR EXT IND,X IND,Y 18 18 18 1A 18 8C 9C BC AC AC jj kk dd hh ll ff ff 5 6 7 7 7 — — — — ∆ ∆ ∆ ∆ 2 — — — — ∆ ∆ ∆ ∆ 6 6 7 — — — — ∆ ∆ ∆ — — 2 — — — — ∆ ∆ ∆ — — 2 — — — — ∆ ∆ ∆ — INH 19 EXT IND,X IND,Y 7A 6A 6A 18 — hh ll ff ff M68HC11E Series Programming Reference Guide 15 M68HC11ERG/AD Table 1. Instruction Set (Sheet 4 of 8) Addressing Mode Instruction Mnemonic Operation Description DES Decrement Stack Pointer SP – 1 ⇒ SP INH DEX Decrement Index Register X IX – 1 ⇒ IX INH DEY Decrement Index Register Y IY – 1 ⇒ IY INH EORA (opr) Exclusive OR A with Memory A⊕M⇒A A A A A A IMM DIR EXT IND,X IND,Y EORB (opr) Exclusive OR B with Memory B⊕M⇒B B B B B B IMM DIR EXT IND,X IND,Y FDIV Fractional Divide 16 by 16 D / IX ⇒ IX; r ⇒ D INH 03 IDIV Integer Divide 16 by 16 D / IX ⇒ IX; r ⇒ D INH 02 INC (opr) Increment Memory Byte M+1⇒M EXT IND,X IND,Y 7C 6C 6C INCA Increment Accumulator A A+1⇒A A INH 4C INCB Increment Accumulator B B+1⇒B B INH INS Increment Stack Pointer SP + 1 ⇒ SP INX Increment Index Register X INY Condition Codes Operand Cycles S X H I N Z V C 34 — 3 — — — — — — — — 09 — 3 — — — — — ∆ — — 18 09 — 4 — — — — — ∆ — — ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ 0 — 18 88 98 B8 A8 A8 ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ 0 — 18 C8 D8 F8 E8 E8 — 41 — — — — — ∆ ∆ ∆ — 41 — — — — — ∆ 0 ∆ 6 6 7 — — — — ∆ ∆ ∆ — — 2 — — — — ∆ ∆ ∆ — 5C — 2 — — — — ∆ ∆ ∆ — INH 31 — 3 — — — — — — — — IX + 1 ⇒ IX INH 08 — 3 — — — — — ∆ — — Increment Index Register Y IY + 1 ⇒ IY INH 18 08 — 4 — — — — — ∆ — — JMP (opr) Jump See Figure 3–2 EXT IND,X IND,Y hh ll ff ff 3 3 4 — — — — — — — — 18 7E 6E 6E JSR (opr) Jump to Subroutine See Figure 3–2 DIR EXT IND,X IND,Y dd hh ll ff ff 5 6 6 7 — — — — — — — — 18 9D BD AD AD LDAA (opr) Load Accumulator A M⇒A A A A A A IMM DIR EXT IND,X IND,Y ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ 0 — 18 86 96 B6 A6 A6 LDAB (opr) Load Accumulator B M⇒B B B B B B IMM DIR EXT IND,X IND,Y ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ 0 — 18 C6 D6 F6 E6 E6 LDD (opr) Load Double Accumulator D M ⇒ A,M + 1 ⇒ B jj kk dd hh ll ff ff 3 4 5 5 6 — — — — ∆ ∆ 0 — 18 CC DC FC EC EC 16 IMM DIR EXT IND,X IND,Y Opcode 18 hh ll ff ff M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD Instruction Set Table 1. Instruction Set (Sheet 5 of 8) Addressing Mode Mnemonic Operation Description LDS (opr) Load Stack Pointer M : M + 1 ⇒ SP IMM DIR EXT IND,X IND,Y LDX (opr) Load Index Register X M : M + 1 ⇒ IX IMM DIR EXT IND,X IND,Y LDY (opr) Load Index Register Y M : M + 1 ⇒ IY IMM DIR EXT IND,X IND,Y LSL (opr) Logical Shift Left C LSLA b7 b0 Logical Shift Left A C LSLB b7 b0 Logical Shift Left B C LSLD b7 b0 LSRA 0 Logical Shift Right A LSRB 0 Logical Shift Right B LSRD Logical Shift Right Double 0 0 b7 b7 b7 Condition Codes Cycles S X H I N Z V C jj kk dd hh ll ff ff 3 4 5 5 6 — — — — ∆ ∆ 0 — 18 8E 9E BE AE AE jj kk dd hh ll ff ff 3 4 5 5 6 — — — — ∆ ∆ 0 — CD CE DE FE EE EE 18 18 18 1A 18 CE DE FE EE EE jj kk dd hh ll ff ff 4 5 6 6 6 — — — — ∆ ∆ 0 — hh ll ff ff 6 6 7 — — — — ∆ ∆ ∆ ∆ 18 78 68 68 A INH 48 — 2 — — — — ∆ ∆ ∆ ∆ B INH 58 — 2 — — — — ∆ ∆ ∆ ∆ INH 05 — 3 — — — — ∆ ∆ ∆ ∆ EXT IND,X IND,Y 74 64 64 6 6 7 — — — — 0 ∆ ∆ ∆ 0 b7 A b0 b7 B b0 C Logical Shift Right Operand 0 Logical Shift Left Double LSR (opr) EXT IND,X IND,Y 0 Instruction Opcode 0 b0 C 18 hh ll ff ff A INH 44 — 2 — — — — 0 ∆ ∆ ∆ B INH 54 — 2 — — — — 0 ∆ ∆ ∆ INH 04 — 3 — — — — 0 ∆ ∆ ∆ — 10 — — — — — — — ∆ 6 6 7 — — — — ∆ ∆ ∆ ∆ b0 C b0 C b7 A b0 b7 B b0 C MUL Multiply 8 by 8 A∗B⇒D INH 3D NEG (opr) Two’s Complement Memory Byte 0–M⇒M EXT IND,X IND,Y 70 60 60 NEGA Two’s Complement A 0–A⇒A A INH 40 — 2 — — — — ∆ ∆ ∆ ∆ NEGB Two’s Complement B 0–B⇒B B INH 50 — 2 — — — — ∆ ∆ ∆ ∆ — 18 hh ll ff ff NOP No operation No Operation INH 01 2 — — — — — — — — ORAA (opr) OR Accumulator A (Inclusive) A+M⇒A A A A A A IMM DIR EXT IND,X IND,Y ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ 0 — 18 8A 9A BA AA AA ORAB (opr) OR Accumulator B (Inclusive) B+M⇒B B B B B B IMM DIR EXT IND,X IND,Y ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ 0 — 18 CA DA FA EA EA MOTOROLA M68HC11E Series Programming Reference Guide 17 M68HC11ERG/AD Table 1. Instruction Set (Sheet 6 of 8) Addressing Mode Mnemonic Operation Description PSHA Push A onto Stack A ⇒ Stk,SP = SP – 1 A INH PSHB Push B onto Stack B ⇒ Stk,SP = SP – 1 B PSHX Push X onto Stack (Lo First) PSHY Instruction Condition Codes Operand Cycles S X H I N Z V C 36 — 3 — — — — — — — — INH 37 — 3 — — — — — — — — IX ⇒ Stk,SP = SP – 2 INH 3C — 4 — — — — — — — — Push Y onto Stack (Lo First) IY ⇒ Stk,SP = SP – 2 INH 3C — 5 — — — — — — — — PULA Pull A from Stack SP = SP + 1, A ⇐ Stk A INH 32 — 4 — — — — — — — — PULB Pull B from Stack SP = SP + 1, B ⇐ Stk B INH 33 — 4 — — — — — — — — PULX Pull X From Stack (Hi First) SP = SP + 2, IX ⇐ Stk INH 38 — 5 — — — — — — — — PULY Pull Y from Stack (Hi First) SP = SP + 2, IY ⇐ Stk INH 18 38 — 6 — — — — — — — — ROL (opr) Rotate Left 6 6 7 — — — — ∆ ∆ ∆ ∆ 18 79 69 69 ROLA Rotate Left A ROLB Rotate Left B ROR (opr) Rotate Right RORA Rotate Right A RORB Rotate Right B RTI Return from Interrupt RTS C C C b7 b7 EXT IND,X IND,Y b0 b7 Opcode 18 hh ll ff ff A INH 49 — 2 — — — — ∆ ∆ ∆ ∆ B INH 59 — 2 — — — — ∆ ∆ ∆ ∆ EXT IND,X IND,Y 76 66 66 6 6 7 — — — — ∆ ∆ ∆ ∆ b0 b7 b0 b0 C 18 hh ll ff ff A INH 46 — 2 — — — — ∆ ∆ ∆ ∆ B INH 56 — 2 — — — — ∆ ∆ ∆ ∆ See Figure 3–2 INH 3B — 12 ∆ ↓ ∆ ∆ ∆ ∆ ∆ ∆ Return from Subroutine See Figure 3–2 INH 39 — 5 — — — — — — — — SBA Subtract B from A A–B⇒A INH 10 — 2 — — — — ∆ ∆ ∆ ∆ SBCA (opr) Subtract with Carry from A A–M–C⇒A A A A A A IMM DIR EXT IND,X IND,Y ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ ∆ ∆ 18 82 92 B2 A2 A2 SBCB (opr) Subtract with Carry from B B–M–C⇒B B B B B B IMM DIR EXT IND,X IND,Y ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ ∆ ∆ 18 C2 D2 F2 E2 E2 b7 b7 18 b0 C b0 C SEC Set Carry 1⇒C INH 0D — 2 — — — — — — — 1 SEI Set Interrupt Mask 1⇒I INH 0F — 2 — — — 1 — — — — SEV Set Overflow Flag 1⇒V INH 0B — 2 — — — — — — 1 — M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD Instruction Set Table 1. Instruction Set (Sheet 7 of 8) Addressing Mode Mnemonic Operation Description STAA (opr) Store Accumulator A A⇒M A A A A DIR EXT IND,X IND,Y STAB (opr) Store Accumulator B B⇒M B B B B DIR EXT IND,X IND,Y STD (opr) Store Accumulator D A ⇒ M, B ⇒ M + 1 STOP Stop Internal Clocks — STS (opr) Store Stack Pointer STX (opr) DIR EXT IND,X IND,Y Instruction Opcode Operand Condition Codes I N Z V C dd hh ll ff ff 3 4 4 5 — — — — ∆ ∆ 0 — 18 97 B7 A7 A7 dd hh ll ff ff 3 4 4 5 — — — — ∆ ∆ 0 — 18 D7 F7 E7 E7 dd hh ll ff ff 4 5 5 6 — — — — ∆ ∆ 0 — 18 DD FD ED ED 2 — — — — — — — — S X H INH CF SP ⇒ M : M + 1 DIR EXT IND,X IND,Y dd hh ll ff ff 4 5 5 6 — — — — ∆ ∆ 0 — 18 9F BF AF AF Store Index Register X IX ⇒ M : M + 1 DIR EXT IND,X IND,Y dd hh ll ff ff 4 5 5 6 — — — — ∆ ∆ 0 — CD DF FF EF EF STY (opr) Store Index Register Y IY ⇒ M : M + 1 DIR EXT IND,X IND,Y 18 18 1A 18 DF FF EF EF dd hh ll ff ff 5 6 6 6 — — — — ∆ ∆ 0 — SUBA (opr) Subtract Memory from A A–M⇒A A A A A A IMM DIR EXT IND,X IND,Y ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ ∆ ∆ 18 80 90 B0 A0 A0 SUBB (opr) Subtract Memory from B B–M⇒B A A A A A IMM DIR EXT IND,X IND,Y ii dd hh ll ff ff 2 3 4 4 5 — — — — ∆ ∆ ∆ ∆ 18 C0 D0 F0 E0 E0 SUBD (opr) Subtract Memory from D D–M:M+1⇒D jj kk dd hh ll ff ff 4 5 6 6 7 — — — — ∆ ∆ ∆ ∆ 18 83 93 B3 A3 A3 SWI Software Interrupt See Figure 3–2 14 — — — 1 — — — — TAB Transfer A to B A⇒B INH 16 — 2 — — — — ∆ ∆ 0 — TAP Transfer A to CC Register A ⇒ CCR INH 06 — 2 ∆ ↓ ∆ ∆ ∆ ∆ ∆ ∆ IMM DIR EXT IND,X IND,Y INH 3F — Cycles — TBA Transfer B to A B⇒A INH 17 — 2 — — — — ∆ ∆ 0 — TEST TEST (Only in Test Modes) Address Bus Counts INH 00 — * — — — — — — — — TPA Transfer CC Register to A CCR ⇒ A INH 07 — 2 — — — — — — — — TST (opr) Test for Zero or Minus M–0 EXT IND,X IND,Y 7D 6D 6D 6 6 7 — — — — ∆ ∆ 0 0 TSTA Test A for Zero or Minus A–0 A INH 4D — 2 — — — — ∆ ∆ 0 0 TSTB Test B for Zero or Minus B–0 B INH 5D — 2 — — — — ∆ ∆ 0 0 TSX Transfer Stack Pointer to X SP + 1 ⇒ IX INH 30 — 3 — — — — — — — — MOTOROLA 18 hh ll ff ff M68HC11E Series Programming Reference Guide 19 M68HC11ERG/AD Table 1. Instruction Set (Sheet 8 of 8) Operation Description TSY Transfer Stack Pointer to Y SP + 1 ⇒ IY INH TXS Transfer X to Stack Pointer IX – 1 ⇒ SP INH TYS Transfer Y to Stack Pointer IY – 1 ⇒ SP INH WAI Wait for Interrupt Stack Regs & WAIT XGDX Exchange D with X XGDY Exchange D with Y Cycle * ** Instruction Addressing Mode Mnemonic Opcode Condition Codes Operand Cycles S X H I N Z V C 30 — 4 — — — — — — — — 35 — 3 — — — — — — — — 35 — 4 — — — — — — — — INH 3E — ** — — — — — — — — IX ⇒ D, D ⇒ IX INH 8F — 3 — — — — — — — — IY ⇒ D, D ⇒ IY INH 8F — 4 — — — — — — — — 18 18 18 Infinity or until reset occurs 12 cycles are used beginning with the opcode fetch. A wait state is entered which remains in effect for an integer number of MPU E-clock cycles (n) until an interrupt is recognized. Finally, two additional cycles are used to fetch the appropriate interrupt vector (14 + n total). Operands dd = 8-bit direct address ($0000–$00FF) (high byte assumed to be $00) ff = 8-bit positive offset $00 (0) to $FF (255) (is added to index) hh = High-order byte of 16-bit extended address ii = One byte of immediate data jj = High-order byte of 16-bit immediate data kk = Low-order byte of 16-bit immediate data ll = Low-order byte of 16-bit extended address mm = 8-bit mask (set bits to be affected) rr = Signed relative offset $80 (–128) to $7F (+127) (offset relative to address following machine code offset byte)) Operators () Contents of register shown inside parentheses ⇐ Is transferred to ⇑ Is pulled from stack ⇓ Is pushed onto stack • Boolean AND + Arithmetic addition symbol except where used as inclusive-OR symbol in Boolean formula ⊕ Exclusive-OR ∗ Multiply : Concatenation – Arithmetic subtraction symbol or negation symbol (two’s complement) 20 Condition Codes — Bit not changed 0 Bit always cleared 1 Bit always set ∆ Bit cleared or set, depending on operation ↓ Bit can be cleared, cannot become set M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD Special Operations Special Operations JSR, JUMP TO SUBROUTINE RTI, RETURN FROM INTERRUPT MAIN PROGRAM PC PC DIRECT $9D = JSR dd RTN NEXT MAIN INSTR. SP+4 $AD = JSR ff RTN NEXT MAIN INSTR. 7 ⇑ STACK SP+5 0 SP+6 SP+7 SP–2 SP–1 SP $18 = PRE $AD = JSR RTN ff NEXT MAIN INSTR. SP+8 RTNH RTNL ⇑ MAIN PROGRAM PC $3F = SWI $BD = PRE hh RTN ll NEXT MAIN INSTR. SP–6 WAI, WAIT FOR INTERRUPT PC SP–4 SP–3 $3E = WAI SP–2 SP–1 7 ⇑ STACK RTS, RETURN FROM SUBROUTINE MAIN PROGRAM LEGEND: RTNH RTNL SP 7 STACK SP $39 = RTS SP+1 ⇑ SP SP+2 CCR ACCB ACCA IXH IXL IYH IYL RTNH RTNL 0 SP–2 SP–1 MOTOROLA SP–5 MAIN PROGRAM BSR, BRANCH TO SUBROUTINE 0 SP–9 SP–7 PC PC ⇑ SP–8 MAIN PROGRAM 0 SWI, SOFTWARE INTERRUPT MAIN PROGRAM $8D = BSR STACK SP+3 PC PC 7 SP+2 MAIN PROGRAM INDEXED, Y SP+9 CCR ACCB ACCA IXH IXL IYH IYL RTNH RTNL SP+1 PC INDEXED, Y STACK SP $3B = RTI MAIN PROGRAM INDEXED, X 7 INTERRUPT ROUTINE RTNH RTNL 0 RTN = ADDRESS OF NEXT INSTRUCTION IN MAIN PROGRAM TO BE EXECUTED UPON RETURN FROM SUBROUTINE RTNH = MOST SIGNIFICANT BYTE OF RETURN ADDRESS RTNL = LEAST SIGNIFICANT BYTE OF RETURN ADDRESS ⇑ = STACK POINTER POSITION AFTER OPERATION IS COMPLETE dd = 8-BIT DIRECT ADDRESS ($0000–$00FF) (HIGH BYTE ASSUMED TO BE $00) ff = 8-BIT POSITIVE OFFSET $00 (0) TO $FF (255) IS ADDED TO INDEX hh = HIGH-ORDER BYTE OF 16-BIT EXTENDED ADDRESS ll = LOW-ORDER BYTE OF 16-BIT EXTENDED ADDRESS rr = SIGNED RELATIVE OFFSET $80 (–128) TO $7F (+127) (OFFSET RELATIVE TO THE ADDRESS FOLLOWING THE MACHINE CODE OFFSET BYTE) M68HC11E Series Programming Reference Guide 21 M68HC11ERG/AD M68HC11E Series Registers Figure 6 provides a summary of the M68HC11E registers. Note that the 128-byte register block can be remapped to any 4K boundary. Addr. Register Name Read: $1000 Port A Data Register (PORTA) Write: Reset: $1001 Reserved $1002 Parallel I/O Control Register (PIOC) Read: Write: Reset: Read: $1003 Port C Data Register (PORTC) Write: Bit 7 6 5 4 3 2 1 Bit 0 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0 I 0 0 0 I I I I R R R R R R R R STAF STAI CWOM HNDS OIN PLS EGA INVB 0 0 0 0 0 U 1 1 PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0 Reset: Read: $1004 Port B Data Register (PORTB) Write: Reset: Read: $1005 Port C Latched Register (PORTCL) Write: Indeterminate after reset PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0 0 0 0 0 0 0 0 0 PCL7 PCL6 PCL5 PCL4 PCL3 PCL2 PCL1 PCL0 Reset: $1006 Reserved $1007 Port C Data Direction Register (DDRC) Read: Write: Reset: Read: $1008 Port D Data Register (PORTD) Write: Reset: Indeterminate after reset R R R R R R R R DDRC7 DDRC6 DDRC5 DDRC4 DDRC3 DDRC2 DDRC1 DDRC0 0 0 0 0 0 0 0 0 0 0 PD5 PD4 PD3 PD2 PD1 PD0 U U I I I I I I DDRD5 DDRD4 DDRD3 DDRD2 DDRD1 DDRD0 Read: $1009 Port D Data Direction Register (DDRD) Write: Reset: Read: $100A Port E Data Register (PORTE) Write: 0 0 0 0 0 0 0 0 PE7 PE6 PE5 PE4 PE3 PE2 PE1 PE0 Reset: Indeterminate after reset = Unimplemented R = Reserved U = Unaffected I = Indeterminate after reset Figure 6. Register and Control Bit Assignments (Sheet 1 of 6) 22 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers Addr. Register Name $100B Timer Compare Force Register (CFORC) Bit 7 6 5 4 3 FOC1 FOC2 FOC3 FOC4 FOC5 0 0 0 0 0 OC1M7 OC1M6 OC1M5 OC1M4 OC1M3 0 0 0 0 0 OC1D7 OC1D6 OC1D5 OC1D4 OC1D3 Reset: 0 0 0 0 Read: Bit 15 Bit 14 Bit 13 Reset: 0 0 Read: Bit 7 Read: Write: Reset: Read: $100C Output Compare 1 Mask Register (OC1M) Write: Reset: Read: $100D $100E $100F Output Compare 1 Data Register (OC1D) Timer Counter Register High (TCNTH) Timer Counter Register Low (TCNTL) Write: Bit 0 0 0 0 0 0 0 0 0 0 0 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 0 0 0 0 0 0 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 0 0 0 0 0 0 0 0 Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 2 Bit 1 Bit 0 Bit 10 Bit 9 Bit 8 Bit 2 Bit 1 Bit 0 Bit 10 Bit 9 Bit 8 Bit 2 Bit 1 Bit 0 Bit 10 Bit 9 Bit 8 1 1 1 Write: Read: Timer Input Capture 1 Register High (TIC1H) 1 Write: Reset: $1010 2 Write: Reset: Read: $1011 Timer Input Capture 1 Register Low (TIC1L) Write: Indeterminate after reset Bit 7 Bit 6 Bit 5 Reset: Read: $1012 Timer Input Capture 2 Register High (TIC2H) Write: $1013 TImer Input Capture 2 Register Low (TIC2L) Write: Bit 15 Bit 14 Bit 13 $1014 Timer Input Capture 3 Register High (TIC3H) Write: Bit 7 Bit 6 Bit 5 Read: Timer Input Capture 3 Register Low (TIC3L) Write: Bit 15 Bit 14 Bit 13 $1016 Timer Output Compare 1 Register High (TOC1H) Write: Reset: Bit 4 Bit 3 Bit 12 Bit 11 Indeterminate after reset Bit 7 Bit 6 Bit 5 Reset: Read: Bit 11 Indeterminate after reset Reset: $1015 Bit 12 Indeterminate after reset Reset: Read: Bit 3 Indeterminate after reset Reset: Read: Bit 4 Bit 4 Bit 3 Indeterminate after reset Bit 15 1 Bit 14 Bit 13 Bit 12 Bit 11 1 1 1 1 = Unimplemented R = Reserved U = Unaffected I = Indeterminate after reset Figure 6. Register and Control Bit Assignments (Sheet 2 of 6) MOTOROLA M68HC11E Series Programming Reference Guide 23 M68HC11ERG/AD Addr. Register Name $1017 Timer Output Compare 1 Register Low (TOC1L) Read: Write: Reset: Read: $1018 Timer Output Compare 2 Register High (TOC2H) Write: Reset: Read: $1019 Timer Output Compare 2 Register Low (TOC2L) Write: Reset: Read: Timer Output Compare 3 Register $101A High (TOC3H) Write: Reset: Read: $101B Timer Output Compare 3 Register Low (TOC3L) Write: Reset: Read: $101C Timer Output Compare 4 Register High (TOC4H) Write: Reset: Read: Timer Output Compare 4 Register $101D Low (TOC4L) Write: Reset: $101E Timer Input Capture 4/Output Read: Compare 5 Register High Write: (TI4/O5) Reset: Read: $101F Timer Input Capture 4/Output Compare 5 Register Low Write: (TI4/O5) Reset: Read: $1020 Timer Control Register 1 (TCTL1) Write: Reset: Read: $1021 Timer Control Register 2 (TCTL2) Write: Reset: Read: $1022 Timer Interrupt Mask 1 Register (TMSK1) Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 1 1 1 1 1 1 1 1 Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 1 1 1 1 1 1 1 1 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 1 1 1 1 1 1 1 1 Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 1 1 1 1 1 1 1 1 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 1 1 1 1 1 1 1 1 Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 1 1 1 1 1 1 1 1 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 1 1 1 1 1 1 1 1 Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 1 1 1 1 1 1 1 1 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 1 1 1 1 1 1 1 1 OM2 OL2 OM3 OL3 OM4 OL4 OM5 OL5 0 0 0 0 0 0 0 0 EDG4B EDG4A EDG1B EDG1A EDG2B EDG2A EDG3B EDG3A 0 0 0 0 0 0 0 0 OC1I OC2I OC3I OC4I I4/O5I IC1I IC2I IC3I 0 0 0 0 0 0 0 = Unimplemented R = Reserved 0 U = Unaffected I = Indeterminate after reset Figure 6. Register and Control Bit Assignments (Sheet 3 of 6) 24 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers Addr. Register Name $1023 Timer Interrupt Flag 1 (TFLG1) Read: Write: Reset: Read: $1024 Timer Interrupt Mask 2 Register (TMSK2) Write: Reset: Read: Timer Interrupt Flag 2 (TFLG2) $1025 Write: Reset: Read: Pulse Accumulator Control Register (PACTL) $1026 Write: Reset: Read: Pulse Accumulator Count Register (PACNT) $1027 Write: Bit 7 6 5 4 3 2 1 Bit 0 OC1F OC2F OC3F OC4F I4/O5F IC1F IC2F IC3F 0 0 0 0 0 0 0 0 TOI RTII PAOVI PAII PR1 PR0 0 0 0 0 TOF RTIF PAOVF PAIF 0 0 0 DDRA7 PAEN 0 Bit 7 0 0 0 0 0 0 0 0 0 PAMOD PEDGE DDRA3 I4/O5 RTR1 RTR0 0 0 0 0 0 0 0 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset: Read: $1028 Serial Peripheral Control Register (SPCR) Write: Reset: Read: $1029 Serial Peripheral Status Register (SPSR) Write: Reset: Read: Serial Peripheral Data I/O Register (SPDR) $102A Write: Indeterminate after reset SPIE SPE DWOM MSTR CPOL CPHA SPR1 SPR0 0 0 0 0 0 1 U U SPIF WCOL 0 0 0 0 0 0 0 0 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 MODF Reset: Read: Baud Rate Register (BAUD) $102B Write: Reset: Read: $102C Serial Communications Control Register 1 (SCCR1) Write: Reset: Read: $102D Serial Communications Control Register 2 (SCCR2) Write: Reset: Read: $102E Serial Communications Status Register (SCSR) Write: Reset: Indeterminate after reset TCLR SCP2(1) SCP1 SCP0 RCKB SCR2 SCR1 SCR0 0 0 0 0 0 U U U R8 T8 M WAKE I I 0 0 0 0 0 0 TIE TCIE RIE ILIE TE RE RWU SBK 0 0 0 0 0 0 0 0 TDRE TC RDRF IDLE OR NF FE 1 1 0 0 0 0 0 = Unimplemented R = Reserved 0 1. SCP2 adds ÷ 39 to SCI prescaler and is present only in MC68HC(7)11E20. U = Unaffected I = Indeterminate after reset Figure 6. Register and Control Bit Assignments (Sheet 4 of 6) MOTOROLA M68HC11E Series Programming Reference Guide 25 M68HC11ERG/AD Addr. Register Name $102F Serial Communications Data Register (SCDR) Read: Write: Bit 7 6 5 4 3 2 1 Bit 0 R7/T7 R6/T6 R5/T5 R4/T4 R3/T3 R2/T2 R1/T1 R0/T0 CC CB CA Bit 2 Bit 1 Bit 0 Bit 2 Bit 1 Bit 0 Bit 2 Bit 1 Bit 0 Bit 2 Bit 1 Bit 0 Reset: Read: $1030 $1031 Analog-to-Digital Control Status Register (ADCTL) Analog-to-Digital Results Register 1 (ADR1) Indeterminate after reset CCF Write: Reset: 0 0 Read: Bit 7 Bit 6 SCAN MULT Bit 5 Bit 4 Indeterminate after reset Read: $1032 Indeterminate after reset Bit 7 Bit 6 Bit 5 Read: Analog-to-Digital Results Register 3 (ADR3) Bit 7 Bit 6 Bit 5 Bit 7 Bit 6 Bit 5 Read: EPROM Programming Control Register (EPROG)(1) Bit 3 Indeterminate after reset PTCON BPRT3 BPRT2 BPRT1 BPRT0 0 1 1 1 1 1 ELAT EXCOL EXROW T1 T0 PGM Write: Reset: $1036 Bit 4 Write: Read: $1035 Bit 3 Indeterminate after reset Reset: Block Protect Register (BPROT) Bit 4 Write: Read: $1034 Bit 3 Indeterminate after reset Reset: Analog-to-Digital Results Register 4 (ADR4) Bit 4 Write: Reset: $1033 Bit 3 Write: Reset: Analog-to-Digital Results Register 2 (ADR2) CD Write: Reset: 0 0 MBE 0 0 0 0 0 0 0 0 1. MC68HC711E20 only $1037 Reserved R R R R R R R R $1038 Reserved R R R R R R R R $1039 System Configuration Options Register (OPTION) ADPU CSEL IRQE(1) DLY(1) CME CR1(1) CR0(1) 0 0 0 1 0 0 0 0 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 0 0 0 0 0 0 0 0 ODD EVEN ELAT(2) BYTE ROW ERASE EELAT EPGM 0 0 0 0 0 0 0 = Unimplemented R = Reserved Read: Write: Reset: Read: $103A Arm/Reset COP Timer Circuitry Register (COPRST) Write: Reset: $103B EPROM and EEPROM Read: Programming Control Register Write: (PPROG) Reset: 0 U = Unaffected I = Indeterminate after reset Figure 6. Register and Control Bit Assignments (Sheet 5 of 6) 26 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers Addr. $103C Register Name Bit 7 Highest Priority I Bit Interrupt and Read: RBOOT Miscellaneous Register Write: (HPRIO) Reset: 0 Read: $103D RAM and I/O Mapping Register (INIT) $103E Reserved $103F System Configuration Register (CONFIG) RAM3 Write: Reset: 6 5 4 3 2 1 Bit 0 SMOD MDA IRV(NE) PSEL3 PSEL2 PSEL1 PSEL0 0 0 0 0 1 1 0 RAM2 RAM1 RAM0 REG3 REG2 REG1 REG0 0 0 0 0 0 0 0 1 R R R R R R R R NOSEC NOCOP ROMON EEON 1 U Read: Write: Reset: Read: $103F System Configuration Register (CONFIG)(3) Write: 0 0 0 0 U U EE3 EE2 EE1 EE0 NOSEC NOCOP 1 1 1 1 U U Reset: EEON 1 1 1. Can be written only once in first 64 cycles out of reset in normal modes or at any time during special modes. 2. MC68HC711E9 only 3. MC68HC811E2 only = Unimplemented R = Reserved U = Unaffected I = Indeterminate after reset Figure 6. Register and Control Bit Assignments (Sheet 6 of 6) A/D Control/Status Register (ADCTL) Address: $1030 Read: CCF Bit 7 6 Write: Reset: 0 5 4 3 2 1 Bit 0 SCAN MULT CD CC CB CA 0 Indeterminate after reset = Unimplemented CCF — Conversion Complete Flag This bit is set after an A/D conversion cycle and cleared when ADCTL is written. Bit 6 — Unimplemented Always reads 0 SCAN — Continuous Scan Control 0 = Do four conversions and stop 1 = Convert four channels in selected group continuously MULT — Multiple Channel/Single Channel Control 0 = Convert single channel selected 1 = Convert four channels in selected group MOTOROLA M68HC11E Series Programming Reference Guide 27 M68HC11ERG/AD CD:CA — Channel Selects D:A Refer to the following table. Channel Select Control Bits CD:CC:CB:CA 0000 0001 0010 0011 0100 0101 0110 0111 10XX Channel Signal Result in ADRx if MULT = 1 Result in ADRx if MULT = 0 AN0 AN1 AN2 AN3 AN4 AN5 AN6 AN7 Reserved ADR1 ADR2 ADR3 ADR4 ADR1 ADR2 ADR3 ADR4 — ADR[4:1] ADR[4:1] ADR[4:1] ADR[4:1] ADR[4:1] ADR[4:1] ADR[4:1] ADR[4:1] — 1100 VRH(1) ADR1 ADR[4:1] 1101 VRL(1) ADR2 ADR[4:1] ADR3 ADR[4:1] ADR4 ADR[4:1] 1110 1111 (VRH )/2(1) Reserved(1) 1. Used for factory testing A/D Results (ADR1–ADR4) ADR1 — Address: $1031 Bit 7 6 5 Read: Bit 7 6 5 Write: Reset: ADR2 — Address: $1032 Bit 7 6 5 Read: Bit 7 6 5 Write: Reset: ADR3 — Address: $1033 Bit 7 6 5 Read: Bit 7 6 5 Write: Reset: ADR4 — Address: $1034 Bit 7 6 5 Read: Bit 7 6 5 Write: Reset: = Unimplemented 28 4 4 3 3 2 2 1 1 Bit 0 Bit 0 2 2 1 1 Bit 0 Bit 0 2 2 1 1 Bit 0 Bit 0 2 2 1 1 Bit 0 Bit 0 Indeterminate after reset 4 4 3 3 Indeterminate after reset 4 4 3 3 Indeterminate after reset 4 4 3 3 Indeterminate after reset M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers Analog Input to 8-Bit Result Translation Table (1) Bit 7 6 5 4 3 2 1 Bit 0 50% 25% 12.5% 6.25% 3.12% 1.56% 0.78% 0.39% Volts (2) 2.500 1.250 0.625 0.3125 0.1562 0.0781 0.0391 0.0195 Volts (3) 1.65 8.25 0.4125 0.2063 0.1031 0.0516 0.0258 0.0129 % 1. % of VRH–VRL 2. Voltages for VRL = 0; VRH = 5.0 V 3. Voltages for VRL = 0; VRH = 3.3 V Baud Rate Control Register (BAUD) Address: $102B Read: Write: Bit 7 6 5 4 3 2 1 Bit 0 TCLR SCP2 SCP1 SCP0 RCKB SCR2 SCR1 SCR0 0 0 0 0 0 U U U Reset: U = Unaffected TCLR — Clear Baud Rate Counter (Test) SCP[2:0] — SCI Baud Rate Prescaler Select SCP2 applies to the MC68HC(7)11E20 only. When SCP2 = 1, SCP[1:0] must equal 0. Any other values for SCP[1:0] are not decoded in the prescaler and the results are unpredictable. SCP 2(1) 1 0 Divide Internal Clock By Crystal Frequency (MHz) 0 0 0 1 62500 76800 125000 131072 187500 0 0 1 3 20833 25600 41667 43691 62500 0 1 0 4 15625 19200 31250 32768 46875 4.0 4.9152 8.0 8.3886 12.0 0 1 1 13 4800 5907 9600 10082 14423 1 0 0 39 1602 1969 3205 3361 4808 1. Shaded areas apply to MC68HC(7)11E20 only. RCKB — SCI Baud Rate Clock Check (TEST) MOTOROLA M68HC11E Series Programming Reference Guide 29 M68HC11ERG/AD SCR[2:0] — SCI Baud Rate Selects Selects receiver and transmitter bit rate based on output from baud rate prescaler stage. Refer to SCI baud rate generator block diagram. Divide Prescaler By 1 2 4 8 16 32 64 128 SCR 2 0 0 0 0 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 Highest Baud Rate (Prescaler Output from Previous Table 131072 76800 32768 19200 131072 76800 32768 19200 65536 38400 16384 9600 32768 19200 8192 4800 16384 9600 4096 2400 8192 480 2048 1200 4096 2400 1024 600 2048 1200 512 300 1024 600 256 150 4800 4800 2400 1200 600 300 150 75 37.5 Block Protect Register (BPROT) Address: Read: Write: Reset: $1035 Bit 7 0 6 5 0 0 = Unimplemented 4 3 2 1 Bit 0 PTCON BPRT3 BPRT2 BPRT1 BPRT0 1 1 1 1 1 Bits [7:5] — Unimplemented Always read 0 PTCON — Protect CONFIG Register 0 = CONFIG register can be programmed or erased normally. 1 = CONFIG register cannot be programmed or erased. BPRT[3:0] — Block Protect for EEPROM Block protect register bits can be written to 0 (protection disabled) only once within 64 cycles of a reset in normal modes, or at any time in special modes. Block protect register bits can be written to 1 (protection enabled) at any time. 0 = Protection disabled for associated block 1 = Protection enabled for associated block Bit Name BPRT0 BPRT1 BPRT2 BPRT3 Block Protected $B600–$B61F $B620–$B65F $B660–$B6DF $B6E0–$B7FF MC68HC811E2 Only Block Size 32 bytes 64 bytes 128 bytes 288 bytes BPRT0 $x800–$x9FF(1) 512 bytes BPRT1 $xA00–$xBFF(1) 512 bytes BPRT2 $xC00–$xDFF(1) 512 bytes BPRT3 (1) 512 bytes $xE00–$xFFF 1. x is determined by the value of EE[3:0] in CONFIG (MC68HC811E2 only). Refer to the MC68HC811E2 CONFIG register. 30 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers Timer Compare Force Register (CFORC) Address: Read: Write: $100B Bit 7 6 5 4 3 FOC1 FOC2 FOC3 FOC4 FOC5 0 0 0 0 0 Reset: 2 1 Bit 0 0 0 0 = Unimplemented FOC[1:5] — Force Output Comparison Write 1s to force compare(s). 0 = Not affected 1 = Output x action occurs Bits [2:0] — Unimplemented Always read 0 Configuration Register (CONFIG) Security disable, COP, ROM mapping, and EEPROM enables Address: $103F Bit 7 6 5 4 Read: Write: Resets: Single chip: Bootstrap: Expanded: Test: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 2 1 Bit 0 NOSEC NOCOP ROMON EEON U U 1 1 U U(L) U U(L) 1 U U U U U U U = Unimplemented U indicates a previously programmed bit. U(L) indicates that the bit resets to the logic level held in the latch prior to reset, but the function of COP is controlled by the DISR bit in TEST1 register. The following register description applies to the MC68HC11E2 only. Address: Read: Write: Resets: Single chip: Bootstrap: Expanded: Test: $103F Bit 7 6 5 4 3 2 EE3 EE2 EE1 EE0 NOSEC NOCOP 1 1 U U 1 1 U U 1 1 U U 1 1 U U U U 1 1 U U(L) U U(L) 1 Bit 0 EEON 1 1 1 1 1 1 U 0 = Unimplemented U indicates a previously programmed bit. U(L) indicates that the bit resets to the logic level held in the latch prior to reset, but the function of COP is controlled by the DISR bit in TEST1 register. MOTOROLA M68HC11E Series Programming Reference Guide 31 M68HC11ERG/AD EE[3:0] — EEPROM Map Position (MC68HC811E2 only) EE[3:0] determine the upper four bits of EEPROM address, positioning EEPROM at the selected 4-Kbyte boundary. In single-chip and boot modes, these bits are set to 1s during reset and EEPROM is mapped to top of memory. Not implemented in other E-series devices; always read 0. Refer to the following table. EE3 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 EE1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 EE2 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 EE0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 EEPROM Location $0800–$0FFF $1800–$1FFF $2800–$2FFF $3800–$3FFF $4800–$4FFF $5800–$5FFF $6800–$6FFF $7800–$7FFF $8800–$8FFF $9800–$9FFF $A800–$AFFF $B800–$BFFF $C800–$CFFF $D800–$DFFF $E800–$EFFF $F800–$FFFF NOSEC — Security Disable NOSEC is invalid unless the security mask option is specified before the MCU is manufactured. If the security mask option is omitted NOSEC always reads 1. The enhanced security feature is available in the MC68S711E9 MCU. The enhancement to the standard security feature protects the EPROM as well as RAM and EEPROM. 0 = RAM/EEPROM security mode enabled 1 = RAM/EEPROM security mode disabled NOCOP — COP System Disable Resets to programmed value. 0 = COP enabled (forces reset on timeout) 1 = COP disabled (does not force reset on timeout) ROMON — ROM/EPROM Enable In single-chip mode, ROMON is forced to 1 out of reset. ROMON does not apply to the MC68HC811E2. For devices with disabled ROM arrays (the MC68HC11E0, MC68HC11E1, MC68L11E0, or MC68L11E1) ROMON must never be set to 1. 0 = ROM/EPROM removed from the memory map 1 = ROM/EPROM present in the memory map EEON — EEPROM Enable 0 = EEPROM removed from the memory map 1 = EEPROM present in the memory map 32 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers Arm/Reset COP Timer Circuitry Register (COPRST) Address: Read: Write: Reset: $103A Bit 7 6 5 4 3 2 1 Bit 0 BIT 7 6 5 4 3 2 1 BIT 0 0 0 0 0 0 0 0 0 Write $55 to COPRST to arm COP watchdog clearing mechanism. Write $AA to COPRST to reset COP watchdog. Data Direction Register for Port C (DDRC) Address: Read: Write: Reset: $1007 Bit 7 6 5 4 3 2 1 Bit 0 DDC7 DDC6 DDC5 DDC4 DDC3 DDC2 DDC1 DDC0 0 0 0 0 0 0 0 0 DDC[7:0] — Data Direction for Port C In handshake output mode, DDRC bits selected the three-stated output option (DDCx = 1). 0 = Input 1 = Output Data Direction Register for Port D (DDRD) Address: $1009 Bit 7 6 Read: Write: Reset: 0 0 5 4 3 2 1 Bit 0 DDD5 DDD4 DDD3 DDD2 DDD1 DDD0 0 0 0 0 0 0 Unimplemented Bits [7:6] — Unimplemented Always read 0 DDD[5:0] — Data Direction for Port D 0 = Input 1 = Output EPROM Programming Control Register (EPROG) Address: $1036 Bit 7 Read: Write: Reset: 6 MBE 0 5 4 3 2 1 Bit 0 ELAT EXCOL EXROW T1 T0 PGM 0 0 0 0 0 0 0 = Unimplemented MOTOROLA M68HC11E Series Programming Reference Guide 33 M68HC11ERG/AD NOTE: EPROG is present only on the MC68HC711E20. MBE — Multiple-Byte Programming Enable When multiple-byte programming is enabled, address bit 5 is considered a don’t care so that bytes with address bit 5 = 0 and address bit 5 = 1 both get programmed. MBE can be read in any mode and always reads 0 in normal modes. MBE can be written only in special modes. 0 = EPROM array configured for normal programming 1 = Program two bytes with the same data Bit 6 — Unimplemented Always reads 0 ELAT — EPROM/OTPROM Latch Control When ELAT = 1, writes to EPROM cause address and data to be latched and the EPROM/OTPROM cannot be read. ELAT can be read any time. ELAT can be written any time except when PGM = 1; then the write to ELAT is disabled. 0 = EPROM/OTPROM address and data bus configured for normal reads 1 = EPROM/OTPROM address and data bus configured for programming EXCOL — Select Extra Columns 0 = User array selected 1 = User array is disabled and extra columns are accessed at bits [7:0]. Addresses use bits [13:5] and bits [4:0] are don’t care. EXCOL can be read and written only in special modes and always returns 0 in normal modes. EXROW — Select Extra Rows 0 = User array selected 1 = User array is disabled and two extra rows are available. Addresses use bits [7:0] and bits [13:8] are don’t care. EXROW can be read and written only in special modes and always returns 0 in normal modes. T[1:0] — EPROM Test Mode Select These bits allow selection of either gate stress or drain stress test modes. They can be read and written only in special modes and always read 0 in normal modes. T1 T0 Function Selected 0 0 Normal mode 0 1 Reserved 1 0 Gate stress 1 1 Drain stress PGM — EPROM Programming Voltage Enable PGM can be read any time and can be written only when ELAT = 1. 0 = Programming voltage to EPROM array disconnected 1 = Programming voltage to EPROM array connected 34 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers Highest Priority I Bit Interrupt and Miscellaneous (HPRIO) Address: $103C Bit 7 Read: RBOOT(1) Write: 6 5 4 3 2 1 Bit 0 SMOD(1) MDA(1) IRVNE PSEL3 PSEL2 PSEL1 PSEL0 Reset: 0 0 0 0 Single chip: Expanded: 0 0 1 0 Bootstrap: 1 1 0 0 Special test: 0 1 1 1 1. The values of the RBOOT, SMOD, and MDA reset bits RESET pin rising edge. 0 0 0 0 depend on 1 1 1 1 the mode 1 0 1 0 1 0 1 0 selected at the RBOOT — Read Bootstrap ROM Valid only when SMOD is set to 1 (bootstrap or special test mode). Can only be written in special modes. 0 = Bootloader ROM disabled and not in map 1 = Bootloader ROM enabled and in map at $BE00–$BFFF SMOD and MDA — Special Mode Select and Mode Select A The initial value of SMOD is in the inverse of the logic level present on the MODB pin at the rising edge of reset. The initial value of MDA equals the logic level present on the MODA pin at the rising edge of reset. These two bits can be read at any time. They can be written anytime in special modes. MDA can only be written once in normal modes. SMOD cannot be set once it has been cleared. Refer to the following table. Inputs MODB 1 1 0 0 MODA 0 1 0 1 Mode Single chip Expanded Bootstrap Special test Latched at Reset SMOD MDA 0 0 0 1 1 0 1 1 IRVNE — Internal Read Visibility/Not E (IRV in MC68HC811E2) IRVNE can be written once in any mode. In expanded modes, IRVNE determines whether IRV is on or off. In special test mode, IRVNE is reset to 1. For the MC68HC811E2, this bit controls only internal read visibility function and has no meaning or effect in single-chip modes. 0 = No internal read visibility on external bus 1 = Data from internal reads is driven out the external data bus In single-chip modes this bit determines whether the E clock drives out from the chip. 0 = E is driven out from the chip. 1 = E pin is driven low. Refer to the following table. Mode Single chip Expanded Bootstrap Special test MOTOROLA IRVNE Out of Reset 0 0 0 1 E Clock Out of Reset On On On On IRV Out of Reset Off Off Off On M68HC11E Series Programming Reference Guide IRVNE Affects Only E IRV E IRV IRVNE Can Be Written Once Once Once Once 35 M68HC11ERG/AD NOTE: When IRV function is used, care must be taken to ensure that bus conflicts do not occur. Data can be driven onto the bus even though the R/W line indicates a high-impedance state on data bus pins. PSEL[3:0] — Priority Select Can be written only while bit I in the CCR is set (interrupts disabled). These bits select one interrupt source to be elevated above all other I bit related sources. Refer to the following table. PSEL3 PSEL2 PSEL1 PSEL0 0 0 0 0 Interrupt Source Promoted Timer overflow 0 0 0 1 Pulse accumulator overflow 0 0 1 0 Pulse accumulator input edge 0 0 1 1 SPI serial transfer complete 0 1 0 0 SCI serial system 0 1 0 1 Reserved (default to IRQ) 0 1 1 0 IRQ (external pin or parallel I/O) 0 1 1 1 Real-time interrupt 1 0 0 0 Timer input capture 1 1 0 0 1 Timer input capture 2 1 0 1 0 Timer input capture 3 1 0 1 1 Timer output compare 1 1 1 0 0 Timer output compare 2 1 1 0 1 Timer output compare 3 1 1 1 0 Timer output compare 4 1 1 1 1 Timer input capture 4/output compare 5 RAM and Register Mapping (INIT) Address: Read: Write: Reset: $103D Bit 7 6 5 4 3 2 1 Bit 0 RAM3 RAM2 RAM1 RAM0 REG3 REG2 REG1 REG0 0 0 0 0 0 0 0 1 RAM[3:0] — Internal RAM Map Position Determine the upper four bits of RAM address. At reset, RAM is mapped to $0000. RAM[3:0] 0000 0001 0010 0011 0100 0101 0110 0111 36 Address $0000–$0xFF $1000–$1xFF $2000–$2xFF $3000–$3xFF $4000–$4xFF $5000–$5xFF $6000–$6xFF $7000–$7xFF RAM[3:0] 1000 1001 1010 1011 1100 1101 1110 1111 M68HC11E Series Programming Reference Guide Address $8000–$8xFF $9000–$9xFF $A000–$AxFF $B000–$BxFF $C000–$CxFF $D000–$DxFF $E000–$ExFF $F000–$FxFF MOTOROLA M68HC11ERG/AD M68HC11E Series Registers REG[3:0] — 64-Byte Register Block Map Position Determine upper four bits of register space address. At reset, registers are mapped to $1000. NOTE: REG[3:0] Address REG[3:0] Address 0000 $0000–$003F 1000 $8000–$803F 0001 $1000–$103F 1001 $9000–$903F 0010 $2000–$203F 1010 $A000–$A03F 0011 $3000–$303F 1011 $B000–$B03F 0100 $4000–$403F 1100 $C000–$C03F 0101 $5000–$503F 1101 $D000–$D03F 0110 $6000–$603F 1110 $E000–$E03F 0111 $7000–$703F 1111 $F000–$F03F Can be written only once in first 64 cycles out of reset in normal modes or at any time in special modes. Output Compare 1 Data Register (OC1D) Address: Read: Write: Reset: $100D Bit 7 6 5 4 3 OC1D7 OC1D6 OC1D5 OC1D4 OC1D3 0 0 0 0 0 2 1 Bit 0 0 0 0 Unimplemented If OC1Mx is set, data in OC1Dx is output to port A bit x on successful OC1 compares. Bits [2:0]— Unimplemented Always reads 0 Output Compare 1 Mask Register (OC1M) Address: Read: Write: Reset: $100C Bit 7 6 5 4 3 OC1M7 OC1M6 OC1M5 OC1M4 OC1M3 0 0 0 0 0 2 1 Bit 0 0 0 0 Unimplemented OC1M[7:3] — Output Compare Masks 0 = OC1 disabled 1 = OC1 enabled to control the corresponding pin of port A Bits [2:0]— Unimplemented Always reads 0 MOTOROLA M68HC11E Series Programming Reference Guide 37 M68HC11ERG/AD System Configuration Options (OPTION) Address: Read: Write: $1039 Bit 7 6 5 4 3 ADPU CSEL IRQE(1) DLY(1) CME 0 0 0 1 0 Reset: 2 0 1 Bit 0 CR1(1) CR0(1) 0 0 1. Can be written only once in first 64 cycles out of reset in normal modes or at any time during special modes. = Unimplemented ADPU — Analog-to-Digital (A/D) Converter Power-Up 0 = A/D powered down 1 = A/D powered up CSEL — Clock Select 0 = A/D and EEPROM charge pumps use system E clock 1 = A/D and EEPROM charge pumps use internal RC oscillator IRQE — IRQ Select Edge-Sensitive Only 0 = Low level recognition 1 = Falling edge recognition DLY — Enable Oscillator Startup Delay on Exit from Stop Mode 0 = No stabilization delay on exit from stop mode 1 = Stabilization delay enabled on exit from stop mode CME — Clock Monitor Enable 0 = Clock monitor disabled; slow clocks can be used 1 = Slow or stopped clocks cause clock failure reset Bit 2 — Not implemented Always reads 0 CR[1:0] — COP Timer Rate Select Refer to the following table. CR[1:0] Divide E/215 By XTAL = 4.0 MHz Timeout – 0 ms, + 32.8 ms XTAL = 8.0 MHz Timeout – 0 ms, + 16.4 ms XTAL = 12.0 MHz Timeout – 0 ms, + 10.9 ms XTAL = 16.0 MHz Timeout – 0 ms, + 8.2 ms 00 1 32.768 ms 16.384 ms 10.923 ms 8.19 ms 01 4 131.072 ms 65.536 ms 43.691 ms 32.8 ms 10 16 524.28 ms 262.14 ms 174.76 ms 131 ms 11 64 2.098 s 1.049 s 699.05 ms 524 ms E= 1.0 MHz 2.0 MHz 3.0 MHz 4.0 MHz Pulse Accumulator Counter (PACNT) Address: Read: Write: Reset: 38 $1027 Bit 7 6 5 4 3 2 1 Bit 0 BIT 7 6 5 4 3 2 1 BIT 0 Unaffected by reset M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers Pulse Accumulator Control (PACTL) Address: Read: Write: $1026 Bit 7 6 5 4 3 2 1 Bit 0 DDRA7 PAEN PAMOD PEDGE DDRA3 I4/O5 RTR1 RTR0 0 0 0 0 0 0 0 0 Reset: DDRA7 — Data Direction for Port A Bit 7 0 = Input only 1 = Output PAEN — Pulse Accumulator System Enable 0 = Pulse accumulator disabled 1 = Pulse accumulator enabled PAMOD — Pulse Accumulator Mode 0 = Event counter 1 = Gated time accumulation PEDGE — Pulse Accumulator Edge Control Refer to the following table. PAMOD PEDGE Action on Clock 0 0 PAI falling edge increments the counter. 0 1 PAI rising edge increments the counter. 1 0 A zero on PAI inhibits counting. 1 1 A one on PAI inhibits counting. DDRA3 — Data Direction for Port A Bit 3 Overridden if an output compare function is configured to control the PA3 pin. 0 = Input 1 = Output I4/O5 — Input Capture 4/Output Compare 5 Configure TI4/O5 for input capture or output compare 0 = OC5 enabled 1 = IC4 enabled RTR[1:0] — Real-Time Interrupt (RTI) Rate Refer to the following table. MOTOROLA RTR1 RTR0 E = 3 MHz E = 2 MHz E = 1 MHz E = X MHz 0 0 2.731 ms 4.096 ms 8.192 ms (E/213) 0 1 5.461 ms 8.192 ms 16.384 ms (E/214) 1 0 10.923 ms 16.384 ms 32.768 ms (E/215) 1 1 21.845 ms 32.768 ms 65.536 ms (E/216) M68HC11E Series Programming Reference Guide 39 M68HC11ERG/AD Parallel I/O Control (PIOC) Address: $1002 Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 STAF STAI CWOM HNDS OIN PLS EGA INVB 0 0 0 0 0 U 1 1 U = Unaffected STAF — Strobe A Interrupt Status Flag STAF is set when the selected edge occurs on strobe A. This bit can be cleared by a read of PIOC with STAF set followed by a read of PORTCL (simple strobed or full input handshake mode) or a write to PORTCL (output handshake mode). 0 = No active edge detected 1 = Selected active edge detected STAI — Strobe A Interrupt Enable Mask 0 = STAF does not request interrupt 1 = STAF requests interrupt CWOM — Port C Wired-OR Mode (affects all eight port C pins) 0 = Port C outputs are normal CMOS outputs. 1 = Port C outputs are open-drain outputs. HNDS — Handshake Mode Bit 0 = Simple strobe mode 1 = Full input or output handshake mode OIN — Output or Input Handshake Select HNDS must be set to 1 for this bit to have meaning. 0 = Input handshake 1 = Output handshake PLS — Pulsed/Interlocked Handshake Operation HNDS must be set to 1 for this bit to have meaning. When interlocked handshake is selected, strobe B is active until the selected edge of strobe A is detected. 0 = Interlocked handshake 1 = Pulsed handshake (Strobe B pulses high for two E-clock cycles.) EGA — Active Edge for Strobe A 0 = STRA falling edge selected 1 = STRA rising edge selected INVB — Invert Strobe B 0 = Active level is logic 0. 1 = Active level is logic 1. 40 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers STAF Clearing Sequence Simple strobed mode Read PIOC with STAF = 1 then read PORTCL Full-input handshake mode Read PIOC with STAF = 1 then read PORTCL Fulloutput handshake mode Read PIOC with STAF = 1 then write PORTCL HNDS OIN PLS EGA Port B 0 0 X X 1 1 0 1 1 0 = STRB active level 1 = STRB active pulse 0 = STRB active level 1 = STRB active pulse 1 0 0 Port C Driven 1 STRA Follow Active Edge Follow DDRC DDRC Port C Inputs latched into PORTCL on any active edge on STRA STRB pulses on writes to PORTB Inputs latched into PORTCL on any active edge on STRA Normal output port, unaffected in handshake modes Driven as outputs if STRA at active level; follows DDRC if STRA not at active level Normal output port, unaffected in handshake modes Port A Data Register (PORTA) Address: $1000 Read: Write: Reset: Alt. Pin Function: And/OR NOTE: Bit 7 6 5 4 3 2 1 Bit 0 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0 I PAI OC1 0 OC2 OC1 0 OC3 OC1 0 OC4 OC1 I OC5/IC4 OC1 I IC1 — I IC2 — I IC3 — I/O pins configured as high-impedance inputs have port data that is indeterminate. The contents of the corresponding latches are dependent upon the electrical state of the pins during reset. This is indicated by an “I” in the port description. Port B Data Register (PORTB) Address: $1004 Read: Write: Reset: Single Chip or Boot: Expanded or Test: MOTOROLA Bit 7 6 5 4 3 2 1 Bit 0 PB7 PB6 PB5 PB4 PB3 PB2 PB2 PB0 0 PB7 ADDR15 0 PB6 ADDR14 0 PB5 ADDR13 0 PB4 ADDR12 0 PB3 ADDR11 0 PB2 ADDR10 0 PB1 ADDR9 0 PB0 ADDR8 M68HC11E Series Programming Reference Guide 41 M68HC11ERG/AD Port C Data Register (PORTC) Address: $1003 Read: Write: Reset: Single Chip or Boot: Expanded or Test: Bit 7 6 5 4 3 2 1 Bit 0 PC7 PC6 PC5 PC4 PC3 PC2 PC2 PC0 0 PC7 DATA7 0 PC6 DATA6 0 PC5 DATA5 0 PC4 DATA4 0 PC3 DATA3 0 PC2 DATA2 0 PC1 DATA1 0 PC0 DATA0 Bit 7 6 5 4 3 2 1 Bit 0 PCL7 PCL6 PCL5 PCL4 PCL3 PCL2 PCL1 PCL0 Port C Latched Data Register (PORTCL) Address: $1005 Read: Write: Reset: Indeterminate after reset Port D Data Register (PORTD) Address: $1008 Bit 7 6 Read: Write: Reset: Alt. Pin Function 0 — 5 4 3 2 1 Bit 0 PD5 PD4 PD3 PD2 PD1 PD0 I SS I SCK I TxD I RxD 0 — I I SDO/MOSI SDI/MISO = Unimplemented Port E Data Register (PORTE) Address: $100A Read: Write: Reset: Alt. Pin Function Bit 7 6 5 4 3 2 1 Bit 0 PE7 PE6 PD5 PE4 PE3 PE2 PE1 PE0 I AN7 I AN6 I AN5 I AN4 I AN3 I AN2 I AN1 I AN0 EEPROM Programming Control Register (PPROG) Address: $103B Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 ODD EVEN ELAT(1) BYTE ROW ERASE EELAT EPGM 0 0 0 0 0 0 0 0 1. MC68HC711E9 and MC68S711E9 only ODD — Program Odd Rows in Half of EEPROM (TEST) EVEN — Program Even Rows in Half of EEPROM (Test) Bit 42 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers ELAT — EPROM/OTPROM Latch Control Implemented on MC68HC711E9 only 0 = EPROM/OTPROM address and data bus configured for normal reads and cannot be programmed 1 = EPROM/OTPROM address and data bus configured for programming and cannot be read BYTE — Byte/Other EEPROM Erase Mode 0 = Row or bulk erase mode used 1 = Erase only one byte of EEPROM ROW — Row/All EEPROM Erase Mode Only valid when BYTE = 0 0 = Erase all of EEPROM 1 = Erase only one 16-byte row of EEPROM BYTE ROW Action 0 0 Bulk erase (all bytes) 0 1 Row erase (16 bytes) 1 0 Byte erase 1 1 Byte erase ERASE — Erase/Normal Control for EEPROM 0 = Normal read or program mode 1 = Erase mode EELAT — EEPROM Latch Control 0 = EEPROM address and data bus configured for normal reads 1 = EEPROM address and data bus configured for programming or erasing EPGM —EPROM/EEPROM Programming Voltage Enable 0 = Programming voltage to array disconnected (EEPROM only on MC68HC(7)11E20) 1 = Programming voltage to array connected (EEPROM only on MC68HC(7)11E20) Serial Communication Interface Control Register 1 (SCCR1) Address: $102C Read: Write: Reset: Bit 7 6 R8 T8 I 5 I 0 = Unimplemented 4 3 2 1 Bit 0 0 0 0 0 M 0 R8 — Receive Data Bit 8 0 = SCI receiver configured for 8-bit data characters. 1 = If M bit is set, R8 stores the ninth data bit in the receive data character. MOTOROLA M68HC11E Series Programming Reference Guide 43 M68HC11ERG/AD T8 — Transmit Data Bit 8 0 = SCI transmitter configured for 8-bit data characters. 1 = If M bit is set, R8 stores the ninth data bit in the transmit data character. Bit 5 — Unimplemented Always reads 0 M — Mode Bit (select character format) 0 = Start bit, 8 data bits, 1 stop bit 1 = Start bit, 9 data bits, 1 stop bit WAKE — Wakeup by Address Mark/Idle 0 = Wakeup by IDLE line recognition 1 = Wakeup by address mark (most significant data bit set) Bits [2:0] — Unimplemented Always read 0 Serial Communications Interface Control Register 2 (SCCR2) Address: $102D Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 TIE TCIE RIE ILIE TE RE RWU SBK 0 0 0 0 0 0 0 0 TIE — Transmit Interrupt Enable 0 = TDRE interrupts disabled 1 = SCI interrupt requested when TDRE status flag is set TCIE — Transmit Complete Interrupt Enable 0 = TC interrupts disabled 1 = SCI interrupt requested when TC status flag is set RIE — Receiver Interrupt Enable 0 = RDRF and OR interrupts disabled 1 = SCI interrupt requested when RDRF flag or the OR status flag is set ILIE — Idle-Line Interrupt Enable 0 = IDLE interrupts disabled 1 = SCI interrupt requested when IDLE status flag is set TE — Transmitter Enable 0 = Transmitter disabled 1 = Transmitter enabled RE — Receiver Enable 0 = Receiver disabled 1 = Receiver enabled RWU — Receiver Wakeup Control 0 = Normal SCI receiver 1 = Wakeup enabled and receiver interrupts inhibited SBK — Send Break 0 = Break generator off 1 = Break codes generated as long as SBK = 1 44 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers Serial Communications Interface Data Register (SCDR) Address: $102F Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 R7/T7 R6/T6 R5/T5 R4/T4 R3/T3 R2/T2 R1/T1 R0/T0 I I I I I I I I R[7:0]/T[7:0] — Receiver/Transmitter Data Bits [7:0] Receive and transmit are double buffered. Reads access the receive data buffer, and writes access the transmit data buffer. When the M bit in SCCR1 is set, R8 and T8 in SCCR1 store the ninth bit in receive and transmit data characters. Serial Communications Interface Status Register (SCSR) Address: $102E Read: Write: Reset: Bit 7 6 5 4 3 2 1 TDRE TC RDRF IDLE OR NF FE 1 0 0 0 0 0 1 Bit 0 0 = Unimplemented TDRE — Transmit Data Register Empty Flag This flag is set when SCDR is empty. Clear the TDRE flag by reading SCSR with TDRE set and then writing to SCDR. 0 = SCDR busy 1 = SCDR empty TC — Transmit Complete Flag This flag is set when the transmitter is idle (no data, preamble, or break transmission in progress). Clear the TC flag by reading SCSR with TC set and then writing to SCDR. 0 = Transmitter busy 1 = Transmitter idle RDRF — Receive Data Register Full Flag This flag is set if a received character is ready to be read from SCDR. Clear the RDRF flag by reading SCSR with RDRF set and then reading SCDR. 0 = SCDR empty 1 = SCDR full IDLE — Idle Line Detected Flag This flag is set if the RxD line is idle. Once cleared, IDLE is not set again until the RxD line has been active and becomes idle again. The IDLE flag is inhibited when RWU = 1. Clear IDLE by reading SCSR with IDLE set and then reading SCDR. 0 = RxD line active 1 = RxD line idle MOTOROLA M68HC11E Series Programming Reference Guide 45 M68HC11ERG/AD OR — Overrun Error Flag OR is set if a new character is received before a previously received character is read from SCDR. Clear the OR flag by reading SCSR with OR set and then reading SCDR. 0 = No overrun 1 = Overrun detected NF — Noise Error Flag NF is set if majority sample logic detects anything other than a unanimous decision. Clear NF by reading SCSR with NF set and then reading SCDR. 0 = Unanimous decision 1 = Noise detected FE — Framing Error Flag FE is set when a 0 is detected where a stop bit was expected. Clear the FE flag by reading SCSR with FE set and then reading SCDR. 0 = Stop bit detected 1 = Zero detected Bit 0 — Unimplemented Always reads 0 Serial Peripheral Interface Control Register (SPCR) Address: $1028 Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 SPIE SPE DWOM MSTR CPOL CPHA SPR1 SPR0 0 0 0 0 0 1 U U SPIE — Serial Peripheral Interrupt Enable 0 = SPI interrupts disabled 1 = SPI interrupts enabled SPE — Serial Peripheral System Enable 0 = SPI off 1 = SPI on DWOM — Port D Wired-OR Mode Option for Port D Pins PD[5:0] 0 = Normal CMOS outputs 1 = Open-drain outputs MSTR — Master Mode Select 0 = Slave mode 1 = Master mode CPOL, CPHA — Clock Polarity, Clock Phase Refer to Figure 7 SPR[1:0] — SPI Clock Rate Select See the following table. 46 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers SPR1 SPR0 Divide E Clock By Frequency at E = 1 MHz (Baud) Frequency at E = 2 MHz (Baud) Frequency at E = 3 MHz (Baud) Frequency at E = 4 MHz (Baud) 0 0 2 500 kHz 1.0 MHz 1.5 MHz 2 MHz 0 1 4 250 kHz 500 kHz 750 kHz 1 MHz 1 0 16 62.5 kHz 125 kHz 187.5 kHz 250 kHz 1 1 32 31.3 kHz 62.5 kHz 93.8 kHz 125 kHz SCK CYCLE # 1 2 3 4 5 6 7 8 SCK (CPOL = 0) SCK (CPOL = 1) SAMPLE INPUT MSB (CPHA = 0) DATA OUT 6 5 4 3 2 1 LSB SAMPLE INPUT MSB (CPHA = 1) DATA OUT 6 5 4 3 2 1 LSB SS (TO SLAVE) SLAVE CPHA = 1 TRANSFER IN PROGRESS 3 MASTER TRANSFER IN PROGRESS 2 4 SLAVE CPHA = 0 TRANSFER IN PROGRESS 1 5 1. SS ASSERTED 2. MASTER WRITES TO SPDR 3. FIRST SCK EDGE 4. SPIF SET 5. SS NEGATED Figure 7. Serial Peripheral Interface Transfer Format Serial Peripheral Interface Data Register (SPDR) Address: $102A Read: Write: Bit 7 6 5 4 3 2 1 Bit 0 BIT 7 6 5 4 3 2 1 BIT 0 SPI is double buffered in, single buffered out. MOTOROLA M68HC11E Series Programming Reference Guide 47 M68HC11ERG/AD Serial Peripheral Interface Status Register (SPSR) Address: $1029 Read: Write: Reset: Bit 7 6 SPIF WCOL 0 5 4 3 2 1 Bit 0 0 1 U U MODF 0 0 0 = Unimplemented SPIF — SPI Transfer Complete Flag This flag is set when an SPI transfer is complete (after eight SCK cycles in a data transfer). Clear this flag by reading SPSR (with SPIF = 1), then access SPDR. 0 = No SPI transfer complete or SPI transfer still in progress 1 = SPI transfer complete WCOL — Write Collision This flag is set if the MCU tries to write data into SPDR while an SPI data transfer is in progress. Clear this flag by reading SPSR (with WCOL = 1), then access SPDR. 0 = No write collision error 1 = SPDR written while SPI transfer in progress Bit 5 — Unimplemented Always reads 0 MODF — Mode Fault (Mode fault terminates SPI operation) MODF is set when SS is pulled low while MSTR = 1. Clear this flag by reading SPCR with MODF set, then write to SPCR. 0 = No mode fault error 1 = SS pulled low in master mode Bits [3:0] — Unimplemented Always reads 0 Timer Count Register (TCNT) Address: $100E — High Bit 7 6 Read: BIT 15 14 Write: Reset: 0 0 Address: $100F — Low Bit 7 6 Read: BIT 7 6 Write: Reset: 0 0 = Unimplemeted 5 3 2 1 Bit 0 13 4 12 11 10 9 BIT 8 0 0 0 0 0 0 5 4 4 3 2 1 Bit 0 5 3 2 1 BIT 0 0 0 0 0 0 0 In normal modes, TCNT is a read-only register. 48 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers Timer Control Register 1 (TCTL1) Address: $1020 Read: Write: Bit 7 6 5 4 3 2 1 Bit 0 OM2 OL2 OM3 OL3 OM4 OL4 OM5 OL5 0 0 0 0 0 0 0 0 Reset: OM[2:5] — Output Mode OL[2:5] — Output Level OMx OLx 0 0 Timer disconnected from output pin logic Action Taken on Successful Compare 0 1 Toggle OCx output line 1 0 Clear OCx output line to 0 1 1 Set OCx output line to 1 Timer Control Register 2 (TCTL2) Address: $1021 Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 EDG4B EDG4A EDG1B EDG1A EDG2B EDG1B EDG3B EDG3A 0 0 0 0 0 0 0 0 EDGxB EDGxA 0 0 Capture disabled Configuration 0 1 Capture on rising edges only 1 0 Capture on falling edges only 1 1 Capture on any edge Factory Test Register (TEST1) Address: $103E Bit 7 Read: Write: Reset: 6 TILOP 0 5 4 3 2 1 Bit 0 OCCR CBYP DISR FCM FCOP TCON 0 0 — 0 0 0 0 = Unimplemented TILOP — Test Illegal Opcode (Test modes only) Bit 6 — Unimplemented Always reads 0 OCCR — Output Condition Code Register to Timer Port (Test modes only) CBYP — Timer Divider Chain Bypass (Test modes only) DISR — Disable Reset from COP and Clock Monitor (Special modes only (SMOD = 1)) MOTOROLA M68HC11E Series Programming Reference Guide 49 M68HC11ERG/AD FCM — Force Clock Monitor Failure (Test modes only) FCOP — Force COP Watchdog Failure (Test modes only) TCON — Test Configuration (Test modes only) Timer Interrupt Flag 1 Register (TFLG1) Address: $1023 Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 OC1F OC2F OC3F OC4F IR/O5F IC1F 1C2F IC3F 0 0 0 0 0 0 0 0 Clear flags by writing a 1 to the corresponding bit position(s). OC1F–OC4F — Output Compare x Flag Set each time the counter matches output compare x value. I4/O5F — Input Capture 4/Output Compare 5 Flag Set by IC4 or OC5, depending on which function was enabled by I4/O5 of PACTL. IC1F–IC3F — Input Capture x Flag Set each time a selected active edge is detected on the ICx input line. Timer Interrupt Flag 2 Register (TFLG2) Address: $1025 Read: Write: Reset: Bit 7 6 5 4 TOF RTIF PAOVF PAIF 0 0 0 0 3 2 1 Bit 0 0 0 0 0 = Unimplemented Clear flags by writing a 1 to the corresponding bit position(s). TOF — Timer Overflow Flag Set when TCNT changes from $FFFF to $0000 RTIF — Real-Time (Periodic) Interrupt Flag The RTIF status bit is automatically set to 1 at the end of every RTI period. To clear RTIF, write a byte to TFLG2 with bit 6 set. PAOVF — Pulse Accumulator Overflow Flag Set when PACNT changes from $FF to $00 PAIF — Pulse Accumulator Input Edge Flag Set each time a selected active edge is detected on the PAI input line. Bits [3:0] — Unimplemented Always reads 0 50 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11E Series Registers Timer Input Capture 4/Output Compare 5 Register (TI4/O5) Address: $101E — High Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 BIT 15 BIT 14 BIT 13 BIT 12 BIT 11 BIT 10 BIT 9 BIT 8 1 1 1 1 1 1 1 1 Bit 7 6 5 4 3 2 1 Bit 0 BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 1 1 1 1 1 1 1 1 5 4 3 2 1 Bit 0 BIT 13 BIT 12 BIT 11 BIT 10 BIT 9 BIT 8 Address: $101F — Low Read: Write: Reset: Timer Input Capture Registers (TIC1–TIC3) TIC1 — Address: $1010 — High Bit 7 6 Read: BIT 15 BIT 14 Write: Reset: Address: $1011 — Low Bit 7 6 Read: BIT 7 BIT 6 Write: Reset: TIC2 — Address: $1012 — High Bit 7 6 Read: BIT 15 BIT 14 Write: Reset: Address: $1013 — Low Bit 7 6 Read: BIT 7 BIT 6 Write: Reset: TIC3 — Address: $1014 — High Bit 7 6 Read: BIT 15 BIT 14 Write: Reset: Address: $1015 — Low Read: Write: Reset: MOTOROLA Unaffected by reset 5 4 3 2 1 Bit 0 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 Unaffected by reset 5 4 3 2 1 Bit 0 BIT 13 BIT 12 BIT 11 BIT 10 BIT 9 BIT 8 Unaffected by reset 5 4 3 2 1 Bit 0 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 Unaffected by reset 5 4 3 2 1 Bit 0 BIT 13 BIT 12 BIT 11 BIT 10 BIT 9 BIT 8 Unaffected by reset Bit 7 6 5 4 3 2 1 Bit 0 BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 Unaffected by reset M68HC11E Series Programming Reference Guide 51 M68HC11ERG/AD Timer Interrupt Mask Register 1 (TMSK1) Address: $1022 Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 OC1I OC2I OC3I OC4I I4/O5I IC1I IC2I IC3I 0 0 0 0 0 0 0 0 OC1I–OC4I — Output Compare x Interrupt Enable If the OCxI enable bit is set when the OCxF flag bit is set, a hardware interrupt sequence is requested. I4/O5I — Input Capture 4/Output Compare 5 Interrupt Enable When I4/O5 in PACTL is 1, I4/O5I is the input capture 4 interrupt enable bit. When I4/O5 in PACTL is 0, I4/O5I is the output compare 5 interrupt enable bit. IC1I–IC3I — Input Capture x Interrupt Enable If the ICxI enable bit is set when the ICxF flag bit is set, a hardware interrupt sequence is requested. Timer Interrupt Mask Register 2 (TMSK2) Address: $1024 Read: Write: Reset: Bit 7 6 5 4 TOI RTII PAOVI PAII 0 0 0 = Unimplemented 0 3 0 2 0 1 Bit 0 PR1 PR0 0 0 TOI — Timer Overflow Interrupt Enable 0 = TOF interrupts disabled 1 = Interrupt requested when TOF is set to 1 RTII — Real-Time Interrupt Enable 0 = RTIF interrupts disabled 1 = Interrupt requested when RTIF is set to 1 PAOVI — Pulse Accumulator Input Edge Interrupt Enable 0 = PAOVF interrupts disabled 1 = Interrupt requested when PAOVF is set to 1 PAII — Pulse Accumulator Input Edge Interrupt Enable 0 = PAIF interrupts disabled 1 = Interrupt requested when PAIF is set to 1 Bits [3:2] — Unimplemented Always reads 0 PR[1:0] — Timer Prescaler Select In normal modes, PR1 and PR0 can only be written once, and the write must occur within 64 cycles after reset. PR1 0 0 1 1 52 PR0 0 1 0 1 M68HC11E Series Programming Reference Guide Prescaler ÷1 ÷4 ÷8 ÷ 16 MOTOROLA M68HC11ERG/AD M68HC11E Series Registers Timer Output Compare Registers (TOC1–TOC4) TOC1 — Address: $1016 — High Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 BIT 15 BIT 14 BIT 13 BIT 12 BIT 11 BIT 10 BIT 9 BIT 8 1 1 1 1 1 1 1 1 Bit 7 6 5 4 3 2 1 Bit 0 BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 1 1 1 1 1 1 1 1 Address: $1017 — Low Read: Write: Reset: TOC2 — Address: $1018 — High Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 BIT 15 BIT 14 BIT 13 BIT 12 BIT 11 BIT 10 BIT 9 BIT 8 1 1 1 1 1 1 1 1 Bit 7 6 5 4 3 2 1 Bit 0 BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 1 1 1 1 1 1 1 1 Address: $1019 — Low Read: Write: Reset: TOC3 — Address: $101A — High Read: Write: Reset: Bit 7 6 5 4 3 2 1 Bit 0 BIT 15 BIT 14 BIT 13 BIT 12 BIT 11 BIT 10 BIT 9 BIT 8 1 1 1 1 1 1 1 1 Bit 7 6 5 4 3 2 1 Bit 0 BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 1 1 1 1 1 1 1 1 Address: $101B — Low Read: Write: Reset: TOC4 — Address: $101C — High Read: Write: Reset: Read: Write: Reset: MOTOROLA Bit 7 6 5 4 3 2 1 Bit 0 BIT 15 BIT 14 BIT 13 BIT 12 BIT 11 BIT 10 BIT 9 BIT 8 1 1 1 1 1 1 1 1 Bit 7 6 5 4 3 2 1 Bit 0 BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 1 1 1 1 1 1 1 1 M68HC11E Series Programming Reference Guide 53 M68HC11ERG/AD * XIRQ/VPPE IRQ 17 18 19 PD0/RxD 20 47 PE2/AN2 48 PE6/AN6 50 PE7/AN7 49 PE3/AN3 VSS 52 VRH 51 VRL 3 MODA/LIR 2 MODB/VSTBY 32 33 PA1/IC2 25 PD5/SS VDD * VPPE applies only to devices with EPROM/OTPROM. PA2/IC1 24 PD4/SCK 31 23 PD3/MOSI 30 22 PA3/OC5/IC4/OC1 21 PD1/TxD PD2/MISO 36 29 16 39 38 37 PA4/OC4/OC1 PC7/ADDR7/DATA7 RESET 41 40 M68HC11 E SERIES PA5/OC3/OC1 14 15 1 PC5/ADDR5/DATA5 PC6/ADDR6/DATA6 42 28 12 13 45 44 43 27 PC3/ADDR3/DATA3 PC4/ADDR4/DATA4 46 PA7/PAI/OC1 PA6/OC2/OC1 PC2/ADDR2/DATA2 8 9 10 11 26 XTAL PC0/ADDR0/DATA0 PC1/ADDR1/DATA1 5 E 4 STRA/AS 7 EXTAL 6 STRB/R/W M68HC11 E Series Pin Assignments 35 34 PE5/AN5 PE1/AN1 PE4/AN4 PE0/AN0 PB0/ADDR8 PB1/ADDR9 PB2/ADDR10 PB3/ADDR11 PB4/ADDR12 PB5/ADDR13 PB6/ADDR14 PB7/ADDR15 PA0/IC3 52 51 50 49 48 47 46 45 44 43 42 41 40 PA1/IC2 PA2/IC1 PA3/OC5/IC4/OC1 PA4/OC4/OC1 PA5/OC3/OC1 PA6/OC2/OC1 PA7/PAI/OC1 VDD PD5/SS PD4/SCK PD3/MOSI PD2/MISO PD1/TxD Figure 8. Pin Assignments for 52-Pin PLCC and CLCC M68HC11 E SERIES 39 38 37 36 35 34 33 32 31 30 29 28 27 14 15 16 17 18 19 20 21 22 23 24 25 26 1 2 3 4 5 6 7 8 9 10 11 12 13 PD0/RxD IRQ XIRQ/VPPE* RESET PC7/ADDR7/DATA7 PC6/ADDR6/DATA6 PC5/ADDR5/DATA5 PC4/ADDR4/DATA4 PC3/ADDR3/DATA3 PC2/ADDR2/DATA2 PC1/ADDR1/DATA1 PC0/ADDR0/DATA0 XTAL PE2/AN2 PE6/AN6 PE3/AN3 PE7/AN7 VRL VRH VSS MODB/VSTBY MODA/LIR STRA/AS E STRB/R/W EXTAL PA0/IC3 PB7/ADDR15 PB6/ADDR14 PB5/ADDR13 PB4/ADDR12 PB3/ADDR11 PB2/ADDR10 PB1/ADDR9 PB0/ADDR8 PE0/AN0 PE4/AN4 PE1/AN1 PE5/AN5 * VPPE applies only to devices with EPROM/OTPROM. Figure 9. Pin Assignments for 52-Pin TQFP 54 M68HC11E Series Programming Reference Guide MOTOROLA PA0/IC3 NC NC NC PB7/ADDR15 PB6/ADDR14 PB5/ADDR13 PB4/ADDR12 1 PB3/ADDR11 PB2/ADDR10 PB1/ADDR9 PB0/ADDR8 PE0/AN0 PE4/AN4 PE1/AN1 PE5/AN5 9 10 11 12 13 14 15 16 56 55 54 53 52 51 50 49 64 63 62 61 60 59 58 57 PA1/IC2 PA2/IC1 PA3/OC5/IC4/OC1 NC NC PA4/OC4/OC1 PA5/OC3/OC1 PA6/OC2/OC1 PA7/PAI/OC1 VDD PD5/SS PD4/SCK PD3/MOSI PD2/MISO PD1/TxD VSS M68HC11ERG/AD M68HC11 E Series Pin Assignments 2 3 M68HC11 E SERIES NC PD0/RxD IRQ XIRQ/VPPE* NC RESET PC7/ADDR7/DATA7 PC6/ADDR6/DATA6 PC5/ADDR5/DATA5 PC4/ADDR4/DATA4 PC3/ADDR3/DATA3 PC2/ADDR2/DATA2 PC1/ADDR1/DATA1 NC PC0/ADDR0/DATA0 XTAL PE2/AN2 PE6/AN6 PE3/AN3 PE7/AN7 VRL VRH VSS VSS MODB/VSTBY NC MODA/LIR STRA/AS E STRB/R/W EXTAL NC 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 4 5 6 7 8 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 * VPPE applies only to devices with EPROM/OTPROM. Figure 10. Pin Assignments for 64-Pin QFP MOTOROLA M68HC11E Series Programming Reference Guide 55 M68HC11ERG/AD VSS 1 56 EVSS MODB/VSTBY 2 55 VRH MODA/LIR 3 54 VRL STRA/AS 4 53 PE7/AN7 E 5 52 PE3/AN3 STRB/R/W 6 51 PE6/AN6 EXTAL 7 50 PE2/AN2 XTAL 8 49 PE5/AN5 PC0/ADDR0/DATA0 9 48 PE1/AN1 PC1/ADDR1/DATA1 10 47 PE4/AN4 PC2/ADDR2/DATA2 11 46 PE0/AN0 PC3/ADDR3/DATA3 12 45 PB0/ADDR8 PC4/ADDR4/DATA4 13 44 PB1/ADDR9 PC5/ADDR5/DATA5 14 43 PB2/ADDR10 PC6/ADDR6/DATA6 15 M68HC11 E SERIES 42 PB3/ADDR11 PC7/ADDR7/DATA7 16 41 PB4/ADDR12 RESET 17 40 PB5/ADDR13 * XIRQ/VPPE 18 39 PB6/ADDR14 IRQ 19 38 PB7/ADDR15 PD0/RxD 20 37 PA0/IC3 EVSS 21 36 PA1/IC2 PD1/TxD 22 35 PA2/IC1 PD2/MISO 23 34 PA3/OC5/IC4/OC1 PD3/MOSI 24 33 PA4/OC4/OC1 PD4/SCK 25 32 PA5/OC3/OC1 PD5/SS 26 31 PA6/OC2/OC1 VDD 27 30 PA7/PAI/OC1 VSS 28 29 EVDD * VPPE applies only to devices with EPROM/OTPROM. Figure 11. Pin Assignments for 56-Pin SDIP 56 M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD M68HC11 E Series Pin Assignments PA7/PAI/OC1 1 48 VDD PA6/OC2/OC1 2 47 PD5/SS PA5/OC3/OC1 3 46 PD4/SCK PA4/OC4/OC1 4 45 PD3/MOSI PA3/OC5/IC4/OC1 5 44 PD2/MISO PA2/IC1 6 43 PD1/TxD PA1/IC2 7 42 PD0/RxD PA0/IC3 8 41 IRQ PB7/ADDR15 9 40 XIRQ PB6/ADDR14 10 39 RESET PB5/ADDR13 11 38 PC7/ADDR7/DATA7 PB4/ADDR12 12 37 PC6/ADDR6/DATA6 PB3/ADDR11 13 36 PC5/ADDR5/DATA5 PB2/ADDR10 14 35 PC4/ADDR4/DATA4 PB1/ADDR9 15 34 PC3/ADDR3/DATA3 PB0/ADDR8 16 33 PC2/ADDR2/DATA2 PE0/AN0 17 32 PC1/ADDR1/DATA1 PE1/AN1 18 31 PC0/ADDR0/DATA0 PE2/AN2 19 30 XTAL PE3/AN3 20 29 EXTAL VRL 21 28 STRB/R/W VRH 22 27 E VSS 23 26 STRA/AS MODB/VSTBY 24 25 MODA/LIR MC68HC811E2 Figure 12. Pin Assignments for 48-Pin DIP (MC68HC811E2) MOTOROLA M68HC11E Series Programming Reference Guide 57 M68HC11ERG/AD Hexadecimal to ASCII Conversion Table 2. Hexadecimal to ASCII Conversion 58 Hex ASCII Hex ASCII Hex ASCII Hex ASCII $00 NUL $20 SP space $40 @ $60 ` grave $01 SOH $21 ! $41 A $61 a $02 STX $22 “ quote $42 B $62 b $03 ETX $23 # $43 C $63 c $04 EOT $24 $ $44 D $64 d $05 ENQ $25 % $45 E $65 e $06 ACK $26 & $46 F $66 f $07 BEL beep $27 ‘ apost. $47 G $67 g $08 BS back sp $28 ( $48 H $68 h $09 HT tab $29 ) $49 I $69 i $0A LF linefeed $2A * $4A J $6A j $0B VT $2B + $4B K $6B k $0C FF $2C , comma $4C L $6C l $0D CR return $2D $4D M $6D m $0E SO $2E - dash . period $4E N $6E n $0F SI $2F / $4F O $6F o $10 DLE $30 0 $50 P $70 p $11 DC1 $31 1 $51 Q $71 q $12 DC2 $32 2 $52 R $72 r $13 DC3 $33 3 $53 S $73 s $14 DC4 $34 4 $54 T $74 t $15 NAK $35 5 $55 U $75 u $16 SYN $36 6 $56 V $76 v $17 ETB $37 7 $57 W $77 w $18 CAN $38 8 $58 X $78 x $19 EM $39 9 $59 Y $79 y $1A SUB $3A : $5A Z $7A z $1B ESCAPE $3B ; $5B [ $7B { $1C FS $3C < $5C \ $7C | $1D GS $3D = $5D ] $7D } $1E RS $3E > $5E ^ $7E ~ $1F US $3F ? $5F _ under $7F DEL delete M68HC11E Series Programming Reference Guide MOTOROLA M68HC11ERG/AD Hexadecimal to Decimal Conversion Hexadecimal to Decimal Conversion To convert a hexadecimal number (up to four hexadecimal digits) to decimal, look up the decimal equivalent of each hexadecimal digit in Table 3. The decimal equivalent of the original hexadecimal number is the sum of the weights found in the table for all hexadecimal digits. Table 3. Hexadecimal to/from Decimal Conversion 15 Bit 15 12 4th Hex Digit Hex 8 7 Bit 0 8 7 4 3 0 11 3rd Hex Digit Decimal Hex Decimal 2nd Hex Digit Hex Decimal 1st Hex Digit Hex Decimal 0 0 0 0 0 0 0 0 1 4,096 1 256 1 16 1 1 2 8,192 2 512 2 32 2 2 3 12,288 3 768 3 48 3 3 4 16,384 4 1,024 4 64 4 4 5 20,480 5 1,280 5 80 5 5 6 24,576 6 1,536 6 96 6 6 7 28,672 7 1,792 7 112 7 7 8 32,768 8 2,048 8 128 8 8 9 36,864 9 2,304 9 144 9 9 A 40,960 A 2,560 A 160 A 10 B 45,056 B 2,816 B 176 B 11 C 49,152 C 3,072 C 192 C 12 D 53,248 D 3,328 D 208 D 13 E 57,344 E 3,484 E 224 E 14 F 61,440 F 3,840 F 240 F 15 Decimal to Hexadecimal Conversion To convert a decimal number (up to 65,53510) to hexadecimal, find the largest decimal number in Table 3 that is less than or equal to the number you are converting. The corresponding hexadecimal digit is the most significant hexadecimal digit of the result. Subtract the decimal number found from the original decimal number to get the remaining decimal value. Repeat the procedure using the remaining decimal value for each subsequent hexadecimal digit. MOTOROLA M68HC11E Series Programming Reference Guide 59 M68HC11ERG/AD HOW TO REACH US: USA/EUROPE/LOCATIONS NOT LISTED: Motorola Literature Distribution P.O. Box 5405 Denver, Colorado 80217 1-800-521-6274 or 480-768-2130 JAPAN: Motorola Japan Ltd. SPS, Technical Information Center 3-20-1, Minami-Azabu, Minato-ku Tokyo 106-8573, Japan 81-3-3440-3569 ASIA/PACIFIC: Motorola Semiconductors H.K. Ltd. Silicon Harbour Centre 2 Dai King Street Tai Po Industrial Estate Tai Po, N.T., Hong Kong 852-26668334 HOME PAGE: http://motorola.com/semiconductors Information in this document is provided solely to enable system and software implementers to use Motorola products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Motorola assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. “Typical” parameters that may be provided in Motorola data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including “Typicals”, must be validated for each customer application by customer’s technical experts. Motorola does not convey any license under its patent rights nor the rights of others. Motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a situation where personal injury or death may occur. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application, Buyer shall indemnify and hold Motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Motorola was negligent regarding the design or manufacture of the part. MOTOROLA and the Stylized M Logo are registered in the US Patent and Trademark Office. All other product or service names are the property of their respective owners. Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer. © Motorola Inc. 2003 M68HC11ERG/AD Rev. 2 10/2003