svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers...

245
The MC68HC11 Microcontroller Lecture Overheads Sokol Salius Chalmers Lindholmen September 2, 2003 CHALMERS Lindholmen

Transcript of svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers...

Page 1: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11Microcontroller

LectureOverheads

SokolSalius

ChalmersLindholmen

September2,2003

CHALMERSLindholmen

Page 2: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatwouldwelearnabout?

CHALMERSLindholmen1

Page 3: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatwouldwelearnabout?

◦I.INTRODUCINGMICROCONTROLLERTECHNOLOGY

CHALMERSLindholmen1

Page 4: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatwouldwelearnabout?

◦I.INTRODUCINGMICROCONTROLLERTECHNOLOGY

1.MicrocontrollerConcepts.

CHALMERSLindholmen1

Page 5: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatwouldwelearnabout?

◦I.INTRODUCINGMICROCONTROLLERTECHNOLOGY

1.MicrocontrollerConcepts.

◦II.SOFTWARE

CHALMERSLindholmen1

Page 6: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatwouldwelearnabout?

◦I.INTRODUCINGMICROCONTROLLERTECHNOLOGY

1.MicrocontrollerConcepts.

◦II.SOFTWARE

2.Programming.

CHALMERSLindholmen1

Page 7: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatwouldwelearnabout?

◦I.INTRODUCINGMICROCONTROLLERTECHNOLOGY

1.MicrocontrollerConcepts.

◦II.SOFTWARE

2.Programming.

3.TheStack,Subroutines,Interrupts,andResets.

CHALMERSLindholmen1

Page 8: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatwouldwelearnabout?

◦I.INTRODUCINGMICROCONTROLLERTECHNOLOGY

1.MicrocontrollerConcepts.

◦II.SOFTWARE

2.Programming.

3.TheStack,Subroutines,Interrupts,andResets.

4.CrossAssemblyandProgramDevelopment.

CHALMERSLindholmen1

Page 9: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatwouldwelearnabout?

◦I.INTRODUCINGMICROCONTROLLERTECHNOLOGY

1.MicrocontrollerConcepts.

◦II.SOFTWARE

2.Programming.

3.TheStack,Subroutines,Interrupts,andResets.

4.CrossAssemblyandProgramDevelopment.

◦III.HARDWARE

CHALMERSLindholmen1

Page 10: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatwouldwelearnabout?

◦I.INTRODUCINGMICROCONTROLLERTECHNOLOGY

1.MicrocontrollerConcepts.

◦II.SOFTWARE

2.Programming.

3.TheStack,Subroutines,Interrupts,andResets.

4.CrossAssemblyandProgramDevelopment.

◦III.HARDWARE

5.BusConceptsandModesofOperation.

CHALMERSLindholmen1

Page 11: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatwouldwelearnabout?

◦I.INTRODUCINGMICROCONTROLLERTECHNOLOGY

1.MicrocontrollerConcepts.

◦II.SOFTWARE

2.Programming.

3.TheStack,Subroutines,Interrupts,andResets.

4.CrossAssemblyandProgramDevelopment.

◦III.HARDWARE

5.BusConceptsandModesofOperation.

6.MicrocontrollerHardware.

CHALMERSLindholmen1

Page 12: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatwouldwelearnabout?

◦I.INTRODUCINGMICROCONTROLLERTECHNOLOGY

1.MicrocontrollerConcepts.

◦II.SOFTWARE

2.Programming.

3.TheStack,Subroutines,Interrupts,andResets.

4.CrossAssemblyandProgramDevelopment.

◦III.HARDWARE

5.BusConceptsandModesofOperation.

6.MicrocontrollerHardware.

7.ClockedOperation.

CHALMERSLindholmen1

Page 13: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatmore?

CHALMERSLindholmen2

Page 14: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatmore?

◦IV.INTERFACING

CHALMERSLindholmen2

Page 15: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatmore?

◦IV.INTERFACING

8.InterfacingConcepts.

CHALMERSLindholmen2

Page 16: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatmore?

◦IV.INTERFACING

8.InterfacingConcepts.

9.ParallelInput/Output.

CHALMERSLindholmen2

Page 17: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatmore?

◦IV.INTERFACING

8.InterfacingConcepts.

9.ParallelInput/Output.

10.SerialSubsystems.

CHALMERSLindholmen2

Page 18: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatmore?

◦IV.INTERFACING

8.InterfacingConcepts.

9.ParallelInput/Output.

10.SerialSubsystems.

11.ProgrammableTimerOperations.

CHALMERSLindholmen2

Page 19: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatmore?

◦IV.INTERFACING

8.InterfacingConcepts.

9.ParallelInput/Output.

10.SerialSubsystems.

11.ProgrammableTimerOperations.

12.TheAnalogConverterSubsystem.

CHALMERSLindholmen2

Page 20: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Whatmore?

◦IV.INTERFACING

8.InterfacingConcepts.

9.ParallelInput/Output.

10.SerialSubsystems.

11.ProgrammableTimerOperations.

12.TheAnalogConverterSubsystem.

13.ApplicationsControlSoftware.

CHALMERSLindholmen2

Page 21: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

CHALMERSLindholmen3

Page 22: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

◦ConsumerElectronic

CHALMERSLindholmen3

Page 23: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

◦ConsumerElectronic

(Automotiveanti-theftsystemusingRFID)

CHALMERSLindholmen3

Page 24: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

◦ConsumerElectronic

(Automotiveanti-theftsystemusingRFID)

◦MedicalMonitoringDevices

CHALMERSLindholmen3

Page 25: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

◦ConsumerElectronic

(Automotiveanti-theftsystemusingRFID)

◦MedicalMonitoringDevices

(Abeltthatmeasuresaperson’sheartrateandrespiration—whenoutofsafelimitsa

RFsignalistransmittedtoamicrocontroller/pager)

CHALMERSLindholmen3

Page 26: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

◦ConsumerElectronic

(Automotiveanti-theftsystemusingRFID)

◦MedicalMonitoringDevices

(Abeltthatmeasuresaperson’sheartrateandrespiration—whenoutofsafelimitsa

RFsignalistransmittedtoamicrocontroller/pager)

◦SecuritySystems

CHALMERSLindholmen3

Page 27: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

◦ConsumerElectronic

(Automotiveanti-theftsystemusingRFID)

◦MedicalMonitoringDevices

(Abeltthatmeasuresaperson’sheartrateandrespiration—whenoutofsafelimitsa

RFsignalistransmittedtoamicrocontroller/pager)

◦SecuritySystems

(An”intelligent”phonethatreceivesradiosignalsfromsmokealarms,intrusion

sensors,andpanicswitchestoalertacentralmonitoringstation)

CHALMERSLindholmen3

Page 28: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

◦ConsumerElectronic

(Automotiveanti-theftsystemusingRFID)

◦MedicalMonitoringDevices

(Abeltthatmeasuresaperson’sheartrateandrespiration—whenoutofsafelimitsa

RFsignalistransmittedtoamicrocontroller/pager)

◦SecuritySystems

(An”intelligent”phonethatreceivesradiosignalsfromsmokealarms,intrusion

sensors,andpanicswitchestoalertacentralmonitoringstation)

◦EnvironmentalControls

CHALMERSLindholmen3

Page 29: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

◦ConsumerElectronic

(Automotiveanti-theftsystemusingRFID)

◦MedicalMonitoringDevices

(Abeltthatmeasuresaperson’sheartrateandrespiration—whenoutofsafelimitsa

RFsignalistransmittedtoamicrocontroller/pager)

◦SecuritySystems

(An”intelligent”phonethatreceivesradiosignalsfromsmokealarms,intrusion

sensors,andpanicswitchestoalertacentralmonitoringstation)

◦EnvironmentalControls

(Controlsystemthatcontrolstheheating,ventilating,andairconditioninginlarge

buildingstominimizepeakenergydemands.)

CHALMERSLindholmen3

Page 30: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

◦ConsumerElectronic

(Automotiveanti-theftsystemusingRFID)

◦MedicalMonitoringDevices

(Abeltthatmeasuresaperson’sheartrateandrespiration—whenoutofsafelimitsa

RFsignalistransmittedtoamicrocontroller/pager)

◦SecuritySystems

(An”intelligent”phonethatreceivesradiosignalsfromsmokealarms,intrusion

sensors,andpanicswitchestoalertacentralmonitoringstation)

◦EnvironmentalControls

(Controlsystemthatcontrolstheheating,ventilating,andairconditioninginlarge

buildingstominimizepeakenergydemands.)

◦ClosedLoopProcessControls

CHALMERSLindholmen3

Page 31: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

◦ConsumerElectronic

(Automotiveanti-theftsystemusingRFID)

◦MedicalMonitoringDevices

(Abeltthatmeasuresaperson’sheartrateandrespiration—whenoutofsafelimitsa

RFsignalistransmittedtoamicrocontroller/pager)

◦SecuritySystems

(An”intelligent”phonethatreceivesradiosignalsfromsmokealarms,intrusion

sensors,andpanicswitchestoalertacentralmonitoringstation)

◦EnvironmentalControls

(Controlsystemthatcontrolstheheating,ventilating,andairconditioninginlarge

buildingstominimizepeakenergydemands.)

◦ClosedLoopProcessControls

(Afuelcontrolsystemthatmonitorsandcontrolstheflowoffueltoaturbinejet

engine)

CHALMERSLindholmen3

Page 32: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

◦ConsumerElectronic

(Automotiveanti-theftsystemusingRFID)

◦MedicalMonitoringDevices

(Abeltthatmeasuresaperson’sheartrateandrespiration—whenoutofsafelimitsa

RFsignalistransmittedtoamicrocontroller/pager)

◦SecuritySystems

(An”intelligent”phonethatreceivesradiosignalsfromsmokealarms,intrusion

sensors,andpanicswitchestoalertacentralmonitoringstation)

◦EnvironmentalControls

(Controlsystemthatcontrolstheheating,ventilating,andairconditioninginlarge

buildingstominimizepeakenergydemands.)

◦ClosedLoopProcessControls

(Afuelcontrolsystemthatmonitorsandcontrolstheflowoffueltoaturbinejet

engine)

◦DesktopPC

CHALMERSLindholmen3

Page 33: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ApplicationsofMicrocontrollers

◦ConsumerElectronic

(Automotiveanti-theftsystemusingRFID)

◦MedicalMonitoringDevices

(Abeltthatmeasuresaperson’sheartrateandrespiration—whenoutofsafelimitsa

RFsignalistransmittedtoamicrocontroller/pager)

◦SecuritySystems

(An”intelligent”phonethatreceivesradiosignalsfromsmokealarms,intrusion

sensors,andpanicswitchestoalertacentralmonitoringstation)

◦EnvironmentalControls

(Controlsystemthatcontrolstheheating,ventilating,andairconditioninginlarge

buildingstominimizepeakenergydemands.)

◦ClosedLoopProcessControls

(Afuelcontrolsystemthatmonitorsandcontrolstheflowoffueltoaturbinejet

engine)

◦DesktopPC(multipleembeddedprocessorsinthekeyboard,printer,themodem,and

evenintheCRTmonitor!)

CHALMERSLindholmen3

Page 34: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SomeApplicationsofMC68HC11

CHALMERSLindholmen4

Page 35: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SomeApplicationsofMC68HC11

◦Transmissionandenginecontrolmodules(Chrysler)

CHALMERSLindholmen4

Page 36: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SomeApplicationsofMC68HC11

◦Transmissionandenginecontrolmodules(Chrysler)

◦Digitalinstrumentsclusters(Ford)

CHALMERSLindholmen4

Page 37: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SomeApplicationsofMC68HC11

◦Transmissionandenginecontrolmodules(Chrysler)

◦Digitalinstrumentsclusters(Ford)

◦Driveandemissioncontrol(JeepCherokee)

CHALMERSLindholmen4

Page 38: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SomeApplicationsofMC68HC11

◦Transmissionandenginecontrolmodules(Chrysler)

◦Digitalinstrumentsclusters(Ford)

◦Driveandemissioncontrol(JeepCherokee)

◦Automaticcameras(CanonEOSmodel)

CHALMERSLindholmen4

Page 39: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SomeApplicationsofMC68HC11

◦Transmissionandenginecontrolmodules(Chrysler)

◦Digitalinstrumentsclusters(Ford)

◦Driveandemissioncontrol(JeepCherokee)

◦Automaticcameras(CanonEOSmodel)

◦Harddiskcontroller(Conners,Inc.)

CHALMERSLindholmen4

Page 40: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SomeApplicationsofMC68HC11

◦Transmissionandenginecontrolmodules(Chrysler)

◦Digitalinstrumentsclusters(Ford)

◦Driveandemissioncontrol(JeepCherokee)

◦Automaticcameras(CanonEOSmodel)

◦Harddiskcontroller(Conners,Inc.)

◦Skibindingtoreducekneeinjuries(Fiock),etc.

CHALMERSLindholmen4

Page 41: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

CPUBlockDiagram

CPU

Clock

ControlSequencer

Arithmetic &Logic Unit

Internal Data B

us

InstructionDecoder

CPU Registers

Program Counter

Address Register

ALU

Data Driver

External Address BusExternal Data Bus

SP

Control signals

CHALMERSLindholmen5

Page 42: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

MC68HC11insinglechipandexpandedmode

I/O Controland StatusRegisters

ROM

RAM

EPROM/EEPROM

I/O Registers

Internal Bus

I/O Ports

clock

controllines

Vss

Vpp

CPU

I/O Controland StatusRegisters

ROM

RAM

EPROM/EEPROM

Internal Bus

clock

controllines

Vss

Vpp

CPU

DataBuffer

AddressLatch

Address/Data Bus

Address Bus

Single-chipmodeExpandedmode

CHALMERSLindholmen6

Page 43: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SimplifiedBlockDiagramofMC68HC11E

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

������������������������������

������������������������������

������������������������������

������������������������������

������������������������������

������������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

��������������������������

timer &counter system

CPU coreserial I/O

A/Dconverters

Port A

Port BPort CPort D

Port E

Handshake I/O

Address/Data bus

PWM/Other Ports

CHALMERSLindholmen7

Page 44: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

DemultiplexingofAddress/DataBus

LEOE

AS

AD0-AD7

A8-A15

A0-A7

D0-D7

A8-A15

74HC373

CHALMERSLindholmen8

Page 45: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

DeviceRAMROMEPROMEEPROMCOMMENTS

MC68HC11A82568K051216-bitTimer,8-bitA/D,SCI,SPIMC68HC11A125600512”

MC68HC11D319204K016-bittimer,SCI,SPIMC68HC11D01920”

MC68HC11E951212K051216-bitTimer,8-ChA/D,SCI,SPIMC68HC711E9512012K512”MC68HC11F1102400512Nonmultiplexedbus,8channel8-bitA/D,4

chipselects,SCI,SPIMC68HCG751224K00Nonmultiplexedbus,8channel10-bitA/D,4

channelPWM,SCI,SPI,66I/OpinsMC68HCM212800K32K640Nonmultiplexedbus,8channel8-bitA/D,

4channelPWM,DMA,On-chipmathcoprocessor,SCI,2SPI

MC68HC11N476824K0640Nonmultiplexedbus,12-channel8-bitA/D,2

channel8-bitD/A,6channelPWM,On-chipmathcoprocessor,SCI,SPI

CHALMERSLindholmen9

Page 46: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

µControllertoµProcessor

CHALMERSLindholmen10

Page 47: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

µControllertoµProcessor

PROsCONs

CHALMERSLindholmen10

Page 48: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

µControllertoµProcessor

PROsCONs

FewerchipsrequiredReducedflexibility

CHALMERSLindholmen10

Page 49: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

µControllertoµProcessor

PROsCONs

FewerchipsrequiredReducedflexibility

Lowercost,smallersizeLimitedexpansion

CHALMERSLindholmen10

Page 50: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

µControllertoµProcessor

PROsCONs

FewerchipsrequiredReducedflexibility

Lowercost,smallersizeLimitedexpansion

LowerpowerLimitedperformance

CHALMERSLindholmen10

Page 51: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

µControllertoµProcessor

PROsCONs

FewerchipsrequiredReducedflexibility

Lowercost,smallersizeLimitedexpansion

LowerpowerLimitedperformance

MoreuserI/OpinsLimitedI/O

CHALMERSLindholmen10

Page 52: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

µControllertoµProcessor

PROsCONs

FewerchipsrequiredReducedflexibility

Lowercost,smallersizeLimitedexpansion

LowerpowerLimitedperformance

MoreuserI/OpinsLimitedI/O

SimplerdesignTradeofftofitallinachip

CHALMERSLindholmen10

Page 53: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

µControllertoµProcessor

PROsCONs

FewerchipsrequiredReducedflexibility

Lowercost,smallersizeLimitedexpansion

LowerpowerLimitedperformance

MoreuserI/OpinsLimitedI/O

SimplerdesignTradeofftofitallinachip

Fewerconnections

CHALMERSLindholmen10

Page 54: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

µControllertoµProcessor

PROsCONs

FewerchipsrequiredReducedflexibility

Lowercost,smallersizeLimitedexpansion

LowerpowerLimitedperformance

MoreuserI/OpinsLimitedI/O

SimplerdesignTradeofftofitallinachip

Fewerconnections

Higherreliability

CHALMERSLindholmen10

Page 55: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Memorymapofthe68HC11A1/A8

$0000

$1000

$00FF

$B7FF

$103F

$B600

$FFFF

$E000

NA

NAExternal

External

External

256-Byte RAM

64-ByteRegister Block

512-ByteEEPROM

Single Chip ExpandedMultiplexed

BF40BFFF

BootloaderROM

Specialbootstap mode

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

�����������������������������������������

NA

*ROM can be disabled by ROMON bit in CONFIG

**MC68HC11A8 delivered with ROM disabled

* **

8-K ROM

CHALMERSLindholmen11

Page 56: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Memorymapofthe68HC711E9

$0000

$1000

$01FF

$B7FF

$103F

$B600

$FFFF

$D000

Not available

External

External

External

512-Byte RAM

64-ByteRegister Block

512-ByteEEPROM

12-KB ROM

Single Chipmode

Expandedmode

Not available

Not available

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

���������������������������������������

CHALMERSLindholmen12

Page 57: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTII

MachineLevels

↑I5ApplicationprogramL5↓

↑I4HLLcompiler-interpreterL4↓

↑I3ASMLanguageL3↓

↑I2OperatingsystemL2↓

↑I1Micro-programL1↓

↑I0ElectroniccircuitL0↓

CHALMERSLindholmen13

Page 58: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTII

MachineLevels

↑I5ApplicationprogramL5↓

↑I4HLLcompiler-interpreterL4↓

↑I3ASMLanguageL3↓

↑I2OperatingsystemL2↓

↑I1Micro-programL1↓

↑I0ElectroniccircuitL0↓

Architecturedefinesthefunctionalappearancetotheuser

CHALMERSLindholmen13

Page 59: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTII

MachineLevels

↑I5ApplicationprogramL5↓

↑I4HLLcompiler-interpreterL4↓

↑I3ASMLanguageL3↓

↑I2OperatingsystemL2↓

↑I1Micro-programL1↓

↑I0ElectroniccircuitL0↓

Architecturedefinesthefunctionalappearancetotheuser

Processorarchitectureisdefinedastheinterfacebetweenhardwareandsoftware,(I1).

CHALMERSLindholmen13

Page 60: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTII

MachineLevels

↑I5ApplicationprogramL5↓

↑I4HLLcompiler-interpreterL4↓

↑I3ASMLanguageL3↓

↑I2OperatingsystemL2↓

↑I1Micro-programL1↓

↑I0ElectroniccircuitL0↓

Architecturedefinesthefunctionalappearancetotheuser

Processorarchitectureisdefinedastheinterfacebetweenhardwareandsoftware,(I1).

LevelsL3,L4,andL5areconsideredvirtualmachines;

CHALMERSLindholmen13

Page 61: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTII

MachineLevels

↑I5ApplicationprogramL5↓

↑I4HLLcompiler-interpreterL4↓

↑I3ASMLanguageL3↓

↑I2OperatingsystemL2↓

↑I1Micro-programL1↓

↑I0ElectroniccircuitL0↓

Architecturedefinesthefunctionalappearancetotheuser

Processorarchitectureisdefinedastheinterfacebetweenhardwareandsoftware,(I1).

LevelsL3,L4,andL5areconsideredvirtualmachines;L5iswhatmostuserusersee

CHALMERSLindholmen13

Page 62: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

MachineLevels(cont.)

High Level

Assembly

Machine

RegisterTransfer

Gate

Circuit

Sum : = Sum+1

LDAA SUM INCASTAA SUM

10000110 10100000 0100 11001001 0111 10100000

Fetch Intruction Increment PC Load ALU with SUM ...

D

CLK

Q

CHALMERSLindholmen14

Page 63: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

FromSourcetomachinecode

AssemblyLanguage

High-levelLanguage

Assembler

Machine Code

Compiler

To ComputerMemory

Object Code

Languagesshapethewaythinkand

determinewhatwecanthinkabout.

L.Dwarfaboutnaturallanguages

CHALMERSLindholmen15

Page 64: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Programmer’sModelofMC68HC11

A,B

D

X

Y

SP

PC

0 07 7

15

15

0

8-bit accumulators A and B or 16-bit(double) accum D

index register X

index register Y

stack pointer

program counter

0

0

0

0

15

15

15

0 7

condition code register CCR

S X H I N Z V C

carry/borrow (from MSB)

overflow zero

negative

I-interrupt mask half carry (from bit 3)

stop disable

X-interrupt mask

CCR

CHALMERSLindholmen16

Page 65: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 66: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

◦loads,storesandtransfers:

1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 67: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

◦loads,storesandtransfers:

CLR,CLRB,LDAA,PSHA,PULB,STAB,STD,TAP,TBA,XGDY,etc.

1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 68: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

◦loads,storesandtransfers:

CLR,CLRB,LDAA,PSHA,PULB,STAB,STD,TAP,TBA,XGDY,etc.

◦arithmeticoperations:

1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 69: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

◦loads,storesandtransfers:

CLR,CLRB,LDAA,PSHA,PULB,STAB,STD,TAP,TBA,XGDY,etc.

◦arithmeticoperations:

ABX,ADCB,CMPB,DECA,NEGB,INCB,SUBD,TSTA,etc.

1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 70: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

◦loads,storesandtransfers:

CLR,CLRB,LDAA,PSHA,PULB,STAB,STD,TAP,TBA,XGDY,etc.

◦arithmeticoperations:

ABX,ADCB,CMPB,DECA,NEGB,INCB,SUBD,TSTA,etc.

◦multiplyanddivide:

1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 71: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

◦loads,storesandtransfers:

CLR,CLRB,LDAA,PSHA,PULB,STAB,STD,TAP,TBA,XGDY,etc.

◦arithmeticoperations:

ABX,ADCB,CMPB,DECA,NEGB,INCB,SUBD,TSTA,etc.

◦multiplyanddivide:

MUL,FDIV,IDIV

1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 72: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

◦loads,storesandtransfers:

CLR,CLRB,LDAA,PSHA,PULB,STAB,STD,TAP,TBA,XGDY,etc.

◦arithmeticoperations:

ABX,ADCB,CMPB,DECA,NEGB,INCB,SUBD,TSTA,etc.

◦multiplyanddivide:

MUL,FDIV,IDIV

◦logicaloperations:

1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 73: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

◦loads,storesandtransfers:

CLR,CLRB,LDAA,PSHA,PULB,STAB,STD,TAP,TBA,XGDY,etc.

◦arithmeticoperations:

ABX,ADCB,CMPB,DECA,NEGB,INCB,SUBD,TSTA,etc.

◦multiplyanddivide:

MUL,FDIV,IDIV

◦logicaloperations:

ANDA,ANDB,COM,COMA,EORA,ORAB,etc.

1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 74: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

◦loads,storesandtransfers:

CLR,CLRB,LDAA,PSHA,PULB,STAB,STD,TAP,TBA,XGDY,etc.

◦arithmeticoperations:

ABX,ADCB,CMPB,DECA,NEGB,INCB,SUBD,TSTA,etc.

◦multiplyanddivide:

MUL,FDIV,IDIV

◦logicaloperations:

ANDA,ANDB,COM,COMA,EORA,ORAB,etc.

◦datatestingandbitmanipulations:

1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 75: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

◦loads,storesandtransfers:

CLR,CLRB,LDAA,PSHA,PULB,STAB,STD,TAP,TBA,XGDY,etc.

◦arithmeticoperations:

ABX,ADCB,CMPB,DECA,NEGB,INCB,SUBD,TSTA,etc.

◦multiplyanddivide:

MUL,FDIV,IDIV

◦logicaloperations:

ANDA,ANDB,COM,COMA,EORA,ORAB,etc.

◦datatestingandbitmanipulations:

BITA,BITB,BCLR,BSET,BRCLR,BRSET

1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 76: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

◦loads,storesandtransfers:

CLR,CLRB,LDAA,PSHA,PULB,STAB,STD,TAP,TBA,XGDY,etc.

◦arithmeticoperations:

ABX,ADCB,CMPB,DECA,NEGB,INCB,SUBD,TSTA,etc.

◦multiplyanddivide:

MUL,FDIV,IDIV

◦logicaloperations:

ANDA,ANDB,COM,COMA,EORA,ORAB,etc.

◦datatestingandbitmanipulations:

BITA,BITB,BCLR,BSET,BRCLR,BRSET

◦shiftsandrotates:

1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 77: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

InstructionSet

iAccumulatorandMemoryInstructions1

◦loads,storesandtransfers:

CLR,CLRB,LDAA,PSHA,PULB,STAB,STD,TAP,TBA,XGDY,etc.

◦arithmeticoperations:

ABX,ADCB,CMPB,DECA,NEGB,INCB,SUBD,TSTA,etc.

◦multiplyanddivide:

MUL,FDIV,IDIV

◦logicaloperations:

ANDA,ANDB,COM,COMA,EORA,ORAB,etc.

◦datatestingandbitmanipulations:

BITA,BITB,BCLR,BSET,BRCLR,BRSET

◦shiftsandrotates:

ASLD,ASRA,LSLB,LSRA,ROLA,RORB,etc.1twooperands—onefromanaccumulatororindexregistertheotherfrommemory

CHALMERSLindholmen17

Page 78: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

CHALMERSLindholmen18

Page 79: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

◦ABX,CPY,DES,DEY,INX,LDX,PULY,PHSX,TSX,TYS,XGDX,etc.

iiiConditioncoderegisterinstruction

CHALMERSLindholmen18

Page 80: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

◦ABX,CPY,DES,DEY,INX,LDX,PULY,PHSX,TSX,TYS,XGDX,etc.

iiiConditioncoderegisterinstruction

◦CLS,CLI,CLV,SEC,SEI,SEV,TAP,TPA

ivProgramControlInstructions

CHALMERSLindholmen18

Page 81: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

◦ABX,CPY,DES,DEY,INX,LDX,PULY,PHSX,TSX,TYS,XGDX,etc.

iiiConditioncoderegisterinstruction

◦CLS,CLI,CLV,SEC,SEI,SEV,TAP,TPA

ivProgramControlInstructions

◦branches:

CHALMERSLindholmen18

Page 82: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

◦ABX,CPY,DES,DEY,INX,LDX,PULY,PHSX,TSX,TYS,XGDX,etc.

iiiConditioncoderegisterinstruction

◦CLS,CLI,CLV,SEC,SEI,SEV,TAP,TPA

ivProgramControlInstructions

◦branches:

BCC,BCS,BGE,BHI,BLO,BLS,BMI,BNE,BRCLR,BRSET,BVC,etc.

CHALMERSLindholmen18

Page 83: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

◦ABX,CPY,DES,DEY,INX,LDX,PULY,PHSX,TSX,TYS,XGDX,etc.

iiiConditioncoderegisterinstruction

◦CLS,CLI,CLV,SEC,SEI,SEV,TAP,TPA

ivProgramControlInstructions

◦branches:

BCC,BCS,BGE,BHI,BLO,BLS,BMI,BNE,BRCLR,BRSET,BVC,etc.

◦jumps:

CHALMERSLindholmen18

Page 84: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

◦ABX,CPY,DES,DEY,INX,LDX,PULY,PHSX,TSX,TYS,XGDX,etc.

iiiConditioncoderegisterinstruction

◦CLS,CLI,CLV,SEC,SEI,SEV,TAP,TPA

ivProgramControlInstructions

◦branches:

BCC,BCS,BGE,BHI,BLO,BLS,BMI,BNE,BRCLR,BRSET,BVC,etc.

◦jumps:

JMP

CHALMERSLindholmen18

Page 85: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

◦ABX,CPY,DES,DEY,INX,LDX,PULY,PHSX,TSX,TYS,XGDX,etc.

iiiConditioncoderegisterinstruction

◦CLS,CLI,CLV,SEC,SEI,SEV,TAP,TPA

ivProgramControlInstructions

◦branches:

BCC,BCS,BGE,BHI,BLO,BLS,BMI,BNE,BRCLR,BRSET,BVC,etc.

◦jumps:

JMP

◦subroutinecallsandreturns:

CHALMERSLindholmen18

Page 86: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

◦ABX,CPY,DES,DEY,INX,LDX,PULY,PHSX,TSX,TYS,XGDX,etc.

iiiConditioncoderegisterinstruction

◦CLS,CLI,CLV,SEC,SEI,SEV,TAP,TPA

ivProgramControlInstructions

◦branches:

BCC,BCS,BGE,BHI,BLO,BLS,BMI,BNE,BRCLR,BRSET,BVC,etc.

◦jumps:

JMP

◦subroutinecallsandreturns:

BSR,JSR,RTS

CHALMERSLindholmen18

Page 87: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

◦ABX,CPY,DES,DEY,INX,LDX,PULY,PHSX,TSX,TYS,XGDX,etc.

iiiConditioncoderegisterinstruction

◦CLS,CLI,CLV,SEC,SEI,SEV,TAP,TPA

ivProgramControlInstructions

◦branches:

BCC,BCS,BGE,BHI,BLO,BLS,BMI,BNE,BRCLR,BRSET,BVC,etc.

◦jumps:

JMP

◦subroutinecallsandreturns:

BSR,JSR,RTS

◦interrupthandling:

CHALMERSLindholmen18

Page 88: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

◦ABX,CPY,DES,DEY,INX,LDX,PULY,PHSX,TSX,TYS,XGDX,etc.

iiiConditioncoderegisterinstruction

◦CLS,CLI,CLV,SEC,SEI,SEV,TAP,TPA

ivProgramControlInstructions

◦branches:

BCC,BCS,BGE,BHI,BLO,BLS,BMI,BNE,BRCLR,BRSET,BVC,etc.

◦jumps:

JMP

◦subroutinecallsandreturns:

BSR,JSR,RTS

◦interrupthandling:

RTI,SWI,WAI

CHALMERSLindholmen18

Page 89: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

◦ABX,CPY,DES,DEY,INX,LDX,PULY,PHSX,TSX,TYS,XGDX,etc.

iiiConditioncoderegisterinstruction

◦CLS,CLI,CLV,SEC,SEI,SEV,TAP,TPA

ivProgramControlInstructions

◦branches:

BCC,BCS,BGE,BHI,BLO,BLS,BMI,BNE,BRCLR,BRSET,BVC,etc.

◦jumps:

JMP

◦subroutinecallsandreturns:

BSR,JSR,RTS

◦interrupthandling:

RTI,SWI,WAI

◦miscellaneous:

CHALMERSLindholmen18

Page 90: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

iiStackandindexregistersinstructions

◦ABX,CPY,DES,DEY,INX,LDX,PULY,PHSX,TSX,TYS,XGDX,etc.

iiiConditioncoderegisterinstruction

◦CLS,CLI,CLV,SEC,SEI,SEV,TAP,TPA

ivProgramControlInstructions

◦branches:

BCC,BCS,BGE,BHI,BLO,BLS,BMI,BNE,BRCLR,BRSET,BVC,etc.

◦jumps:

JMP

◦subroutinecallsandreturns:

BSR,JSR,RTS

◦interrupthandling:

RTI,SWI,WAI

◦miscellaneous:

NOP,STOP,TEST

CHALMERSLindholmen18

Page 91: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Addressingmodes

◦inherentCLRA2

◦immediateLDX#$10003

◦extendedaddressingSTAA$10004

◦directaddressingSTAA$205

◦indexedaddressingLDAB$5,X6

◦relativeBRA$0C7

2datais”inherent”toCPU,noexternaladdressisneeded3datalocated’immediately’intheinstruction4the16-bitaddressoftheamemorybyteisspecifiedintheinstruction5the8-bitaddress($00–$FF)—256byteschip’sRAM—oftheamemorybyteisspecifiedintheinstruction6the(effective)addressisobtainedfromthecontentofregisterXplustheoffset,inthiscase57locationisspecifiedbyanoffsetfromtheaddressoftheinstructioncurrentlybeingexecuted

CHALMERSLindholmen19

Page 92: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

addressopcode*addressingmodes

1000ORG$1000

*Immediate

10008E00FFLDS#$FF1003C680LDAB#$80

1005CEC000LDX#$C000

*Extended

1008B700C0STAA$C0

*Direct100B97C0STAA>$C0

*Indexed100DE300ADDD0,X

100F18A703STAA3,Y

*Inherent

10121BABA101308INX

*Relative

10142000PREVBRANEXT101622FCNEXTBHIPREV

10182402BCCOK101A20FEHANGBRAHANG

*Absolute101C7ED000OKJMP$D000

CHALMERSLindholmen20

Page 93: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

*Illustrationofaddressingmodes

QA11-MC68HC11Absolutecross-assembler,Version1.0

(c)GMV1989-2002

File:addmodes.lst

1.*Illustrationofvariousaddressingmodes

2.

3.*--------------------------------------------

4.*inherentaddressingmode

5.

10006.ORG$1000startaddressoftheprogram

7.

10004F8.CLRA0->A

10015C9.INCBB+1->B

1002188F10.XGDYD<->Y

1004180911.DEYY-1>Y

12.

13.*---------------------------------------------

14.

CHALMERSLindholmen21

Page 94: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

15.*Immediatemode

1006864C16.LDAA#$4C$4C->A

10088B0217.ADDA#$02A+2->A

100AC61718.LDAB#$17$17->B

100C1B19.ABAA+B->A(inherent)

20.

21.*DirectendExtendedmode:

22.*Directmode

23.*Transfersdatafromaddress$20toaddress$30

24.

100DB6002025.LDAA>$20$(20)->A

1010B7003026.STAA>$30A->(30)

27.

28.*Extendedmode

29.*Transfersdatafromaddress$2000toaddress$3000

30.

1013B6200031.LDAA$2000($2000)->A

1016B7300032.STAA$3000A->($3000)

33.

1019B6200134.LDAA$2001($2001)->A

101CB7300135.STAA$3001A->($3001)

36.*...

CHALMERSLindholmen22

Page 95: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

37.

38.*---------------------------------------

39.*Indexedaddressing

101FCE200040.LDX#$2000$2000->X

102218CE300041.LDY#$3000$3000->Y

1026A60042.LOOPLDAA0,X(X+0)->A

102818A70043.STAA0,YA->(Y+0)

102B0844.INXX->X+1

102C180845.INYY->Y+1

46.*...

102E20F647.BRALOOPLOOP->PC

CHALMERSLindholmen23

Page 96: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Keyboardinterface

ML4EQU$1400LEDindicator

ML2EQU$100Keyboardstatus/dataregister(ML2/ML15)

*%10000000nokeypressed%0xxxxxxxkeypressed(7bitdata)

KEYBS1PSHB

LOOPDLDAAML2readstatus/dataregister

CMPA#$80isanykeypressed?

BEQLOOPDifnotkeeppolling

otherwisesAcontainsthecodeofkeypressed

STAAML4fortestpurposetovisualizeAcontent

LOOPULDABML2

CMPB#$80isthekeyreleased?

BNELOOPUifnotkeeppolling

PULB

RTS

CHALMERSLindholmen24

Page 97: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Programmingconstructs

CHALMERSLindholmen25

Page 98: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Programmingconstructs

*----------------------*----------------------

if...else...*do...while...

*----------------------*-----------------------

......

BEQCTif(conditionequalTRUE)LDAB#10

*elseDOWLDAA$0,Xreadfrom

CFLDAB#’F’setFALSEflagSTAA$0,Ymoveto

BRASKIPINX

INY

CTLDAB#’T’setTRUEflagDECBnext

SKIPBNEDOWwhileB<10

......

CHALMERSLindholmen25

Page 99: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

"ConditionalJump"Construct

*--------------------------------

*Example:"JNELABEL"

*(nosuchinstructionexistsonHC11)

*--------------------------------

CBACompareAtoB

*--------------

BEQCONT

JMPLABEL"JNE"LABEL

CONT

*--------------

...

LABEL

...

CHALMERSLindholmen26

Page 100: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

DataTestingandBitManipulation

◦Data(Bit)testing:

CHALMERSLindholmen27

Page 101: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

DataTestingandBitManipulation

◦Data(Bit)testing:–BITAM,BITBM(operation:ACCx·M)

◦Bitmanipulations:

CHALMERSLindholmen27

Page 102: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

DataTestingandBitManipulation

◦Data(Bit)testing:–BITAM,BITBM(operation:ACCx·M)

◦Bitmanipulations:–BSETMmask(operation:M←M+mask)

CHALMERSLindholmen27

Page 103: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

DataTestingandBitManipulation

◦Data(Bit)testing:–BITAM,BITBM(operation:ACCx·M)

◦Bitmanipulations:–BSETMmask(operation:M←M+mask)

–BCLRMmask(operation:M←M·mask)

◦Example:

CHALMERSLindholmen27

Page 104: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

DataTestingandBitManipulation

◦Data(Bit)testing:–BITAM,BITBM(operation:ACCx·M)

◦Bitmanipulations:–BSETMmask(operation:M←M+mask)

–BCLRMmask(operation:M←M·mask)

◦Example:

–BSET$1000,X$07

CHALMERSLindholmen27

Page 105: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

DataTestingandBitManipulation

◦Data(Bit)testing:–BITAM,BITBM(operation:ACCx·M)

◦Bitmanipulations:–BSETMmask(operation:M←M+mask)

–BCLRMmask(operation:M←M·mask)

◦Example:

–BSET$1000,X$07

xxxxx111←xxxxxxxx+00000111

CHALMERSLindholmen27

Page 106: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

DataTestingandBitManipulation

◦Data(Bit)testing:–BITAM,BITBM(operation:ACCx·M)

◦Bitmanipulations:–BSETMmask(operation:M←M+mask)

–BCLRMmask(operation:M←M·mask)

◦Example:

–BSET$1000,X$07

xxxxx111←xxxxxxxx+00000111

–BCLR$1000,X$̃07($F8)

CHALMERSLindholmen27

Page 107: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

DataTestingandBitManipulation

◦Data(Bit)testing:–BITAM,BITBM(operation:ACCx·M)

◦Bitmanipulations:–BSETMmask(operation:M←M+mask)

–BCLRMmask(operation:M←M·mask)

◦Example:

–BSET$1000,X$07

xxxxx111←xxxxxxxx+00000111

–BCLR$1000,X$̃07($F8)

xxxxx000←xxxxxxxx·11111000

CHALMERSLindholmen27

Page 108: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Branchinstructionsbasedonbitsvalues

CHALMERSLindholmen28

Page 109: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Branchinstructionsbasedonbitsvalues

◦BRSETMmask(M·mask==0)

CHALMERSLindholmen28

Page 110: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Branchinstructionsbasedonbitsvalues

◦BRSETMmask(M·mask==0)

◦BRCLRMmask(M·mask==0)

◦Example:

CHALMERSLindholmen28

Page 111: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Branchinstructionsbasedonbitsvalues

◦BRSETMmask(M·mask==0)

◦BRCLRMmask(M·mask==0)

◦Example:

–BRSET$1000,X$07

CHALMERSLindholmen28

Page 112: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Branchinstructionsbasedonbitsvalues

◦BRSETMmask(M·mask==0)

◦BRCLRMmask(M·mask==0)

◦Example:

–BRSET$1000,X$07

xxxxxxxx·00000111=00000xxx

CHALMERSLindholmen28

Page 113: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Branchinstructionsbasedonbitsvalues

◦BRSETMmask(M·mask==0)

◦BRCLRMmask(M·mask==0)

◦Example:

–BRSET$1000,X$07

xxxxxxxx·00000111=00000xxx

–BRCLR$1000,X$07

CHALMERSLindholmen28

Page 114: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Branchinstructionsbasedonbitsvalues

◦BRSETMmask(M·mask==0)

◦BRCLRMmask(M·mask==0)

◦Example:

–BRSET$1000,X$07

xxxxxxxx·00000111=00000xxx

–BRCLR$1000,X$07

xxxxxxxx·00000111=00000xxx

CHALMERSLindholmen28

Page 115: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

NormalExecution,Reset,Interrupts

CHALMERSLindholmen29

Page 116: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

NormalExecution,Reset,Interrupts

Power on reset Initialisationroutines

Main program

***

*

Power on reset Initialisationroutines

Main program

Subroutine

JSR address *

**

**

**

RTS

*

CHALMERSLindholmen29

Page 117: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

NormalExecution,Reset,Interrupts

Power on reset Initialisationroutines

Main program

***

*

Power on reset Initialisationroutines

Main program

Subroutine

JSR address *

**

**

**

RTS

*

CHALMERSLindholmen29

Page 118: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Power on reset Initialisationroutines

Main program

Reset

***

*

Power on reset Initialisationroutines

Main program

Interrupt

Interrupt ServiceRoutine

precoded/prespecified memory locations

***

*

*

*RTI

*

*

CHALMERSLindholmen30

Page 119: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ResetsandInterrupts

CHALMERSLindholmen31

Page 120: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

◦Resets:

◦Resets:

-Poweronreset(POR)

◦Resets:

-Poweronreset(POR)

-RESET

◦Resets:

-Poweronreset(POR)

-RESET

-Clockmonitorfail

◦Resets:

-Poweronreset(POR)

-RESET

-Clockmonitorfail

-COPfail◦Resets:

-Poweronreset(POR)

-RESET

-Clockmonitorfail

-COPfail

◦Non-maskableInterrupts:

◦Resets:

-Poweronreset(POR)

-RESET

-Clockmonitorfail

-COPfail

◦Non-maskableInterrupts:

-XIRQ

◦Resets:

-Poweronreset(POR)

-RESET

-Clockmonitorfail

-COPfail

◦Non-maskableInterrupts:

-XIRQ

-Illegalopcode(ILLOP)

◦Resets:

-Poweronreset(POR)

-RESET

-Clockmonitorfail

-COPfail

◦Non-maskableInterrupts:

-XIRQ

-Illegalopcode(ILLOP)

-Softwareinterrupts(SWI)

◦Maskableinterrupts8

◦Maskableinterrupts8

-Timeroverflow

◦Maskableinterrupts8

-Timeroverflow

-PACoverflow,

◦Maskableinterrupts8

-Timeroverflow

-PACoverflow,PACinputedge

◦Maskableinterrupts8

-Timeroverflow

-PACoverflow,PACinputedge

-SPItransfercomplete

◦Maskableinterrupts8

-Timeroverflow

-PACoverflow,PACinputedge

-SPItransfercomplete

-SCISerialsystem

◦Maskableinterrupts8

-Timeroverflow

-PACoverflow,PACinputedge

-SPItransfercomplete

-SCISerialsystem

-IRQ

◦Maskableinterrupts8

-Timeroverflow

-PACoverflow,PACinputedge

-SPItransfercomplete

-SCISerialsystem

-IRQ

-RTII

◦Maskableinterrupts8

-Timeroverflow

-PACoverflow,PACinputedge

-SPItransfercomplete

-SCISerialsystem

-IRQ

-RTII

-TIC1–3

◦Maskableinterrupts8

-Timeroverflow

-PACoverflow,PACinputedge

-SPItransfercomplete

-SCISerialsystem

-IRQ

-RTII

-TIC1–3

-TOC1–5

CHALMERSLindholmen32

Page 121: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

8,

Maskableinterruptsmainlygeneratedbyon-chipperipherals.,

Maskableinterruptsmainlygeneratedbyon-chipperipherals.,Havefixedinterruptpriorities.

Maskableinterruptsmainlygeneratedbyon-chipperipherals.,Havefixedinterruptpriorities.Anyinterruptcanbeelevatedto

thehighestpriority.

Maskableinterruptsmainlygeneratedbyon-chipperipherals.,Havefixedinterruptpriorities.Anyinterruptcanbeelevatedto

thehighestpriority.TIC1–3,PAC,IC,STRA/AScanbeconfiguredasexternalinterrupts(insingle-chipmode).

CHALMERSLindholmen33

Page 122: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

AddressvectorInterruptsourceCCRmaskLocalmask

FFD6SCIIbitTIE/TCIE/RIE/ILIE

FFD8SPIIbitSPIEFFDAPAIEIbitPAII

FFDCPAOIbitPAOVI

FFDETOFIbitTOIFFE0TOC5IbitOC5I

FFE2TOC4IbitOC4IFFE4TOC3IbitOC3I

FFE6TOC2IbitOC2IFFE8TOC1IbitOC1I

FFEATIC3IbitIC3IFFECTIC2IbitIC2I

FFEETIC1IbitIC1IFFF0RTIIbitRTI

FFF2IRQIbitNone/STAIFFF4XIRQXbitNone

FFF6SWINoneNoneFFF8ILLOPNoneNone

FFFACOPNoneNOCOPFFFCCLMNoneCME

FFFERESETNoneNone

CHALMERSLindholmen34

Page 123: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

MappingsofInterrupts

________________________________________________________________________

*BUFFALO’svectormapping*Uservectorinitialization

...xxxxLDX#TOF_ISR

FFDEVTOFFDBJTOF*TOFinterruptvectorxxxxSTX$3FDE

..._______________________________

FFFCVCMFFDBJCMF*CMFResetVector*UserInterruptServiceRoutine

FFFEVRSTFDBBUFFALO*ResetVectorTOF_ISR

________________________.

PseudovectorsinRAM.

...

EE41JTOFLDX$3FDE.

EE44JMP0,XRTI

__________________________________________________________

CHALMERSLindholmen35

Page 124: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

CHALMERSLindholmen36

Page 125: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output

CHALMERSLindholmen36

Page 126: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output–SimpleparallelI/O

CHALMERSLindholmen36

Page 127: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output–SimpleparallelI/O

–HandshakeparallelI/O

CHALMERSLindholmen36

Page 128: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output–SimpleparallelI/O

–HandshakeparallelI/O

◦TheSerialSubsystems

CHALMERSLindholmen36

Page 129: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output–SimpleparallelI/O

–HandshakeparallelI/O

◦TheSerialSubsystems–SerialCommunicationInterface

CHALMERSLindholmen36

Page 130: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output–SimpleparallelI/O

–HandshakeparallelI/O

◦TheSerialSubsystems–SerialCommunicationInterface

–SerialPeripheralInterface

CHALMERSLindholmen36

Page 131: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output–SimpleparallelI/O

–HandshakeparallelI/O

◦TheSerialSubsystems–SerialCommunicationInterface

–SerialPeripheralInterface

◦ProgrammableTimers

CHALMERSLindholmen36

Page 132: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output–SimpleparallelI/O

–HandshakeparallelI/O

◦TheSerialSubsystems–SerialCommunicationInterface

–SerialPeripheralInterface

◦ProgrammableTimers–Outputcompare

CHALMERSLindholmen36

Page 133: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output–SimpleparallelI/O

–HandshakeparallelI/O

◦TheSerialSubsystems–SerialCommunicationInterface

–SerialPeripheralInterface

◦ProgrammableTimers–Outputcompare

–Inputcapture

CHALMERSLindholmen36

Page 134: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output–SimpleparallelI/O

–HandshakeparallelI/O

◦TheSerialSubsystems–SerialCommunicationInterface

–SerialPeripheralInterface

◦ProgrammableTimers–Outputcompare

–Inputcapture

–Pulseaccumulator

CHALMERSLindholmen36

Page 135: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output–SimpleparallelI/O

–HandshakeparallelI/O

◦TheSerialSubsystems–SerialCommunicationInterface

–SerialPeripheralInterface

◦ProgrammableTimers–Outputcompare

–Inputcapture

–Pulseaccumulator

–Real-timeinterrupt

CHALMERSLindholmen36

Page 136: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output–SimpleparallelI/O

–HandshakeparallelI/O

◦TheSerialSubsystems–SerialCommunicationInterface

–SerialPeripheralInterface

◦ProgrammableTimers–Outputcompare

–Inputcapture

–Pulseaccumulator

–Real-timeinterrupt

◦A/Dconverter

CHALMERSLindholmen36

Page 137: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PARTIII

I/0INTERFACES/SUBSYSTEMS

◦ParallelInput/Output–SimpleparallelI/O

–HandshakeparallelI/O

◦TheSerialSubsystems–SerialCommunicationInterface

–SerialPeripheralInterface

◦ProgrammableTimers–Outputcompare

–Inputcapture

–Pulseaccumulator

–Real-timeinterrupt

◦A/Dconverter

◦Othersubsystems

CHALMERSLindholmen36

Page 138: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

CHALMERSLindholmen37

Page 139: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

CHALMERSLindholmen37

Page 140: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules

CHALMERSLindholmen37

Page 141: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

CHALMERSLindholmen37

Page 142: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

CHALMERSLindholmen37

Page 143: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator

CHALMERSLindholmen37

Page 144: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator,also

CHALMERSLindholmen37

Page 145: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator,also

RTII(realtimeinterrupt)

CHALMERSLindholmen37

Page 146: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator,also

RTII(realtimeinterrupt)

COP(computeroperatingproperly)

CHALMERSLindholmen37

Page 147: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator,also

RTII(realtimeinterrupt)

COP(computeroperatingproperly)

◦Applications

CHALMERSLindholmen37

Page 148: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator,also

RTII(realtimeinterrupt)

COP(computeroperatingproperly)

◦Applications–DecisionsinRealtime

CHALMERSLindholmen37

Page 149: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator,also

RTII(realtimeinterrupt)

COP(computeroperatingproperly)

◦Applications–DecisionsinRealtime

–Precisetimingofevents

CHALMERSLindholmen37

Page 150: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator,also

RTII(realtimeinterrupt)

COP(computeroperatingproperly)

◦Applications–DecisionsinRealtime

–Precisetimingofevents,e.g.

CHALMERSLindholmen37

Page 151: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator,also

RTII(realtimeinterrupt)

COP(computeroperatingproperly)

◦Applications–DecisionsinRealtime

–Precisetimingofevents,e.g.

(i)timemeasurementofinputevents,

CHALMERSLindholmen37

Page 152: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator,also

RTII(realtimeinterrupt)

COP(computeroperatingproperly)

◦Applications–DecisionsinRealtime

–Precisetimingofevents,e.g.

(i)timemeasurementofinputevents,

(ii)timingofoutputevents

CHALMERSLindholmen37

Page 153: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator,also

RTII(realtimeinterrupt)

COP(computeroperatingproperly)

◦Applications–DecisionsinRealtime

–Precisetimingofevents,e.g.

(i)timemeasurementofinputevents,

(ii)timingofoutputevents

–Countingofevents

CHALMERSLindholmen37

Page 154: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator,also

RTII(realtimeinterrupt)

COP(computeroperatingproperly)

◦Applications–DecisionsinRealtime

–Precisetimingofevents,e.g.

(i)timemeasurementofinputevents,

(ii)timingofoutputevents

–Countingofevents

–Periodicrealtimeinterrupts

CHALMERSLindholmen37

Page 155: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ProgrammableTimerOperations

◦Timersubsystemfunctions/modules–Outputcompare

–Inputcapture

–Pulseaccumulator,also

RTII(realtimeinterrupt)

COP(computeroperatingproperly)

◦Applications–DecisionsinRealtime

–Precisetimingofevents,e.g.

(i)timemeasurementofinputevents,

(ii)timingofoutputevents

–Countingofevents

–Periodicrealtimeinterrupts

–Watchdog

CHALMERSLindholmen37

Page 156: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PortApins

IC3

IC2

IC1

OC5/OC1

OC4/OC1

OC3/OC1

OC2/OC1

PAI/OC1

PA0

PA2

PA1

PA3

PA4

PA5

PA6

PA7

CHALMERSLindholmen38

Page 157: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

MainTimer&andRealTimeInterrupt

TCNTTCNT (HI)(LO)16 bit free-running counter

TOI

TOF

Prescaler1,4,8,or 16

PR1 PR0

MCU E clock

16-bit timer bus

Interruptrequest

CHALMERSLindholmen39

Page 158: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

TimerOutputcompare&Inputcapture

TOCTOC (HI)(LO)16-bit compare

OCxF

OCxI

FOCxOCx

16-bit timer bus Interruptrequest

CHALMERSLindholmen40

Page 159: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

TimerOutputcompare&Inputcapture

TOCTOC (HI)(LO)16-bit compare

OCxF

OCxI

FOCxOCx

16-bit timer bus Interruptrequest

Interruptrequest

TICTIC (HI)(LO)

16-bit latchICxF

ICxI16-bit timer bus

ICx

CHALMERSLindholmen40

Page 160: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

OC&ICApplications

CHALMERSLindholmen41

Page 161: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

OC&ICApplications

t tp

t tw

(a)(b)

Figure1:(a)periodic/pulsewaveformgenerationand(b)period/pulse-widthmeasurement

CHALMERSLindholmen41

Page 162: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Timersubsystem’scontrolandstatusregisters

CHALMERSLindholmen42

Page 163: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Timersubsystem’scontrolandstatusregisters

Miscellaneous Timer Interrupt FlagRegister 2

OM2OL2OM3OL3OM4OL4OM5OL5

1B 1A 2B 2A 3B 3A

OC1IOC2IOC3IOC4IOC5IIC1IIC2IIC3I

TCTL1

TMSK1

TCTL2

TFLG1OC1FOC2FOC3FOC4FOC5FIC1FIC2FIC3F

TMKS2TOIRTIIPAOVIPAIIPR1PR0

TFLG2TOFRTIFPAOVFPAIF

Main Timer Interrupt Mask Register 1

Main Timer Interrupt Flag Register 1

Miscellaneuos Timer Interrupt MaskRegister 2

Timer Control Register 2

Timer Control Register 1

Timer Control Register 1

EDG4B 4A

00

00

RTR1RTR0

OPTIONCR1 CR0

PACTLDDR7PAENPAMODPEDGE00

00

CHALMERSLindholmen42

Page 164: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Typicaltimersoftwaresequence

CHALMERSLindholmen43

Page 165: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Typicaltimersoftwaresequence

◦Configurethecontrolregisters

CHALMERSLindholmen43

Page 166: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Typicaltimersoftwaresequence

◦Configurethecontrolregisters

◦Writetothedataregister(ifrequired)

CHALMERSLindholmen43

Page 167: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Typicaltimersoftwaresequence

◦Configurethecontrolregisters

◦Writetothedataregister(ifrequired)

◦Waitforaflagtobeset

CHALMERSLindholmen43

Page 168: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Typicaltimersoftwaresequence

◦Configurethecontrolregisters

◦Writetothedataregister(ifrequired)

◦Waitforaflagtobeset

◦Cleartheflag

CHALMERSLindholmen43

Page 169: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Typicaltimersoftwaresequence

◦Configurethecontrolregisters

◦Writetothedataregister(ifrequired)

◦Waitforaflagtobeset

◦Cleartheflag

◦Readorwritedataasrequired

CHALMERSLindholmen43

Page 170: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Typicaltimersoftwaresequence

◦Configurethecontrolregisters

◦Writetothedataregister(ifrequired)

◦Waitforaflagtobeset

◦Cleartheflag

◦Readorwritedataasrequired

◦Repeatifdesired

CHALMERSLindholmen43

Page 171: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

RatesSelection

PR1 PR0

Timer prescaler

500 ns/ 32,77ms2 us /131.1 ms4us /262.1 ms 8us /524.3 ms

RTR1 RTR0

RTI rate selects

4.10 ms8.19 ms16.38 ms32.77 ms

resolution/overflow

CR1 CR0

COP time out

16.384 ms65.536 ms262.14 ms1.049 s

E-clock 2 MHz

TMSK2PACTLOPTION

00011011

CHALMERSLindholmen44

Page 172: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

OutputCompare

CHALMERSLindholmen45

Page 173: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

OutputCompare

1

OOO1O11

OMxOLxNo outputToggle outputDrive output lowDrive output high

TCTL1

OCxF

GenerateInterrupt

OCxIInterrupt Enable

x =2,3,4,5

OCx output

OC1M

OC1D

On succesful compare on TOC1 thedata in OC1D are output to selected(OC1M) lines (PA3--PA7)

AdditionalregiistersOC1's

CHALMERSLindholmen45

Page 174: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Oneshotpulse

*10msone-shotpulse*(E=2MHz,pre-scale1)

PWIDTHEQU$2000*WaitfortriggerbypollingforOC2Fhigh

BASEREGEQU$1000PULSE1

ORG$2000BRCLRTFLG1,X,$40,PULSEnowoutputlow

LDX#BASEREGBCLRPORTA,X,$40clearlatchforPA6

LDDTCNT,XPreventLDAA#$40

STDTOC2,XprematureOCSTAATFLG1,XclearOC2F

BSETPORTA,X,$40PA6/OC2highBCLRTCTL1,X$80disconnectOC2

LDAA#$80OKBRAOK

STAATCTL1,Xdriveoutputlow

LDAA#$40

STAATFLG1,XclearOC2Fisset

LDDTCNT,X

ADDD#PWIDTH-17

STDTOC2,X

CHALMERSLindholmen46

Page 175: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

OC1example

*Thefollowingcodewouldgeneratesthepattern0xx11(outofpinsPA7,PA4,PA3)

*onasuccessfulTOC1compare.UsesOC1MandOC1Dregisters

LDX#BASEREG

BSETPACTL,X,$80*MakesPA7output

LDAA#$98

STAAOC1M,XsetsOC1Mbits7,4,3(clearstheothers)

*anddrivesPA4,3high,PA7low

LDAA#$18setsOC1D4,3,clearsOC1D7

STAA$OC1DX

BSETTMSLK1,X$80*EnablesOC1Iinterrupt

CLI

...

CHALMERSLindholmen47

Page 176: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ICCapture

CHALMERSLindholmen48

Page 177: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ICCapture

1

OO

O

1O

11

EDGxBTCTL2

EDGxA ICx input

none

ICxF

CHALMERSLindholmen48

Page 178: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Measurementofpulsewidth

*betweenrisingandfallingedgesonIC1

ORG$2000POLLFALL

LDX$1000RegisterbaseBRCLRTFLG1,X$04POLLFALL

LDAA#$10LDDTIC1,X

STAATCTL2,XtocapturesrisingedgeSUBDRISETIME

LDAA#$04STDPULSEWIDTH

STAATFLG1,XclearIC1FflagifsetAGNBRAAGN

POLLRISERISETIMEFDB$0000

BRCLRTFLG1,X$04POLLRISEPULSEWIDTHFDB$0000

LDDTIC1,X

STDRISETIME

LDAA#$20

STAATCTL2,Xtocapturefallingedge

LDAA#$04

STAATFLG1,XclearflagIC1Fifset

CHALMERSLindholmen49

Page 179: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PAEventCountingmode

PA7/OC18-bit counter

8-bit counter

Input edgedetection

PEDGE

01

PACTL PAinput

PAOVI

PAOVF

PAII

PAIF

Interrupt

TMSK2

TFLG2

TFLG2

TMSK2

Event counting(PAMOD = 0)

Interrupt

CHALMERSLindholmen50

Page 180: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PAEventCountingmode

PA7/OC18-bit counter

8-bit counter

Input edgedetection

PEDGE

01

PACTL PAinput

PAOVI

PAOVF

PAII

PAIF

Interrupt

TMSK2

TFLG2

TFLG2

TMSK2

Event counting(PAMOD = 0)

Interrupt

CHALMERSLindholmen50

Page 181: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PATimeAccumulationmode

PA7/OC1

Clock

8-bit counter

8-bit counter

Input edgedetection

PEDGE

01

PACTLPA input

PAOVI

PAOVF

PAII

PAIF

InterruptTMSK2

TFLG2

TFLG2

TMSK2

Gated time accumulation (PAMOD = 1)

Interrupt

E/64 Clock

CHALMERSLindholmen51

Page 182: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PA-relatedregisters/bits

CHALMERSLindholmen52

Page 183: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PA-relatedregisters/bits

COP timer

TMSK2

TOF RTIF PAOVF PAIF 0 0 0 0 TFLG2

RTR1 RTR0 PAEN PAMOD PEDGE 0 0 PACTL

TOI RTII PAOVI PAII 0 0 PR1 PR0

DDR7

COP timer

Bit 7Bit 0 PACNT

CHALMERSLindholmen52

Page 184: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

PAincountingmode

ORG$4000

INIT_PACMODEPAOVF_ISR

*PAEN1,PEDGE0,PAMODE0BCLRTFLG2,X~$20*i.e.$DF

BSETPACTL,X$40BCLRTMSK2,X$20*disbleinterrupt

RTSJSRSTOP_PAINT

RTI

PA_Count

*numberofcarstobepaintedinA

BCLRTFLG2,X~$20*ClearPAOVF

BSETTMSK2,X$20*EnablePAOVI

NEGA*Twoscomplementofcount

STAAPCNT,X

CLI

RTS

CHALMERSLindholmen53

Page 185: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

RealTimeInterrupts

FCNTEQU244NumberofRTItomakeasecond

INITRTI

LDD#$0000

STDSECF

BCLRFLAG2~$40ClearRTIF

BSETTMKSK2$40EnableRTIinterrupts

RTS

RTI_ISR*interruptserviceroutineSECHCLRSECF

BCLRFLAG2,~$40ClearRTIFCLRSECF+1

LDYSECFLDYSECC

INYINY

STYSECFSTYSECC

CPY#FCNTRTI

BEQSECHSECFFCB$00secondfractions

RTISECCFCB$00secondscounts

CHALMERSLindholmen54

Page 186: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

COPtimer.Servicing

.

.

LDAA#$55

STAACOPRSTarmstheCOPtimerclearingmechanism

.

.

*Timecriticalcode

*tobeenteredherebetween

.

.

LDAA#$55

STAACOPRSTclearstheCOPtimer

CHALMERSLindholmen55

Page 187: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ParallelInput/Output

CHALMERSLindholmen56

Page 188: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ParallelInput/Output

◦GeneralPurposeI/O

CHALMERSLindholmen56

Page 189: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ParallelInput/Output

◦GeneralPurposeI/O–I/OisdonebysimplyreadingorwritingtoI/Oports

CHALMERSLindholmen56

Page 190: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ParallelInput/Output

◦GeneralPurposeI/O–I/OisdonebysimplyreadingorwritingtoI/Oports

–AllfiveHC11ports(A,B,C,DandE)canbeusedforgeneral(simple)I/O

CHALMERSLindholmen56

Page 191: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ParallelInput/Output

◦GeneralPurposeI/O–I/OisdonebysimplyreadingorwritingtoI/Oports

–AllfiveHC11ports(A,B,C,DandE)canbeusedforgeneral(simple)I/O

–Eachporthasacorrespondingdataregister,PORTA,PORTB,PORTC,PORTD

andPORTE

CHALMERSLindholmen56

Page 192: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ParallelInput/Output

◦GeneralPurposeI/O–I/OisdonebysimplyreadingorwritingtoI/Oports

–AllfiveHC11ports(A,B,C,DandE)canbeusedforgeneral(simple)I/O

–Eachporthasacorrespondingdataregister,PORTA,PORTB,PORTC,PORTD

andPORTE

–BidirectionalportsDandChavecorrespondingdatadirectionregistersDDRCand

DDRD

CHALMERSLindholmen56

Page 193: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ParallelInput/Output

◦GeneralPurposeI/O–I/OisdonebysimplyreadingorwritingtoI/Oports

–AllfiveHC11ports(A,B,C,DandE)canbeusedforgeneral(simple)I/O

–Eachporthasacorrespondingdataregister,PORTA,PORTB,PORTC,PORTD

andPORTE

–BidirectionalportsDandChavecorrespondingdatadirectionregistersDDRCand

DDRD

◦StrobedandFull-HandshakeI/Omodes

CHALMERSLindholmen56

Page 194: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ParallelInput/Output

◦GeneralPurposeI/O–I/OisdonebysimplyreadingorwritingtoI/Oports

–AllfiveHC11ports(A,B,C,DandE)canbeusedforgeneral(simple)I/O

–Eachporthasacorrespondingdataregister,PORTA,PORTB,PORTC,PORTD

andPORTE

–BidirectionalportsDandChavecorrespondingdatadirectionregistersDDRCand

DDRD

◦StrobedandFull-HandshakeI/Omodes–PortCalternatelatchedregister(PORTCL)

CHALMERSLindholmen56

Page 195: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ParallelInput/Output

◦GeneralPurposeI/O–I/OisdonebysimplyreadingorwritingtoI/Oports

–AllfiveHC11ports(A,B,C,DandE)canbeusedforgeneral(simple)I/O

–Eachporthasacorrespondingdataregister,PORTA,PORTB,PORTC,PORTD

andPORTE

–BidirectionalportsDandChavecorrespondingdatadirectionregistersDDRCand

DDRD

◦StrobedandFull-HandshakeI/Omodes–PortCalternatelatchedregister(PORTCL)

–ParallelI/OcontrolregisterPIOC

CHALMERSLindholmen56

Page 196: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ParallelInput/Output

◦GeneralPurposeI/O–I/OisdonebysimplyreadingorwritingtoI/Oports

–AllfiveHC11ports(A,B,C,DandE)canbeusedforgeneral(simple)I/O

–Eachporthasacorrespondingdataregister,PORTA,PORTB,PORTC,PORTD

andPORTE

–BidirectionalportsDandChavecorrespondingdatadirectionregistersDDRCand

DDRD

◦StrobedandFull-HandshakeI/Omodes–PortCalternatelatchedregister(PORTCL)

–ParallelI/OcontrolregisterPIOC

–STRAinputpin(relatedtoPORTCL)

CHALMERSLindholmen56

Page 197: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ParallelInput/Output

◦GeneralPurposeI/O–I/OisdonebysimplyreadingorwritingtoI/Oports

–AllfiveHC11ports(A,B,C,DandE)canbeusedforgeneral(simple)I/O

–Eachporthasacorrespondingdataregister,PORTA,PORTB,PORTC,PORTD

andPORTE

–BidirectionalportsDandChavecorrespondingdatadirectionregistersDDRCand

DDRD

◦StrobedandFull-HandshakeI/Omodes–PortCalternatelatchedregister(PORTCL)

–ParallelI/OcontrolregisterPIOC

–STRAinputpin(relatedtoPORTCL)

–STRBoutputpin(relatedtoPORTB)

CHALMERSLindholmen56

Page 198: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

GeneralPurposeI/O

CHALMERSLindholmen57

Page 199: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

GeneralPurposeI/O

1

0

111

00

01

0

1

DDRCPORTC+5v

0

Off

On x

xx

x

6K2

6K2

6K2

6K2

CMOS sinking 1.6 ma

Drivers

CHALMERSLindholmen57

Page 200: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

GeneralPurposeI/O

1

0

111

00

01

0

1

DDRCPORTC+5v

0

Off

On x

xx

x

6K2

6K2

6K2

6K2

CMOS sinking 1.6 ma

Drivers

*Example

LDAA#$F0

STAADDRC,X%1111000PC7-4ouput,PC3-0input

LDAA#$80

STAAPORTC,X%1000xxxxPC7high,PC6low

LDAAPORTC,Xvaluered%xxxxxx10

CHALMERSLindholmen57

Page 201: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

StrobedInput/Output

Relevantregisters

CHALMERSLindholmen58

Page 202: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

StrobedInput/Output

Relevantregisters

PORTCL

PORTB

PIOC

STRA

STRB

STAFSTAIHNDSEGAINVB CWOMOINPLSStro

be A flag

Strobe A In

terrupt E

nable

Port C wire

d Mode

Handshake/Simple Strobe Select

Output/Input H

andshake

Select

Strobe B Pulse

Mode Select

Edge Select for S

trobe A

Invert S

trobe B

CHALMERSLindholmen58

Page 203: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

StrobedInput/Output

Asampleprogram

CHALMERSLindholmen59

Page 204: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

StrobedInput/Output

Asampleprogram

*TheMCreceivesdatasentbyaperipheral(onSTRAedge)and

echoesthemback(STRBlowfortwoclockcycles)

ORG$C000startaddress

LDY#DPTRYpointstodatatobereceived

BSETPIOC,X$40enableSTRAinterrupt

CLIclearinterruptmask(Ibit)

RPTWAIwaitforinterrupt

*fromfallingedgeSTRAinput

STAA0,Ysavereceiveddata

STAAPORTB,Xechoback

INY

...

BRARPT

CHALMERSLindholmen59

Page 205: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

StrobedInput/Output(cont.)

%Interruptserviceroutine

SIO_ISRLDAAPIOC,Xtheinstructionspair

LDAAPORTCL,XclearSTAF

RTI

CHALMERSLindholmen60

Page 206: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

FullOutputHandshake

CHALMERSLindholmen61

Page 207: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

FullOutputHandshake

68HC11

PORTC

Peripheral device

STRA

STRB

Data

Ready

Ack

deasserted by STRA

Writing to PORTCL(i )Assert STRB

STRA (i) Deassert STRB(i) Set STAF

Strobed

Interlocked

CHALMERSLindholmen61

Page 208: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

FullInputHandshake

CHALMERSLindholmen62

Page 209: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

FullInputHandshake

68HC11

PORTCL

Peripheral device

STRA

STRB

Data

Send

Data read

deasserted by STRA

STRA (i )Data latched(ii)Set STAF(iii)Deassert STRB

Reading Port C(i) Assert STRB

Strobed

Interlocked

CHALMERSLindholmen62

Page 210: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

FullInputHandshake

68HC11

PORTCL

Peripheral device

STRA

STRB

Data

Send

Data read

deasserted by STRA

STRA (i )Data latched(ii)Set STAF(iii)Deassert STRB

Reading Port C(i) Assert STRB

Strobed

Interlocked

CHALMERSLindholmen62

Page 211: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

AnInputHandshakeProgram

INIT_HNDSIN_HNDS

PSHA*UsesinputhandshaketoreadportC;

*strobemodefirst*pollsforSTRAtransitionsBCLRPIOC,X,$10BRCLRPIOC,X,\$80INHNDS

*clearSTAFifset*InputsstrobeddataandclearSTAF

LDAAPIOC,XLDAAPORTCL,X

LDAAPORTCL,XRTS

*PortCInput*-----------------------------------

LDAA\#\$00RDDATA

STAADDRC,X*Readdatafromperipheral

*InputHandshakeModeJSRINIT_HNDS

LDAA#$10JSRIN_HNDS

STAAPIOC,X%HNDS1...

PULABRARPT

RTSRTS

CHALMERSLindholmen63

Page 212: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SerialCommunicationInterface

CHALMERSLindholmen64

Page 213: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SerialCommunicationInterface

◦Asynchronouscommunicationwithremotedevices

CHALMERSLindholmen64

Page 214: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SerialCommunicationInterface

◦Asynchronouscommunicationwithremotedevices

◦InterfacingstandardRS232(orEIA232A)

CHALMERSLindholmen64

Page 215: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SerialCommunicationInterface

◦Asynchronouscommunicationwithremotedevices

◦InterfacingstandardRS232(orEIA232A)

Thestandarddefines

CHALMERSLindholmen64

Page 216: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SerialCommunicationInterface

◦Asynchronouscommunicationwithremotedevices

◦InterfacingstandardRS232(orEIA232A)

Thestandarddefinessignallevels,

CHALMERSLindholmen64

Page 217: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SerialCommunicationInterface

◦Asynchronouscommunicationwithremotedevices

◦InterfacingstandardRS232(orEIA232A)

Thestandarddefinessignallevels,connectors,

CHALMERSLindholmen64

Page 218: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SerialCommunicationInterface

◦Asynchronouscommunicationwithremotedevices

◦InterfacingstandardRS232(orEIA232A)

Thestandarddefinessignallevels,connectors,andpinassignment

CHALMERSLindholmen64

Page 219: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SerialCommunicationInterface

◦Asynchronouscommunicationwithremotedevices

◦InterfacingstandardRS232(orEIA232A)

Thestandarddefinessignallevels,connectors,andpinassignment

◦Onetransmittermanyreceivers

CHALMERSLindholmen64

Page 220: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SerialCommunicationInterface

◦Asynchronouscommunicationwithremotedevices

◦InterfacingstandardRS232(orEIA232A)

Thestandarddefinessignallevels,connectors,andpinassignment

◦Onetransmittermanyreceivers

◦Thebasicunitofinformationisthecharacterordataframe

CHALMERSLindholmen64

Page 221: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SerialCommunicationInterface

◦Asynchronouscommunicationwithremotedevices

◦InterfacingstandardRS232(orEIA232A)

Thestandarddefinessignallevels,connectors,andpinassignment

◦Onetransmittermanyreceivers

◦Thebasicunitofinformationisthecharacterordataframe

◦Baudratedefinesthenumberofbits(includingstart,stopandparitybits)persecond

CHALMERSLindholmen64

Page 222: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SCI(cont.)

TxD

RxD

DTEDCE

SG

TxD

RxDSG

DTE DCE

2/BA

3/BB

7/AB

3

2

7

Tx1

Rx1

TxD

RxDPD1

PD0

RxD

TxDSG

DB25Sconnector MC144507

68HC11

DI1

D01

(a)(b)

Figure2:(a)NullMODEMand(b)RS232DCE(MCinterface)

CHALMERSLindholmen65

Page 223: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

TransmissioninSCIsystem

T8

R8

TDR Buffer

Shift Register

Shift Register

TDRE

RDRF RDR Buffer

Data from MCU

Data in

Data out

Data to MCU

TRANSMITTER

RECEIVER

1

1

STARTSTOP

PARITY IDLE

BREAK

01234567

Framing

CHALMERSLindholmen66

Page 224: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SCIregistersandcontrolbits

BAUD

SCCR1

SCCR2

SCSR

SCDR

TCLR0SCP1SCP2RCKBSCR2SCR1SCR0

R8T8

0

0MWAKE0 00

TIETCIERIEILIETERERWUSBK

TDRETCRDRFIDLEORNFFE

R7R6R5R4R3R2R1R0T T6 T5 T4 T3 2T T1 T0 7

prescalerrate select

Mode 8/9 bitsIdle line/ address mark

Sent break

receiver wake up

control

Transfer completeIddle line

Transmit enable

Receiver enable

R,T eight bit

emptycompletefull

iddle line

overrun erro

r

noise erro

r

framing erro

r

interrupt(s) enable

CHALMERSLindholmen67

Page 225: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

UsingSCI

INITSCIINSCI

LDAA#$309600baudLDAASCCRReadstatusregister

STAABAUDbaudregisterANDA#$20CheckRDRF

LDAA#$00BEQINSCIWaitfordata

STAASCCR11start,8bits,1stopLDAASCDATReaddata

LDAA#$0CANDA#$7FMaskparity

STAASCCR2transmitterreceiverenableRTS

RTS

OUTSCI

LDABSCCRReadstatusregister

BITB#$80CheckTDRE

BEQOUTSCILoopuntilTDRE=1

ANDA#$7FMaskparity

STAASCDATSendcharacter

RTS

CHALMERSLindholmen68

Page 226: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

Protocols

CRC Data block

Simplex

CRC Data block

ACK/NAK

(XON/XOF)

Half duplex

(a)(b)

CRC Data block CRC Ack block

CRC Ack blockCRC Data block

Duplex

(c)

CHALMERSLindholmen69

Page 227: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SPIbasics

CHALMERSLindholmen70

Page 228: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SPIbasics

data registerdata register

shift registershift registerMOSI

MISO

MasterSlave

VDD

SSSS

SCKSCK

CHALMERSLindholmen70

Page 229: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

ICthatusesynchronousserialinterface

◦PLLfrequencysynthesizers(MC145156)

◦Seven-segmentsdisplaydecoders/drivers(MC14499)

◦LCDdisplaydecoders/drivers(MC145453)

◦ADC(MC145041)

◦DAC(MC144110,DAC-8840)

◦Shiftregisters(74HC589,74HC595)

◦Realtimeclocks(MC68HC68T1)

◦ISDNtransceivers

◦SerialRAMchip(DS1200),etc.

CHALMERSLindholmen71

Page 230: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SPITopologies

CHALMERSLindholmen72

Page 231: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SPITopologies��������������������������������������������������������������������������������������������������������������������� ���������������������������������

��������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������������������������������������������

���������������������������������������

�������������������������������������������

�����������������������������������������������������������������������������������������������������������������������������������

������������������������������

����������

�������������������������������������������� ���������������������������������������������������������������������������������������������������������������������������

�������������������������

�������������������

�������������������

�����������������

�������������������

Bus topology

Cascade topology

���������������������������������

���������������������������������������

�������������������������������������������

���������������������������������

���������������������������������������

�������������������������������������������

���������������������������������

���������������������������������������

�������������������������������������������

MOSISCK

MISO

SCK

MOSI MISO

CHALMERSLindholmen72

Page 232: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SPIBustopology

CHALMERSLindholmen73

Page 233: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SPIBustopology

MISOMOSI

SCK

SS

SS_1

SS_2

SSSS

MISO

MOSI

SCK

MISO

MOSI

MOSI

+5v

PD2

PD3

PD4

PD5

from other port

CHALMERSLindholmen73

Page 234: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SPICascadetopology

CHALMERSLindholmen74

Page 235: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SPICascadetopology

MISOMOSI

SCK

SS

SI

SS

SO

Slave 1

SI

SCKSS

SO

Slave 2

SCK

+5v

CHALMERSLindholmen74

Page 236: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SPIOperations

Master

iWriteabytetodataregisterSPDR(SSpreviouslyassertedlow)

iiWaitforSPIFtobeset(deassertslaveSShigh)

iiireadabytefromSPDR

Slave

iwriteabytetoSPDR

iiWaitforSPIFtobeset

iiiReadsabytefromdataregisterSPDR

CHALMERSLindholmen75

Page 237: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

MasterSPIOperations:Example

DemonstratesSPIbyteoutputandinput(slavealwaysenabled)

DATAEQU0

ORG$4000

LDX#$1000

LDAA#$38enableSPIoutputs

STAADDRD,XPD5general-purposeoutput

LDAA#$57

STAASPCR,XSPImaster

CPHA=1,CPOL=0,clockrate1/32

LDAADATAgetsomedata

STAASPDR,Xandtransmitit

POLL

TSTSPSR,Xwaitfortransfercomplete

BPLPOLLbranchifplus(SPIFbit0)

LDAASPDR,Xgetdatafromtheslave

(alsoclearsSPIF)

DONEBRADONE

CHALMERSLindholmen76

Page 238: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SlaveSPIOperations:Example

DemonstratesSPIbyteoutputandinput(slavealwaysenabled)

DATAEQU0

ORG$4000

LDX#$1000

LDAA#$04EnableMISOoutput

STAADDRD,Xothersforcedasinputs

LDAA#$47

STAASPCR,XSPIslave,CPHA=1,CPOL=0,

Clockratedon’tcare

LDAADATAGetsomedata

STAASPDR,Xandsendtodataregister

POLLWaitformasterclocktoshift

itoutandmaster’sdatein

TSTSPSR,Xwaitfortransfercomplete

PBLPOLLuntilmastertransfercomplete

LDAASPDR,Xgetdatafromtheslave

(alsoclearsSPIF)

DONEBRADONE

CHALMERSLindholmen77

Page 239: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

SummaryofFeatures

◦CentralProcessingUnit(CPU)

–Upto5/3Mhz(5/3V)

–Two8-bitandone16bitaccumulator

–Two16-bitindexregisters

–16-bitstackpointer

–(Powerful)bit-manipulationinstructions

–Six(powerful)addressingmodes

–Memory-mappedI/Oandspecialfunctions

–16x16integerandfractionaldivide

–8x8multiply

–Power-savingstopandwaitmodes

◦EEPROM

–On-chipbyte-erasableEEPROM

CHALMERSLindholmen78

Page 240: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

–Noseparatevoltagerequired

CHALMERSLindholmen79

Page 241: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

◦ExpandedBusmemoryinterface

–64KBaddressingspace

–(Some68HC11s)Upto1MBaddressingspace

–Eithermultiplexedornon-multiplexedinterfaces

◦SerialCommunicationInterface(SCI)9

–Standardmark/spacenon-returntozeroformat

–Fullduplexoperation

–Doublebufferingofbothreceiverandtransmitter

–Programmable8-bitor9-bitcharacterlength

–Errordetection—at1/126ofabittime

–Baudrategeneratorwithprogrammablebaudrate

–Idlelineandaddressmarkwakeupmethods

–Receiverframingerrordetection

–Breaksendcapability

–Optionalparitycheckingandgeneration

–Separatetransmitter,receiveranderrorinterruptvectors9usedforasynchronouscommunicationwithaterminal,computerormicrocontrollernetworkoverlongdistance(RS-232)

CHALMERSLindholmen80

Page 242: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

◦SerialPeripheralInterface(SPI10

)

–Fullduplex,threewiresynchronoustransfers

–Masterorslaveoperation

–BitfrequencyisE/2(Master)E/1(Slave)

–Fourprogrammablemasterbit-rates

–Programmableclockpolarityandphase

–Endoftransitioninterruptflag

◦Lower-PowerOperation

–Lowpowerforvoltages(3–5V)

–Phase-lockedloop(PLL)clocksynthesizercircuit11

◦HighPerformanceTimer

–Freerunning16bitcounter

–Programmableprescaler10usedforsynchronouscommunicationwithperipheraldevicesovershortdistances(usuallyonasinglePCB)suchasshift

register,serialEEPROM,LCDorADCsubsystems11PLLreducestheclockspeed

CHALMERSLindholmen81

Page 243: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

–Overflowinterrupt

–Separatefunctioninterrupts

CHALMERSLindholmen82

Page 244: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

◦AdditionalFeatures

–Multipleinputcaptureandoutputcomparefunctions

–Real-timeinterrupts

–ComputerOperatingProperlyWatchdog(COP)

–Pulseaccumulatorforexternaleventcountingorgatedaccumulations

–OptionalPWM12

–Optionaleventcountersystemforadvancetimingoperation

◦AnalogtodigitalConverter(ADC)

–Linearsuccessiveapproximation

–8-bitor10-bitresolution

–Singleorcontinuousconversionmodes

–Multipleresultregisters

–SelectableADCclock

–Analogmutiplexer13

12offeringuptosixchannelsandupto16-bitPWM13allowsvariablenumberofchannelswithasingleADC

CHALMERSLindholmen83

Page 245: svenk/mikrodatorsystem/HC11/... · The MC68HC11 MICROCONTROLLER Applications of Microcontrollers Consumer Electronic (Automotive anti-theft system using RF ID) Medical Monito ring

TheMC68HC11MICROCONTROLLER

◦Pulse-widthmodulation

–UptosixPWMchannels14

–Softwareselectabledutycycles(from0–100%)

14whichcancreatecontinuouswaveformswithprogrammablerates

CHALMERSLindholmen84