The 8051 Microcontroller and EmbeddedSystemsUsing Assembly and CSecond EditionMuhammad Ali MazidiJanice Gillispie MazidiRo...
Home Automation, Networking, and Entertainment LabDept. of Computer Science and Information EngineeringNational Cheng Kung...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 2HANELOUTLINESNumbering a...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 3HANELNUMBERINGAND CODING...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 4HANELNUMBERINGAND CODING...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 5HANELNUMBERINGAND CODING...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 6HANELNUMBERINGAND CODING...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 7HANELNUMBERINGAND CODING...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 8HANELNUMBERINGAND CODING...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 9HANELNUMBERINGAND CODING...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 10HANELNUMBERINGAND CODIN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 11HANELNUMBERINGAND CODIN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 12HANELNUMBERINGAND CODIN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 13HANELDIGITALPRIMERBinar...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 14HANELDIGITALPRIMERLogic...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 15HANELDIGITALPRIMERLogic...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 16HANELDIGITALPRIMERLogic...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 17HANELDIGITALPRIMERLogic...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 18HANELDIGITALPRIMERLogic...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 19HANELDIGITALPRIMERLogic...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 20HANELDIGITALPRIMERLogic...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 21HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 22HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 23HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 24HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 25HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 26HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 27HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 28HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 29HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 30HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 31HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 32HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 33HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 34HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 35HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 36HANELINSIDE THECOMPUTER...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 37HANELINSIDE THECOMPUTER...
Home Automation, Networking, and Entertainment LabDept. of Computer Science and Information EngineeringNational Cheng Kung...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 2HANELOUTLINESMicrocontro...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 3HANELMICRO-CONTROLLERSAN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 4HANELMICRO-CONTROLLERSAN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 5HANELMICRO-CONTROLLERSAN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 6HANELMICRO-CONTROLLERSAN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 7HANELMICRO-CONTROLLERSAN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 8HANELMICRO-CONTROLLERSAN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 9HANELMICRO-CONTROLLERSAN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 10HANELMICRO-CONTROLLERSA...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 11HANELMICRO-CONTROLLERSA...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 12HANELMICRO-CONTROLLERSA...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 13HANELOVERVIEW OF8051 FA...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 14HANELOVERVIEW OF8051 FA...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 15HANELOVERVIEW OF8051 FA...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 16HANELOVERVIEW OF8051 FA...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 17HANELOVERVIEW OF8051 FA...
Home Automation, Networking, and Entertainment LabDept. of Computer Science and Information EngineeringNational Cheng Kung...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 2HANELINSIDE THE8051Regis...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 3HANELINSIDE THE8051Regis...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 4HANELINSIDE THE8051Regis...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 5HANELINSIDE THE8051MOVIn...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 6HANELINSIDE THE8051MOVIn...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 7HANELINSIDE THE8051ADDIn...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 8HANELStructure ofAssembl...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 9HANELStructure ofAssembl...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 10HANELStructure ofAssemb...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 11HANELASSEMBLINGAND RUNN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 12HANELASSEMBLINGAND RUNN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 13HANELASSEMBLINGAND RUNN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 14HANELASSEMBLINGAND RUNN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 15HANELASSEMBLINGAND RUNN...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 16HANELPROGRAMCOUNTER AND...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 17HANELPROGRAMCOUNTER AND...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 18HANELPROGRAMCOUNTER AND...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 19HANELPROGRAMCOUNTER AND...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 20HANELPROGRAMCOUNTER AND...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 21HANELPROGRAMCOUNTER AND...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 22HANELPROGRAMCOUNTER AND...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 23HANEL8051 DATATYPES AND...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 24HANEL8051 DATATYPES AND...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 25HANEL8051 DATATYPES AND...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 26HANEL8051 DATATYPES AND...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 27HANEL8051 DATATYPES AND...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 28HANELFLAG BITS ANDPSW R...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 29HANELFLAG BITS ANDPSW R...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 30HANELFLAG BITS ANDPSW R...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 31HANELFLAG BITS ANDPSW R...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 32HANELFLAG BITS ANDPSW R...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 33HANELFLAG BITS ANDPSW R...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 34HANELREGISTERBANKS ANDS...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 35HANEL8051REGISTERBANKS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 36HANEL8051REGISTERBANKS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 37HANEL8051REGISTERBANKS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 38HANEL8051REGISTERBANKS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 39HANEL8051REGISTERBANKS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 40HANEL8051REGISTERBANKS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 41HANEL8051REGISTERBANKS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 42HANEL8051REGISTERBANKS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 43HANEL8051REGISTERBANKS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 44HANEL8051REGISTERBANKS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 45HANEL8051REGISTERBANKS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 46HANEL8051REGISTERBANKS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 47HANEL8051REGISTERBANKS ...
Home Automation, Networking, and Entertainment LabDept. of Computer Science and Information EngineeringNational Cheng Kung...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 2HANELLOOP ANDJUMPINSTRUC...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 3HANELLOOP ANDJUMPINSTRUC...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 4HANELLOOP ANDJUMPINSTRUC...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 5HANELLOOP ANDJUMPINSTRUC...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 6HANELLOOP ANDJUMPINSTRUC...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 7HANELLOOP ANDJUMPINSTRUC...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 8HANELLOOP ANDJUMPINSTRUC...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 9HANELLOOP ANDJUMPINSTRUC...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 10HANELCALLINSTRUCTIONSCa...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 11HANELCALLINSTRUCTIONSLC...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 12HANELCALLINSTRUCTIONSLC...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 13HANELCALLINSTRUCTIONSCA...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 14HANELCALLINSTRUCTIONSUs...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 15HANELCALLINSTRUCTIONSCa...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 16HANELCALLINSTRUCTIONSAC...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 17HANELCALLINSTRUCTIONSAC...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 18HANELTIME DELAYFOR VARI...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 19HANELTIME DELAYFOR VARI...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 20HANELTIME DELAYFOR VARI...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 21HANELTIME DELAYFOR VARI...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 22HANELTIME DELAYFOR VARI...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 23HANELTIME DELAYFOR VARI...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 24HANELTIME DELAYFOR VARI...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 25HANELTIME DELAYFOR VARI...
Home Automation, Networking, and Entertainment LabDept. of Computer Science and Information EngineeringNational Cheng Kung...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 2HANELI/OPROGRAMMING8051(...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 3HANELI/OPROGRAMMINGI/O P...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 4HANELI/OPROGRAMMINGPort ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 5HANELI/OPROGRAMMINGPort ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 6HANELI/OPROGRAMMINGPort ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 7HANELI/OPROGRAMMINGDual ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 8HANELI/OPROGRAMMINGPort ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 9HANELI/OPROGRAMMINGPort ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 10HANELI/OPROGRAMMINGPort...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 11HANELI/OPROGRAMMINGPort...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 12HANELI/OPROGRAMMINGPort...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 13HANELI/OPROGRAMMINGPort...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 14HANELI/OPROGRAMMINGPort...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 15HANELI/OPROGRAMMINGDiff...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 16HANELI/O BITMANIPULATIO...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 17HANELI/O BITMANIPULATIO...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 18HANELI/O BITMANIPULATIO...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 19HANELI/O BITMANIPULATIO...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 20HANELI/O BITMANIPULATIO...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 21HANELI/O BITMANIPULATIO...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 22HANELI/O BITMANIPULATIO...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 23HANELI/O BITMANIPULATIO...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 24HANELI/O BITMANIPULATIO...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 25HANELI/O BITMANIPULATIO...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 26HANELREADINGINPUT PINS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 27HANELREADINGINPUT PINS ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 28HANELI/O BITMANIPULATIO...
Home Automation, Networking, and Entertainment LabDept. of Computer Science and Information EngineeringNational Cheng Kung...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 2HANELADDRESSINGMODESThe ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 3HANELIMMEDIATEADDRESSING...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 4HANELIMMEDIATEADDRESSING...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 5HANELREGISTERADDRESSINGM...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 6HANELACCESSINGMEMORYDire...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 7HANELACCESSINGMEMORYSFR ...
Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 8HANELACCESSINGMEMORYSFR ...
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi
Upcoming SlideShare
Loading in...5
×

The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi

5,240

Published on

Published in: Technology, Business
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,240
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
342
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

The 8051 microcontroller and embedded systems using assembly and c 2nd-ed by mazidi

  1. 1. The 8051 Microcontroller and EmbeddedSystemsUsing Assembly and CSecond EditionMuhammad Ali MazidiJanice Gillispie MazidiRolin D. McKinlayCONTENTSIntroduction to ComputingThe 8051 Microcontrollers8051 Assembly Language ProgrammingBranch InstructionsI/O Port Programming8051 Addressing ModesArithmetic & Logic Instructions And Programs8051 Programming in C8051 Hardware Connection and Hex File8051 Timer/Counter Programming in Assembly and C8051 Serial Port Programming in Assembly and CInterrupts Programming in Assembly and C8051 Interfacing to External Memory8051 Real World Interfacing I: LCD,ADC ANDSENSORSLCD and Keyboard Interfacing8051 Interfacing with 8255
  2. 2. Home Automation, Networking, and Entertainment LabDept. of Computer Science and Information EngineeringNational Cheng Kung University, TAIWANChung-Ping Young楊中平INTRODUCTION TOCOMPUTINGThe 8051 Microcontroller and EmbeddedSystems: Using Assembly and CMazidi, Mazidi and McKinlay
  3. 3. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 2HANELOUTLINESNumbering and coding systemsDigital primerInside the computer
  4. 4. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 3HANELNUMBERINGAND CODINGSYSTEMSDecimal andBinary NumberSystemsHuman beings use base 10 (decimal)arithmeticThere are 10 distinct symbols, 0, 1, 2, …,9Computers use base 2 (binary) systemThere are only 0 and 1These two binary digits are commonlyreferred to as bits
  5. 5. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 4HANELNUMBERINGAND CODINGSYSTEMSConvertingfrom Decimalto BinaryDivide the decimal number by 2repeatedlyKeep track of the remaindersContinue this process until the quotientbecomes zeroWrite the remainders in reverse orderto obtain the binary numberEx. Convert 2510 to binaryQuotient Remainder25/2 = 12 1 LSB (least significant bit)12/2 = 6 06/2 = 3 03/2 = 1 11/2 = 0 1 MSB (most significant bit)Therefore 2510 = 110012
  6. 6. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 5HANELNUMBERINGAND CODINGSYSTEMSConvertingfrom Binary toDecimalKnow the weight of each bit in a binarynumberAdd them together to get its decimalequivalentUse the concept of weight to convert adecimal number to a binary directlyEx. Convert 110012 to decimalWeight: 24 23 22 21 20Digits: 1 1 0 0 1Sum: 16 + 8 + 0 + 0 + 1 = 2510Ex. Convert 3910 to binary32 + 0 + 0 + 4 + 2 + 1 = 39Therefore, 3910 = 1001112
  7. 7. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 6HANELNUMBERINGAND CODINGSYSTEMSHexadecimalSystemBase 16, thehexadecimal system,is used as aconvenientrepresentation ofbinary numbersex.It is much easier torepresent a string of 0sand 1s such as100010010110 as itshexadecimal equivalent of896HF111115E111014D110113C110012B101111A101010910019810008701117601106501015401004300113200102100011000000HexBinaryDecimal
  8. 8. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 7HANELNUMBERINGAND CODINGSYSTEMSConvertingbetween Binaryand HexTo represent a binary number as itsequivalent hexadecimal numberStart from the right and group 4 bits at atime, replacing each 4-bit binary numberwith its hex equivalentTo convert from hex to binaryEach hex digit is replaced with its 4-bitbinary equivalentEx. Convert hex 29B to binary2 9 B= 0010 1001 1011Ex. Represent binary 100111110101 in hex1001 1111 0101= 9 F 5
  9. 9. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 8HANELNUMBERINGAND CODINGSYSTEMSConvertingfrom Decimalto HexConvert to binary first and thenconvert to hexConvert directly from decimal to hexby repeated division, keeping track ofthe remaindersEx. Convert 4510 to hex32 16 8 4 2 11 0 1 1 0 1 32 + 8 + 4 + 1 = 454510 = 0010 11012 = 2D16Ex. Convert 62910 to hex512 256 128 64 32 16 8 4 2 11 0 0 1 1 1 0 1 0 162910 = 512+64+32+16+4+1 = 0010 0111 01012 = 27516
  10. 10. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 9HANELNUMBERINGAND CODINGSYSTEMSConvertingfrom Hex toDecimalConvert from hex to binary and then todecimalConvert directly from hex to decimalby summing the weight of all digitsEx. 6B216 = 0110 1011 001021024 512 256 128 64 32 16 8 4 2 11 1 0 1 0 1 1 0 0 1 01024 + 512 + 128 + 32 + 16 + 2 = 171410
  11. 11. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 10HANELNUMBERINGAND CODINGSYSTEMSAddition of HexNumbersAdding the digits together from theleast significant digitsIf the result is less than 16, write that digitas the sum for that positionIf it is greater than 16, subtract 16 from itto get the digit and carry 1 to the nextdigitEx. Perform hex addition: 23D9 + 94BE23D9 LSD: 9 + 14 = 23 23 – 16 = 7 w/ carry+ 94BE 1 + 13 + 11 = 25 25 – 16 = 9 w/ carryB897 1 + 3 + 4 = 8MSD: 2 + 9 = B
  12. 12. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 11HANELNUMBERINGAND CODINGSYSTEMSSubtraction ofHex NumbersIf the second digit is greater than thefirst, borrow 16 from the precedingdigitEx. Perform hex subtraction: 59F – 2B859F LSD: 15 – 8 = 7– 2B8 9 + 16 – 11 = 14 = E162E7 5 – 1 – 2 = 2
  13. 13. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 12HANELNUMBERINGAND CODINGSYSTEMSASCII CodeThe ASCII (pronounced “ask-E”) codeassigns binary patterns forNumbers 0 to 9All the letters of English alphabet,uppercase and lowercaseMany control codes and punctuationmarksThe ASCII system uses 7 bits torepresent each codez7AZ5Ay79Y59….........d64D44c63C43b62B42a61A41SymbolHexSymbolHexSelected ASCII codes
  14. 14. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 13HANELDIGITALPRIMERBinary LogicTwo voltage levels can be representedas the two digits 0 and 1Signals in digital electronics have twodistinct voltage levels with built-intolerances for variations in the voltageA valid digital signal should be withineither of the two shaded areas012345Logic 0Logic 1
  15. 15. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 14HANELDIGITALPRIMERLogic GatesAND gateOR gateComputer Science Illuminated, Dale and LewisComputer Science Illuminated, Dale and Lewis
  16. 16. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 15HANELDIGITALPRIMERLogic Gates(cont’)Tri-state bufferInverterXOR gateComputer Science Illuminated, Dale and LewisComputer Science Illuminated, Dale and Lewis
  17. 17. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 16HANELDIGITALPRIMERLogic Gates(cont’)NAND gateNOR gateComputer Science Illuminated, Dale and LewisComputer Science Illuminated, Dale and Lewis
  18. 18. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 17HANELDIGITALPRIMERLogic DesignUsing GatesHalf adderFull adderDigital Design, Mano
  19. 19. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 18HANELDIGITALPRIMERLogic DesignUsing Gates(cont’)4-bit adderDigital Design, Mano
  20. 20. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 19HANELDIGITALPRIMERLogic DesignUsing Gates(cont’)DecodersDecoders are widely used for addressdecoding in computer designAddress decoder for 9 (10012)The output will be 1 if andonly if the input is 10012Address decoder for 5 (01012)The output will be 1 if andonly if the input is 01012Address Decoders
  21. 21. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 20HANELDIGITALPRIMERLogic DesignUsing Gates(cont’)Flip-flopsFlip-flops are frequently used to store dataDigital Design, Mano
  22. 22. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 21HANELINSIDE THECOMPUTERImportantTerminologyThe unit of data sizeBit : a binary digit that can have the value0 or 1Byte : 8 bitsNibble : half of a bye, or 4 bitsWord : two bytes, or 16 bitsThe terms used to describe amounts ofmemory in IBM PCs and compatiblesKilobyte (K): 210 bytesMegabyte (M) : 220 bytes, over 1 millionGigabyte (G) : 230 bytes, over 1 billionTerabyte (T) : 240 bytes, over 1 trillion
  23. 23. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 22HANELINSIDE THECOMPUTERInternalOrganization ofComputersCPU (Central Processing Unit)Execute information stored in memoryI/O (Input/output) devicesProvide a means of communicating withCPUMemoryRAM (Random Access Memory) –temporary storage of programs thatcomputer is runningThe data is lost when computer is offROM (Read Only Memory) – containsprograms and information essential tooperation of the computerThe information cannot be changed by use,and is not lost when power is off– It is called nonvolatile memory
  24. 24. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 23HANELINSIDE THECOMPUTERInternalOrganization ofComputers(cont’) CPUMemory(RAM, ROM)Peripherals(monitor,printer, etc.)Address busData bus
  25. 25. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 24HANELINSIDE THECOMPUTERInternalOrganization ofComputers(cont’)The CPU is connected to memory andI/O through strips of wire called a busCarries information from place to placeAddress busData busControl busCPURead/WriteRAMAddress busData busROM Printer Disk Monitor KeyboardControl bus
  26. 26. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 25HANELINSIDE THECOMPUTERInternalOrganization ofComputers(cont’)Address busFor a device (memory or I/O) to berecognized by the CPU, it must beassigned an addressThe address assigned to a given device mustbe uniqueThe CPU puts the address on the address bus,and the decoding circuitry finds the deviceData busThe CPU either gets data from the deviceor sends data to itControl busProvides read or write signals to thedevice to indicate if the CPU is asking forinformation or sending it information
  27. 27. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 26HANELINSIDE THECOMPUTERMore aboutData BusThe more data buses available, thebetter the CPUThink of data buses as highway lanesMore data buses mean a moreexpensive CPU and computerThe average size of data buses in CPUsvaries between 8 and 64Data buses are bidirectionalTo receive or send dataThe processing power of a computer isrelated to the size of its buses
  28. 28. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 27HANELINSIDE THECOMPUTERMore aboutAddress BusThe more address buses available, thelarger the number of devices that canbe addressedThe number of locations with which aCPU can communicate is always equalto 2x, where x is the address lines,regardless of the size of the data busex. a CPU with 24 address lines and 16data lines can provide a total of 224 or 16Mbytes of addressable memoryEach location can have a maximum of 1byte of data, since all general-purposeCPUs are byte addressableThe address bus is unidirectional
  29. 29. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 28HANELINSIDE THECOMPUTERCPU’s Relationto RAM andROMFor the CPU to process information,the data must be stored in RAM orROM, which are referred to as primarymemoryROM provides information that is fixedand permanentTables or initialization programRAM stores information that is notpermanent and can change with timeVarious versions of OS and applicationpackagesCPU gets information to be processedfirst form RAM (or ROM)if it is not there, then seeks it from a massstorage device, called secondary memory, andtransfers the information to RAM
  30. 30. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 29HANELINSIDE THECOMPUTERInside CPUsRegistersThe CPU uses registers to storeinformation temporarilyValues to be processedAddress of value to be fetched from memoryIn general, the more and bigger theregisters, the better the CPURegisters can be 8-, 16-, 32-, or 64-bitThe disadvantage of more and bigger registersis the increased cost of such a CPU
  31. 31. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 30HANELINSIDE THECOMPUTERInside CPUs(cont’)Flags ALUProgram CounterInstruction RegisterInstruction decoder,timing, and controlRegister ARegister BRegister CRegister DAddressBusControlBusDataBusInternalbuses
  32. 32. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 31HANELINSIDE THECOMPUTERInside CPUs(cont’)ALU (arithmetic/logic unit)Performs arithmetic functions such as add,subtract, multiply, and divide, and logicfunctions such as AND, OR, and NOTProgram counterPoints to the address of the nextinstruction to be executedAs each instruction is executed, the programcounter is incremented to point to the addressof the next instruction to be executedInstruction decoderInterprets the instruction fetched into theCPUA CPU capable of understanding moreinstructions requires more transistors to design
  33. 33. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 32HANELINSIDE THECOMPUTERInternalWorking ofComputersEx. A CPU has registers A, B, C, and D and it has an 8-bitdata bus and a 16-bit address bus. The CPU can accessmemory from addresses 0000 to FFFFHAssume that the code for the CPU to move a value toregister A is B0H and the code for adding a value toregister A is 04HThe action to be performed by the CPU is to put 21H intoregister A, and then add to register A values 42H and 12H...
  34. 34. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 33HANELINSIDE THECOMPUTERInternalWorking ofComputers(cont’)Ex. (cont’)Action Code DataMove value 21H into reg. A B0H 21HAdd value 42H to reg. A 04H 42HAdd value 12H to reg. A 04H 12HMem. addr. Contents of memory address1400 (B0) code for moving a value to register A1401 (21) value to be moved1402 (04) code for adding a value to register A1403 (42) value to be added1404 (04) code for adding a value to register A1405 (12) value to be added1406 (F4) code for halt...
  35. 35. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 34HANELINSIDE THECOMPUTERInternalWorking ofComputers(cont’)Ex. (cont’)The actions performed by CPU are as follows:1. The program counter is set to the value 1400H,indicating the address of the first instruction code tobe executed2.The CPU puts 1400H on address bus and sends itoutThe memory circuitry finds the locationThe CPU activates the READ signal, indicating tomemory that it wants the byte at location 1400HThis causes the contents of memory location1400H, which is B0, to be put on the data bus andbrought into the CPU...以動畫表示
  36. 36. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 35HANELINSIDE THECOMPUTERInternalWorking ofComputers(cont’)Ex. (cont’)3.The CPU decodes the instruction B0The CPU commands its controller circuitry to bringinto register A of the CPU the byte in the nextmemory locationThe value 21H goes into register AThe program counter points to the address of thenext instruction to be executed, which is 1402HAddress 1402 is sent out on the address bus tofetch the next instruction...
  37. 37. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 36HANELINSIDE THECOMPUTERInternalWorking ofComputers(cont’)Ex. (cont’)4.From memory location 1402H it fetches code 04HAfter decoding, the CPU knows that it must add tothe contents of register A the byte sitting at thenext address (1403)After the CPU brings the value (42H), it providesthe contents of register A along with this value tothe ALU to perform the additionIt then takes the result of the addition from theALU’s output and puts it in register AThe program counter becomes 1404, the addressof the next instruction...
  38. 38. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 37HANELINSIDE THECOMPUTERInternalWorking ofComputers(cont’)Ex. (cont’)5.Address 1404H is put on the address bus and thecode is fetched into the CPU, decoded, andexecutedThis code is again adding a value to register AThe program counter is updated to 1406H6.The contents of address 1406 are fetched in andexecutedThis HALT instruction tells the CPU to stopincrementing the program counter and asking forthe next instruction
  39. 39. Home Automation, Networking, and Entertainment LabDept. of Computer Science and Information EngineeringNational Cheng Kung University, TAIWANChung-Ping Young楊中平8051 MICROCONTROLLERSThe 8051 Microcontroller and EmbeddedSystems: Using Assembly and CMazidi, Mazidi and McKinlay
  40. 40. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 2HANELOUTLINESMicrocontrollers and embeddedprocessorsOverview of the 8051 family
  41. 41. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 3HANELMICRO-CONTROLLERSANDEMBEDDEDPROCESSORSMicrocontrollervs. General-PurposeMicroprocessorGeneral-purpose microprocessorscontainsNo RAMNo ROMNo I/O portsMicrocontroller hasCPU (microprocessor)RAMROMI/O portsTimerADC and other peripherals
  42. 42. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 4HANELMICRO-CONTROLLERSANDEMBEDDEDPROCESSORSMicrocontrollervs. General-PurposeMicroprocessor(cont’)SerialCOMPortTimerI/OROMRAMCPUMicrocontrollerCPURAMAddress busData busROMI/OPortSerialCOMPortTimerGeneral-purposeMicro-Processor
  43. 43. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 5HANELMICRO-CONTROLLERSANDEMBEDDEDPROCESSORSMicrocontrollervs. General-PurposeMicroprocessor(cont’)General-purpose microprocessorsMust add RAM, ROM, I/O ports, andtimers externally to make them functionalMake the system bulkier and much moreexpensiveHave the advantage of versatility on theamount of RAM, ROM, and I/O portsMicrocontrollerThe fixed amount of on-chip ROM, RAM,and number of I/O ports makes them idealfor many applications in which cost andspace are criticalIn many applications, the space it takes,the power it consumes, and the price perunit are much more critical considerationsthan the computing power
  44. 44. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 6HANELMICRO-CONTROLLERSANDEMBEDDEDPROCESSORSMicrocontrollersfor EmbeddedSystemsAn embedded product uses amicroprocessor (or microcontroller) todo one task and one task onlyThere is only one application software thatis typically burned into ROMA PC, in contrast with the embeddedsystem, can be used for any number ofapplicationsIt has RAM memory and an operatingsystem that loads a variety of applicationsinto RAM and lets the CPU run themA PC contains or is connected to variousembedded productsEach one peripheral has a microcontroller insideit that performs only one task
  45. 45. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 7HANELMICRO-CONTROLLERSANDEMBEDDEDPROCESSORSMicrocontrollersfor EmbeddedSystems(cont’)HomeAppliances, intercom, telephones, security systems,garage door openers, answering machines, faxmachines, home computers, TVs, cable TV tuner,VCR, camcorder, remote controls, video games,cellular phones, musical instruments, sewingmachines, lighting control, paging, camera, pinballmachines, toys, exercise equipmentOfficeTelephones, computers, security systems, faxmachines, microwave, copier, laser printer, colorprinter, pagingAutoTrip computer, engine control, air bag, ABS,instrumentation, security system, transmissioncontrol, entertainment, climate control, cellularphone, keyless entry
  46. 46. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 8HANELMICRO-CONTROLLERSANDEMBEDDEDPROCESSORSx86 PCEmbeddedApplicationsMany manufactures of general-purposemicroprocessors have targeted theirmicroprocessor for the high end of theembedded marketThere are times that a microcontroller isinadequate for the taskWhen a company targets a general-purpose microprocessor for theembedded market, it optimizes theprocessor used for embedded systemsVery often the terms embeddedprocessor and microcontroller are usedinterchangeably
  47. 47. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 9HANELMICRO-CONTROLLERSANDEMBEDDEDPROCESSORSx86 PCEmbeddedApplications(cont’)One of the most critical needs of anembedded system is to decreasepower consumption and spaceIn high-performance embeddedprocessors, the trend is to integratemore functions on the CPU chip and letdesigner decide which features he/shewants to useIn many cases using x86 PCs for thehigh-end embedded applicationsSaves money and shortens developmenttimeA vast library of software already writtenWindows is a widely used and well understoodplatform
  48. 48. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 10HANELMICRO-CONTROLLERSANDEMBEDDEDPROCESSORSChoosing aMicrocontroller8-bit microcontrollersMotorola’s 6811Intel’s 8051Zilog’s Z8Microchip’s PICThere are also 16-bit and 32-bitmicrocontrollers made by various chipmakers
  49. 49. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 11HANELMICRO-CONTROLLERSANDEMBEDDEDPROCESSORSCriteria forChoosing aMicrocontrollerMeeting the computing needs of thetask at hand efficiently and costeffectivelySpeedPackagingPower consumptionThe amount of RAM and ROM on chipThe number of I/O pins and the timer onchipHow easy to upgrade to higher-performance or lower power-consumptionversionsCost per unit
  50. 50. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 12HANELMICRO-CONTROLLERSANDEMBEDDEDPROCESSORSCriteria forChoosing aMicrocontroller(cont’)Availability of software developmenttools, such as compilers, assemblers,and debuggersWide availability and reliable sourcesof the microcontrollerThe 8051 family has the largest number ofdiversified (multiple source) suppliersIntel (original)AtmelPhilips/SigneticsAMDInfineon (formerly Siemens)MatraDallas Semiconductor/Maxim
  51. 51. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 13HANELOVERVIEW OF8051 FAMILY8051MicrocontrollerIntel introduced 8051, referred as MCS-51, in 1981The 8051 is an 8-bit processorThe CPU can work on only 8 bits of data at atimeThe 8051 had128 bytes of RAM4K bytes of on-chip ROMTwo timersOne serial portFour I/O ports, each 8 bits wide6 interrupt sourcesThe 8051 became widely popular afterallowing other manufactures to makeand market any flavor of the 8051, butremaining code-compatible
  52. 52. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 14HANELOVERVIEW OF8051 FAMILY8051Microcontroller(cont’)InterruptControlBusControlCPUOSC I/OPortsSerialPortEtc.Timer 0Timer 1On-chipRAMOn-chipROMfor codeP0 P1 P2 P3Address/DataTXD RXDCounterInputsExternalInterrupts
  53. 53. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 15HANELOVERVIEW OF8051 FAMILY8051 FamilyThe 8051 is a subset of the 8052The 8031 is a ROM-less 8051Add external ROM to itYou lose two ports, and leave only 2 portsfor I/O operations686Interrupt sources111Serial port323232I/O pins232Timers128256128RAM (bytes)0K8K4KROM (on-chip programspace in bytes)803180528051Feature
  54. 54. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 16HANELOVERVIEW OF8051 FAMILYVarious 8051Microcontrollers8751 microcontrollerUV-EPROMPROM burnerUV-EPROM eraser takes 20 min to eraseAT89C51 from Atmel CorporationFlash (erase before write)ROM burner that supports flashA separate eraser is not neededDS89C4x0 from Dallas Semiconductor,now part of Maxim Corp.FlashComes with on-chip loader, loading program toon-chip flash via PC COM port
  55. 55. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 17HANELOVERVIEW OF8051 FAMILYVarious 8051Microcontrollers(cont’)DS5000 from Dallas SemiconductorNV-RAM (changed one byte at a time),RTC (real-time clock)Also comes with on-chip loaderOTP (one-time-programmable) versionof 80518051 family from PhilipsADC, DAC, extended I/O, and both OTPand flash
  56. 56. Home Automation, Networking, and Entertainment LabDept. of Computer Science and Information EngineeringNational Cheng Kung University, TAIWANChung-Ping Young楊中平8051 ASSEMBLYLANGUAGEPROGRAMMINGThe 8051 Microcontroller and EmbeddedSystems: Using Assembly and CMazidi, Mazidi and McKinlay
  57. 57. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 2HANELINSIDE THE8051RegistersRegister are used to store informationtemporarily, while the informationcould bea byte of data to be processed, oran address pointing to the data to befetchedThe vast majority of 8051 register are8-bit registersThere is only one data type, 8 bits
  58. 58. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 3HANELINSIDE THE8051Registers(cont’)The 8 bits of a register are shown fromMSB D7 to the LSB D0With an 8-bit data type, any data largerthan 8 bits must be broken into 8-bitchunks before it is processedD0D1D2D3D4D5D6D78 bit Registersmostsignificant bitleastsignificant bit
  59. 59. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 4HANELINSIDE THE8051Registers(cont’)The most widely used registersA (Accumulator)For all arithmetic and logic instructionsB, R0, R1, R2, R3, R4, R5, R6, R7DPTR (data pointer), and PC (programcounter)R6R5R4R3R2R1R0BAR7DPTRPC PC (Program counter)DPH DPL
  60. 60. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 5HANELINSIDE THE8051MOVInstructionMOV destination, source ;copy source to dest.The instruction tells the CPU to move (in reality,COPY) the source operand to the destinationoperandMOV A,#55H ;load value 55H into reg. AMOV R0,A ;copy contents of A into R0;(now A=R0=55H)MOV R1,A ;copy contents of A into R1;(now A=R0=R1=55H)MOV R2,A ;copy contents of A into R2;(now A=R0=R1=R2=55H)MOV R3,#95H ;load value 95H into R3;(now R3=95H)MOV A,R3 ;copy contents of R3 into A;now A=R3=95H“#” signifies that it is a value
  61. 61. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 6HANELINSIDE THE8051MOVInstruction(cont’)Notes on programmingValue (proceeded with #) can be loadeddirectly to registers A, B, or R0 – R7MOV A, #23HMOV R5, #0F9HIf values 0 to F moved into an 8-bitregister, the rest of the bits are assumedall zeros“MOV A, #5”, the result will be A=05; i.e., A= 00000101 in binaryMoving a value that is too large into aregister will cause an errorMOV A, #7F2H ; ILLEGAL: 7F2H>8 bits (FFH)If it’s not preceded with #,it means to load from amemory locationAdd a 0 to indicate thatF is a hex number andnot a letter
  62. 62. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 7HANELINSIDE THE8051ADDInstructionADD A, source ;ADD the source operand;to the accumulatorThe ADD instruction tells the CPU to add the sourcebyte to register A and put the result in register ASource operand can be either a register orimmediate data, but the destination must alwaysbe register A“ADD R4, A” and “ADD R2, #12H” are invalidsince A must be the destination of any arithmeticoperationMOV A, #25H ;load 25H into AMOV R2, #34H ;load 34H into R2ADD A, R2 ;add R2 to Accumulator;(A = A + R2)MOV A, #25H ;load one operand;into A (A=25H)ADD A, #34H ;add the second;operand 34H to AThere are alwaysmany ways to writethe same program,depending on theregisters used
  63. 63. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 8HANELStructure ofAssemblyLanguageIn the early days of the computer,programmers coded in machine language,consisting of 0s and 1sTedious, slow and prone to errorAssembly languages, which providedmnemonics for the machine code instructions,plus other features, were developedAn Assembly language program consist of a seriesof lines of Assembly language instructionsAssembly language is referred to as a low-level languageIt deals directly with the internal structure of theCPU8051ASSEMBLYPROGRAMMING
  64. 64. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 9HANELStructure ofAssemblyLanguage8051ASSEMBLYPROGRAMMINGAssembly language instruction includesa mnemonic (abbreviation easy to remember)the commands to the CPU, telling it what thoseto do with those itemsoptionally followed by one or two operandsthe data items being manipulatedA given Assembly language program isa series of statements, or linesAssembly language instructionsTell the CPU what to doDirectives (or pseudo-instructions)Give directions to the assembler
  65. 65. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 10HANELStructure ofAssemblyLanguageORG 0H ;start(origin) at location0MOV R5, #25H ;load 25H into R5MOV R7, #34H ;load 34H into R7MOV A, #0 ;load 0 into AADD A, R5 ;add contents of R5 to A;now A = A + R5ADD A, R7 ;add contents of R7 to A;now A = A + R7ADD A, #12H ;add to A value 12H;now A = A + 12HHERE: SJMP HERE ;stay in this loopEND ;end of asm source file8051ASSEMBLYPROGRAMMINGAn Assembly language instructionconsists of four fields:[label:] Mnemonic [operands] [;comment]MnemonicsproduceopcodesThe label field allowsthe program to refer to aline of code by nameComments may be at the end of aline or on a line by themselvesThe assembler ignores commentsDirectives do notgenerate any machinecode and are usedonly by the assembler
  66. 66. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 11HANELASSEMBLINGAND RUNNINGAN 8051PROGRAMThe step of Assembly languageprogram are outlines as follows:1) First we use an editor to type a program,many excellent editors or wordprocessors are available that can be usedto create and/or edit the programNotice that the editor must be able to producean ASCII fileFor many assemblers, the file names followthe usual DOS conventions, but the source filehas the extension “asm“ or “src”, dependingon which assembly you are using
  67. 67. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 12HANELASSEMBLINGAND RUNNINGAN 8051PROGRAM(cont’)2) The “asm” source file containing theprogram code created in step 1 is fed toan 8051 assemblerThe assembler converts the instructions intomachine codeThe assembler will produce an object file anda list fileThe extension for the object file is “obj” whilethe extension for the list file is “lst”3) Assembler require a third step calledlinkingThe linker program takes one or more objectcode files and produce an absolute object filewith the extension “abs”This abs file is used by 8051 trainers thathave a monitor program
  68. 68. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 13HANELASSEMBLINGAND RUNNINGAN 8051PROGRAM(cont’)4) Next the “abs” file is fed into a programcalled “OH” (object to hex converter)which creates a file with extension “hex”that is ready to burn into ROMThis program comes with all 8051 assemblersRecent Windows-based assemblers combinestep 2 through 4 into one step
  69. 69. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 14HANELASSEMBLINGAND RUNNINGAN 8051PROGRAMSteps to Createa ProgramEDITORPROGRAMASSEMBLERPROGRAMLINKERPROGRAMOHPROGRAMmyfile.asmmyfile.objmyfile.absmyfile.lstOther obj filesmyfile.hex
  70. 70. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 15HANELASSEMBLINGAND RUNNINGAN 8051PROGRAMlst FileThe lst (list) file, which is optional, isvery useful to the programmerIt lists all the opcodes and addresses aswell as errors that the assembler detectedThe programmer uses the lst file to findthe syntax errors or debug1 0000 ORG 0H ;start (origin) at 02 0000 7D25 MOV R5,#25H ;load 25H into R53 0002 7F34 MOV R7,#34H ;load 34H into R74 0004 7400 MOV A,#0 ;load 0 into A5 0006 2D ADD A,R5 ;add contents of R5 to A;now A = A + R56 0007 2F ADD A,R7 ;add contents of R7 to A;now A = A + R77 0008 2412 ADD A,#12H ;add to A value 12H;now A = A + 12H8 000A 80EF HERE: SJMP HERE;stay in this loop9 000C END ;end of asm source fileaddress
  71. 71. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 16HANELPROGRAMCOUNTER ANDROM SPACEProgramCounterThe program counter points to theaddress of the next instruction to beexecutedAs the CPU fetches the opcode from theprogram ROM, the program counter isincreasing to point to the next instructionThe program counter is 16 bits wideThis means that it can access programaddresses 0000 to FFFFH, a total of 64Kbytes of code
  72. 72. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 17HANELPROGRAMCOUNTER ANDROM SPACEPower upAll 8051 members start at memoryaddress 0000 when they’re poweredupProgram Counter has the value of 0000The first opcode is burned into ROMaddress 0000H, since this is where the8051 looks for the first instruction when itis bootedWe achieve this by the ORG statement inthe source program
  73. 73. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 18HANELPROGRAMCOUNTER ANDROM SPACEPlacing Code inROMExamine the list file and how the codeis placed in ROM1 0000 ORG 0H ;start (origin) at 02 0000 7D25 MOV R5,#25H ;load 25H into R53 0002 7F34 MOV R7,#34H ;load 34H into R74 0004 7400 MOV A,#0 ;load 0 into A5 0006 2D ADD A,R5 ;add contents of R5 to A;now A = A + R56 0007 2F ADD A,R7 ;add contents of R7 to A;now A = A + R77 0008 2412 ADD A,#12H ;add to A value 12H;now A = A + 12H8 000A 80EF HERE: SJMP HERE ;stay in this loop9 000C END ;end of asm source fileHERE: SJMP HERE80EF000AADD A, #12H24120008ADD A, R72F0007ADD A, R52D0006MOV A, #074000004MOV R7, #34H7F340002MOV R5, #25H7D250000Assembly LanguageMachine LanguageROM Address
  74. 74. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 19HANELPROGRAMCOUNTER ANDROM SPACEPlacing Code inROM(cont’)After the program is burned into ROM,the opcode and operand are placed inROM memory location starting at 0000FE000B80000A1200092400082F00072D00060000057400043400037F00022500017D0000CodeAddressROM contents
  75. 75. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 20HANELPROGRAMCOUNTER ANDROM SPACEExecutingProgramA step-by-step description of theaction of the 8051 upon applyingpower on it1. When 8051 is powered up, the PC has0000 and starts to fetch the first opcodefrom location 0000 of program ROMUpon executing the opcode 7D, the CPUfetches the value 25 and places it in R5Now one instruction is finished, and then thePC is incremented to point to 0002, containingopcode 7F2. Upon executing the opcode 7F, the value34H is moved into R7The PC is incremented to 0004
  76. 76. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 21HANELPROGRAMCOUNTER ANDROM SPACEExecutingProgram(cont’)(cont’)3. The instruction at location 0004 isexecuted and now PC = 00064. After the execution of the 1-byteinstruction at location 0006, PC = 00075. Upon execution of this 1-byte instructionat 0007, PC is incremented to 0008This process goes on until all the instructionsare fetched and executedThe fact that program counter points at thenext instruction to be executed explains somemicroprocessors call it the instruction pointer
  77. 77. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 22HANELPROGRAMCOUNTER ANDROM SPACEROM MemoryMap in 8051FamilyNo member of 8051 family can accessmore than 64K bytes of opcodeThe program counter is a 16-bit registerByte Byte Byte00000FFF0000 00003FFF7FFF8751AT89C51DS89C420/30DS5000-32
  78. 78. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 23HANEL8051 DATATYPES ANDDIRECTIVESData Type8051 microcontroller has only one datatype - 8 bitsThe size of each register is also 8 bitsIt is the job of the programmer to breakdown data larger than 8 bits (00 to FFH,or 0 to 255 in decimal)The data types can be positive or negative
  79. 79. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 24HANEL8051 DATATYPES ANDDIRECTIVESAssemblerDirectivesThe DB directive is the most widelyused data directive in the assemblerIt is used to define the 8-bit dataWhen DB is used to define data, thenumbers can be in decimal, binary, hex,ASCII formatsORG 500HDATA1: DB 28 ;DECIMAL (1C in Hex)DATA2: DB 00110101B ;BINARY (35 in Hex)DATA3: DB 39H ;HEXORG 510HDATA4: DB “2591” ;ASCII NUMBERSORG 518HDATA6: DB “My name is Joe”;ASCII CHARACTERSThe “D” after the decimalnumber is optional, but using“B” (binary) and “H”(hexadecimal) for the others isrequiredThe Assembler willconvert the numbersinto hexPlace ASCII in quotation marksThe Assembler will assign ASCIIcode for the numbers or charactersDefine ASCII strings largerthan two characters
  80. 80. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 25HANEL8051 DATATYPES ANDDIRECTIVESAssemblerDirectives(cont’)ORG (origin)The ORG directive is used to indicate thebeginning of the addressThe number that comes after ORG can beeither in hex and decimalIf the number is not followed by H, it is decimaland the assembler will convert it to hexENDThis indicates to the assembler the end ofthe source (asm) fileThe END directive is the last line of an8051 programMean that in the code anything after the ENDdirective is ignored by the assembler
  81. 81. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 26HANEL8051 DATATYPES ANDDIRECTIVESAssemblerdirectives(cont’)EQU (equate)This is used to define a constant withoutoccupying a memory locationThe EQU directive does not set asidestorage for a data item but associates aconstant value with a data labelWhen the label appears in the program, itsconstant value will be substituted for the label
  82. 82. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 27HANEL8051 DATATYPES ANDDIRECTIVESAssemblerdirectives(cont’)EQU (equate) (cont’)Assume that there is a constant used inmany different places in the program, andthe programmer wants to change its valuethroughoutBy the use of EQU, one can change it once andthe assembler will change all of its occurrencesCOUNT EQU 25... ....MOV R3, #COUNTUse EQU for thecounter constantThe constant is used toload the R3 register
  83. 83. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 28HANELFLAG BITS ANDPSW REGISTERProgram StatusWordThe program status word (PSW)register, also referred to as the flagregister, is an 8 bit registerOnly 6 bits are usedThese four are CY (carry), AC (auxiliary carry), P(parity), and OV (overflow)– They are called conditional flags, meaningthat they indicate some conditions thatresulted after an instruction was executedThe PSW3 and PSW4 are designed as RS0 andRS1, and are used to change the bankThe two unused bits are user-definable
  84. 84. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 29HANELFLAG BITS ANDPSW REGISTERProgram StatusWord (cont’)P--OVRS0RS1F0ACCYCY PSW.7 Carry flag.AC PSW.6 Auxiliary carry flag.-- PSW.5 Available to the user for general purposeRS1 PSW.4 Register Bank selector bit 1.RS0 PSW.3 Register Bank selector bit 0.OV PSW.2 Overflow flag.-- PSW.1 User definable bit.P PSW.0 Parity flag. Set/cleared by hardware eachinstruction cycle to indicate an odd/evennumber of 1 bits in the accumulator.18H – 1FH31110H – 17H20108H – 0FH11000H – 07H000AddressRegister BankRS0RS1Carry out from the d7 bitA carry from D3 to D4Reflect the number of 1sin register AThe result ofsigned numberoperation is toolarge, causingthe high-orderbit to overflowinto the sign bit
  85. 85. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 30HANELFLAG BITS ANDPSW REGISTERADDInstruction AndPSWXCJNEXMOV C, bitXORL C, /bitXORL C, bitXANL C, /bitXANL C, bitXCPL C0CLR C1SETB CXPLCXRPCXDAX0DIVX0MULXXXSUBBXXXADDCXXXADDACOVCYInstructionInstructions that affect flag bits
  86. 86. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 31HANELFLAG BITS ANDPSW REGISTERADDInstruction AndPSW(cont’)Example 2-2Show the status of the CY, AC and P flag after the addition of 38Hand 2FH in the following instructions.MOV A, #38HADD A, #2FH ;after the addition A=67H, CY=0Solution:38 00111000+ 2F 0010111167 01100111CY = 0 since there is no carry beyond the D7 bitAC = 1 since there is a carry from the D3 to the D4 biP = 1 since the accumulator has an odd number of 1s (it has five 1s)The flag bits affected by the ADDinstruction are CY, P, AC, and OV
  87. 87. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 32HANELFLAG BITS ANDPSW REGISTERADDInstruction AndPSW(cont’)Example 2-3Show the status of the CY, AC and P flag after the addition of 9CHand 64H in the following instructions.MOV A, #9CHADD A, #64H ;after the addition A=00H, CY=1Solution:9C 10011100+ 64 01100100100 00000000CY = 1 since there is a carry beyond the D7 bitAC = 1 since there is a carry from the D3 to the D4 biP = 0 since the accumulator has an even number of 1s (it has zero 1s)
  88. 88. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 33HANELFLAG BITS ANDPSW REGISTERADDInstruction AndPSW(cont’)Example 2-4Show the status of the CY, AC and P flag after the addition of 88Hand 93H in the following instructions.MOV A, #88HADD A, #93H ;after the addition A=1BH, CY=1Solution:88 10001000+ 93 1001001111B 00011011CY = 1 since there is a carry beyond the D7 bitAC = 0 since there is no carry from the D3 to the D4 biP = 0 since the accumulator has an even number of 1s (it has four 1s)
  89. 89. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 34HANELREGISTERBANKS ANDSTACKRAM MemorySpaceAllocationThere are 128 bytes of RAM in the8051Assigned addresses 00 to 7FHThe 128 bytes are divided into threedifferent groups as follows:1) A total of 32 bytes from locations 00 to1F hex are set aside for register banksand the stack2) A total of 16 bytes from locations 20H to2FH are set aside for bit-addressableread/write memory3) A total of 80 bytes from locations 30H to7FH are used for read and write storage,called scratch pad
  90. 90. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 35HANEL8051REGISTERBANKS ANDSTACKRAM MemorySpaceAllocation(cont’)Scratch pad RAMBit-Addressable RAMRegister Bank 3Register Bank 2Register Bank 1 (stack)Register Bank 00007080F1017181F202F307FRAM Allocation in 8051
  91. 91. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 36HANEL8051REGISTERBANKS ANDSTACKRegister BanksThese 32 bytes are divided into 4banks of registers in which each bankhas 8 registers, R0-R7RAM location from 0 to 7 are set aside forbank 0 of R0-R7 where R0 is RAM location0, R1 is RAM location 1, R2 is RAMlocation 2, and so on, until memorylocation 7 which belongs to R7 of bank 0It is much easier to refer to these RAMlocations with names such as R0, R1, andso on, than by their memory locationsRegister bank 0 is the default when8051 is powered up
  92. 92. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 37HANEL8051REGISTERBANKS ANDSTACKRegister Banks(cont’)R7R6R5R4R3R2R1R0Bank 0 Bank 1 Bank 2 Bank 376543201FEDCBA891F1E1D1C1B1A18191716151413121011R7R6R5R4R3R2R1R0R7R6R5R4R3R2R1R0R7R6R5R4R3R2R1R0Register banks and their RAM address
  93. 93. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 38HANEL8051REGISTERBANKS ANDSTACKRegister Banks(cont’)We can switch to other banks by useof the PSW registerBits D4 and D3 of the PSW are used toselect the desired register bankUse the bit-addressable instructions SETBand CLR to access PSW.4 and PSW.311Bank 301Bank 210Bank 100Bank 0RS0(PSW.3)RS1(PSW.4)PSW bank selection
  94. 94. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 39HANEL8051REGISTERBANKS ANDSTACKRegister Banks(cont’)Example 2-5MOV R0, #99H ;load R0 with 99HMOV R1, #85H ;load R1 with 85HExample 2-6MOV 00, #99H ;RAM location 00H has 99HMOV 01, #85H ;RAM location 01H has 85HExample 2-7SETB PSW.4 ;select bank 2MOV R0, #99H ;RAM location 10H has 99HMOV R1, #85H ;RAM location 11H has 85H
  95. 95. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 40HANEL8051REGISTERBANKS ANDSTACKStackThe stack is a section of RAM used bythe CPU to store informationtemporarilyThis information could be data or anaddressThe register used to access the stackis called the SP (stack pointer) registerThe stack pointer in the 8051 is only 8 bitwide, which means that it can take valueof 00 to FFHWhen the 8051 is powered up, the SPregister contains value 07RAM location 08 is the first location begin usedfor the stack by the 8051
  96. 96. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 41HANEL8051REGISTERBANKS ANDSTACKStack(cont’)The storing of a CPU register in thestack is called a PUSHSP is pointing to the last used location ofthe stackAs we push data onto the stack, the SP isincremented by oneThis is different from many microprocessorsLoading the contents of the stack backinto a CPU register is called a POPWith every pop, the top byte of the stackis copied to the register specified by theinstruction and the stack pointer isdecremented once
  97. 97. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 42HANEL8051REGISTERBANKS ANDSTACKPushing ontoStackExample 2-8Show the stack and stack pointer from the following. Assume thedefault stack area.MOV R6, #25HMOV R1, #12HMOV R4, #0F3HPUSH 6PUSH 1PUSH 4Solution:2512F3After PUSH 4SP = 0A08090A0BSP = 09SP = 08Start SP = 072508250808120909090A0A0A0B0B0BAfter PUSH 1After PUSH 6
  98. 98. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 43HANEL8051REGISTERBANKS ANDSTACKPopping FromStackExample 2-9Examining the stack, show the contents of the register and SP afterexecution of the following instructions. All value are in hex.POP 3 ; POP stack into R3POP 5 ; POP stack into R5POP 2 ; POP stack into R2Solution:6CAfter POP 2SP = 0808090A0BSP = 09SP = 0AStart SP = 0B6C086C086C087609760976090AF90AF90A0B0B540BAfter POP 5After POP 3Because locations 20-2FH of RAM are reservedfor bit-addressable memory, so we can change theSP to other RAM location by using the instruction“MOV SP, #XX”
  99. 99. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 44HANEL8051REGISTERBANKS ANDSTACKCALLInstruction AndStackThe CPU also uses the stack to savethe address of the instruction justbelow the CALL instructionThis is how the CPU knows where toresume when it returns from the calledsubroutine
  100. 100. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 45HANEL8051REGISTERBANKS ANDSTACKIncrementingStack PointerThe reason of incrementing SP afterpush isMake sure that the stack is growingtoward RAM location 7FH, from lower toupper addressesEnsure that the stack will not reach thebottom of RAM and consequently run outof stack spaceIf the stack pointer were decrementedafter pushWe would be using RAM locations 7, 6, 5, etc.which belong to R7 to R0 of bank 0, the defaultregister bank
  101. 101. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 46HANEL8051REGISTERBANKS ANDSTACKStack and Bank1 ConflictWhen 8051 is powered up, registerbank 1 and the stack are using thesame memory spaceWe can reallocate another section of RAMto the stack
  102. 102. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 47HANEL8051REGISTERBANKS ANDSTACKStack And Bank1 Conflict(cont’)Example 2-10Examining the stack, show the contents of the register and SP afterexecution of the following instructions. All value are in hex.MOV SP, #5FH ;make RAM location 60H;first stack locationMOV R2, #25HMOV R1, #12HMOV R4, #0F3HPUSH 2PUSH 1PUSH 4Solution:2512F3After PUSH 4SP = 6260616263SP = 61SP = 60Start SP = 5F256025606012616161626262636363After PUSH 1After PUSH 2
  103. 103. Home Automation, Networking, and Entertainment LabDept. of Computer Science and Information EngineeringNational Cheng Kung University, TAIWANChung-Ping Young楊中平JUMP, LOOP AND CALLINSTRUCTIONSThe 8051 Microcontroller and EmbeddedSystems: Using Assembly and CMazidi, Mazidi and McKinlay
  104. 104. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 2HANELLOOP ANDJUMPINSTRUCTIONSLoopingRepeating a sequence of instructions acertain number of times is called aloopLoop action is performed byDJNZ reg, LabelThe register is decrementedIf it is not zero, it jumps to the target addressreferred to by the labelPrior to the start of loop the register is loadedwith the counter for the number of repetitionsCounter can be R0 – R7 or RAM location;This program adds value 3 to the ACC ten timesMOV A,#0 ;A=0, clear ACCMOV R2,#10 ;load counter R2=10AGAIN: ADD A,#03 ;add 03 to ACCDJNZ R2,AGAIN ;repeat until R2=0,10 timesMOV R5,A ;save A in R5A loop can be repeated amaximum of 255 times, ifR2 is FFH
  105. 105. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 3HANELLOOP ANDJUMPINSTRUCTIONSNested LoopIf we want to repeat an action moretimes than 256, we use a loop inside aloop, which is called nested loopWe use multiple registers to hold thecountWrite a program to (a) load the accumulator with the value 55H, and(b) complement the ACC 700 timesMOV A,#55H ;A=55HMOV R3,#10 ;R3=10, outer loop countNEXT: MOV R2,#70 ;R2=70, inner loop countAGAIN: CPL A ;complement A registerDJNZ R2,AGAIN ;repeat it 70 timesDJNZ R3,NEXT
  106. 106. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 4HANELLOOP ANDJUMPINSTRUCTIONSConditionalJumpsMOV A,R0 ;A=R0JZ OVER ;jump if A = 0MOV A,R1 ;A=R1JZ OVER ;jump if A = 0...OVER:Jump only if a certain condition is metJZ label ;jump if A=0Determine if R5 contains the value 0. If so, put 55H in it.MOV A,R5 ;copy R5 to AJNZ NEXT ;jump if A is not zeroMOV R5,#55HNEXT: ...Can be used only for register A,not any other register
  107. 107. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 5HANELLOOP ANDJUMPINSTRUCTIONSConditionalJumps(cont’)(cont’)JNC label ;jump if no carry, CY=0If CY = 0, the CPU starts to fetch and executeinstruction from the address of the labelIf CY = 1, it will not jump but will execute the nextinstruction below JNCFind the sum of the values 79H, F5H, E2H. Put the sum in registersR0 (low byte) and R5 (high byte).MOV A,#0 ;A=0MOV R5,A ;clear R5ADD A,#79H ;A=0+79H=79H; JNC N_1 ;if CY=0, add next number; INC R5 ;if CY=1, increment R5N_1: ADD A,#0F5H ;A=79+F5=6E and CY=1JNC N_2 ;jump if CY=0INC R5 ;if CY=1,increment R5 (R5=1)N_2: ADD A,#0E2H ;A=6E+E2=50 and CY=1JNC OVER ;jump if CY=0INC R5 ;if CY=1, increment 5OVER: MOV R0,A ;now R0=50H, and R5=02MOV R5,#0
  108. 108. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 6HANELLOOP ANDJUMPINSTRUCTIONSConditionalJumps(cont’)All conditional jumps are short jumpsThe address of the target must within-128 to +127 bytes of the contents of PCJump if bit = 1 and clear bitJBCJump if bit = 0JNBJump if bit = 1JBJump if CY = 0JNCJump if CY = 1JCJump if byte ≠ #dataCJNE reg,#dataJump if A ≠ byteCJNE A,byteDecrement and Jump if A ≠ 0DJNZJump if A ≠ 0JNZJump if A = 0JZActionsInstructions8051 conditional jump instructions
  109. 109. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 7HANELLOOP ANDJUMPINSTRUCTIONSUnconditionalJumpsThe unconditional jump is a jump inwhich control is transferredunconditionally to the target locationLJMP (long jump)3-byte instructionFirst byte is the opcodeSecond and third bytes represent the 16-bittarget address– Any memory location from 0000 to FFFFHSJMP (short jump)2-byte instructionFirst byte is the opcodeSecond byte is the relative target address– 00 to FFH (forward +127 and backward-128 bytes from the current PC)
  110. 110. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 8HANELLOOP ANDJUMPINSTRUCTIONSCalculatingShort JumpAddressTo calculate the target address of ashort jump (SJMP, JNC, JZ, DJNZ, etc.)The second byte is added to the PC of theinstruction immediately below the jumpIf the target address is more than -128to +127 bytes from the address belowthe short jump instructionThe assembler will generate an errorstating the jump is out of range
  111. 111. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 9HANELLOOP ANDJUMPINSTRUCTIONSCalculatingShort JumpAddress(cont’)Line PC Opcode Mnemonic Operand01 0000 ORG 000002 0000 7800 MOV R0,#003 0002 7455 MOV A,#55H04 0004 6003 JZ NEXT05 0006 08 INC R006 0007 04 AGAIN: INC A07 0008 04 INC A08 0009 2477 NEXT: ADD A,#77H09 000B 5005 JNC OVER10 000D E4 CLR A11 000E F8 MOV R0,A12 000F F9 MOV R1,A13 0010 FA MOV R2,A14 0011 FB MOV R3,A15 0012 2B OVER: ADD A,R316 0013 50F2 JNC AGAIN17 0015 80FE HERE: SJMP HERE18 0017 END+++
  112. 112. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 10HANELCALLINSTRUCTIONSCall instruction is used to call subroutineSubroutines are often used to perform tasksthat need to be performed frequentlyThis makes a program more structured inaddition to saving memory spaceLCALL (long call)3-byte instructionFirst byte is the opcodeSecond and third bytes are used for address oftarget subroutine– Subroutine is located anywhere within 64Kbyte address spaceACALL (absolute call)2-byte instruction11 bits are used for address within 2K-byte range
  113. 113. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 11HANELCALLINSTRUCTIONSLCALLWhen a subroutine is called, control istransferred to that subroutine, theprocessorSaves on the stack the the address of theinstruction immediately below the LCALLBegins to fetch instructions form the newlocationAfter finishing execution of thesubroutineThe instruction RET transfers control backto the callerEvery subroutine needs RET as the lastinstruction
  114. 114. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 12HANELCALLINSTRUCTIONSLCALL(cont’)ORG 0BACK: MOV A,#55H ;load A with 55HMOV P1,A ;send 55H to port 1LCALL DELAY ;time delayMOV A,#0AAH ;load A with AA (in hex)MOV P1,A ;send AAH to port 1LCALL DELAYSJMP BACK ;keep doing this indefinitely;---------- this is delay subroutine ------------ORG 300H ;put DELAY at address 300HDELAY: MOV R5,#0FFH ;R5=255 (FF in hex), counterAGAIN: DJNZ R5,AGAIN ;stay here until R5 become 0RET ;return to caller (when R5 =0)END ;end of asm fileUpon executing “LCALL DELAY”,the address of instruction below it,“MOV A,#0AAH” is pushed ontostack, and the 8051 starts to executeat 300H.The counter R5 is set toFFH; so loop is repeated255 times.When R5 becomes 0, control falls to theRET which pops the address from the stackinto the PC and resumes executing theinstructions after the CALL.The amount of time delay dependson the frequency of the 8051
  115. 115. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 13HANELCALLINSTRUCTIONSCALLInstruction andStack001 0000 ORG 0002 0000 7455 BACK: MOV A,#55H ;load A with 55H003 0002 F590 MOV P1,A ;send 55H to p1004 0004 120300 LCALL DELAY ;time delay005 0007 74AA MOV A,#0AAH ;load A with AAH006 0009 F590 MOV P1,A ;send AAH to p1007 000B 120300 LCALL DELAY008 000E 80F0 SJMP BACK ;keep doing this009 0010010 0010 ;-------this is the delay subroutine------011 0300 ORG 300H012 0300 DELAY:013 0300 7DFF MOV R5,#0FFH ;R5=255014 0302 DDFE AGAIN: DJNZ R5,AGAIN ;stay here015 0304 22 RET ;return to caller016 0305 END ;end of asm file0708SP = 0900090AStack frame after the first LCALLLow byte goes firstand high byte is last
  116. 116. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 14HANELCALLINSTRUCTIONSUse PUSH/POPin Subroutine01 0000 ORG 002 0000 7455 BACK: MOV A,#55H ;load A with 55H03 0002 F590 MOV P1,A ;send 55H to p104 0004 7C99 MOV R4,#99H05 0006 7D67 MOV R5,#67H06 0008 120300 LCALL DELAY ;time delay07 000B 74AA MOV A,#0AAH ;load A with AA08 000D F590 MOV P1,A ;send AAH to p109 000F 120300 LCALL DELAY10 0012 80EC SJMP BACK ;keeping doingthis11 0014 ;-------this is the delay subroutine------12 0300 ORG 300H13 0300 C004 DELAY: PUSH 4 ;push R414 0302 C005 PUSH 5 ;push R515 0304 7CFF MOV R4,#0FFH;R4=FFH16 0306 7DFF NEXT: MOV R5,#0FFH;R5=FFH17 0308 DDFE AGAIN: DJNZ R5,AGAIN18 030A DCFA DJNZ R4,NEXT19 030C D005 POP 5 ;POP into R520 030E D004 POP 4 ;POP into R421 0310 22 RET ;return to caller22 0311 END ;end of asm fileNormally, thenumber of PUSHand POPinstructions mustalways match in anycalled subroutinePCL0B08PCL0B08PCL0B08PCH0009PCH0009PCH0009R4990AR4990A0AR5670B0B0BAfter PUSH 5After PUSH 4After first LCALL
  117. 117. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 15HANELCALLINSTRUCTIONSCallingSubroutines;MAIN program calling subroutinesORG 0MAIN: LCALL SUBR_1LCALL SUBR_2LCALL SUBR_3HERE: SJMP HERE;-----------end of MAINSUBR_1: ......RET;-----------end of subroutine1SUBR_2: ......RET;-----------end of subroutine2SUBR_3: ......RET;-----------end of subroutine3END ;end of the asm fileIt is common to have onemain program and manysubroutines that are calledfrom the main programThis allows you to makeeach subroutine into aseparate module- Each module can betested separately and thenbrought together withmain program- In a large program, themodule can be assigned todifferent programmers
  118. 118. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 16HANELCALLINSTRUCTIONSACALLThe only difference between ACALLand LCALL isThe target address for LCALL can beanywhere within the 64K byte addressThe target address of ACALL must bewithin a 2K-byte rangeThe use of ACALL instead of LCALLcan save a number of bytes ofprogram ROM space
  119. 119. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 17HANELCALLINSTRUCTIONSACALL(cont’)ORG 0MOV A,#55H ;load A with 55HBACK: MOV P1,A ;send 55H to port 1ACALL DELAY ;time delayCPL A ;complement reg ASJMP BACK ;keep doing this indefinitely...END ;end of asm fileORG 0BACK: MOV A,#55H ;load A with 55HMOV P1,A ;send 55H to port 1LCALL DELAY ;time delayMOV A,#0AAH ;load A with AA (in hex)MOV P1,A ;send AAH to port 1LCALL DELAYSJMP BACK ;keep doing this indefinitely...END ;end of asm fileA rewritten program which is more efficiently
  120. 120. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 18HANELTIME DELAYFOR VARIOUS8051 CHIPSCPU executing an instruction takes acertain number of clock cyclesThese are referred as to as machine cyclesThe length of machine cycle dependson the frequency of the crystaloscillator connected to 8051In original 8051, one machine cyclelasts 12 oscillator periodsFind the period of the machine cycle for 11.0592 MHz crystalfrequencySolution:11.0592/12 = 921.6 kHz;machine cycle is 1/921.6 kHz = 1.085μs
  121. 121. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 19HANELTIME DELAYFOR VARIOUS8051 CHIPS(cont’)For 8051 system of 11.0592 MHz, find how long it takes to executeeach instruction.(a) MOV R3,#55 (b) DEC R3 (c) DJNZ R2 target(d) LJMP (e) SJMP (f) NOP (g) MUL ABSolution:Machine cycles Time to execute(a) 1 1x1.085μs = 1.085μs(b) 1 1x1.085μs = 1.085μs(c) 2 2x1.085μs = 2.17μs(d) 2 2x1.085μs = 2.17μs(e) 2 2x1.085μs = 2.17μs(f) 1 1x1.085μs = 1.085μs(g) 4 4x1.085μs = 4.34μs
  122. 122. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 20HANELTIME DELAYFOR VARIOUS8051 CHIPSDelayCalculationFind the size of the delay in following program, if the crystalfrequency is 11.0592MHz.MOV A,#55HAGAIN: MOV P1,AACALL DELAYCPL ASJMP AGAIN;---time delay-------DELAY: MOV R3,#200HERE: DJNZ R3,HERERETSolution:Machine cycleDELAY: MOV R3,#200 1HERE: DJNZ R3,HERE 2RET 2Therefore, [(200x2)+1+2]x1.085μs = 436.255μs.A simple way to short jumpto itself in order to keep themicrocontroller busyHERE: SJMP HEREWe can use the following:SJMP $
  123. 123. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 21HANELTIME DELAYFOR VARIOUS8051 CHIPSIncreasingDelay UsingNOPFind the size of the delay in following program, if the crystalfrequency is 11.0592MHz.Machine CycleDELAY: MOV R3,#250 1HERE: NOP 1NOP 1NOP 1NOP 1DJNZ R3,HERE 2RET 2Solution:The time delay inside HERE loop is[250(1+1+1+1+2)]x1.085μs = 1627.5μs.Adding the two instructions outside loop wehave 1627.5μs + 3 x 1.085μs = 1630.755μs
  124. 124. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 22HANELTIME DELAYFOR VARIOUS8051 CHIPSLarge DelayUsing NestedLoopFind the size of the delay in following program, if the crystalfrequency is 11.0592MHz.Machine CycleDELAY: MOV R2,#200 1AGAIN: MOV R3,#250 1HERE: NOP 1NOP 1DJNZ R3,HERE 2DJNZ R2,AGAIN 2RET 2Solution:For HERE loop, we have (4x250)x1.085μs=1085μs.For AGAIN loop repeats HERE loop 200 times, sowe have 200x1085μs=217000μs. But “MOVR3,#250” and “DJNZ R2,AGAIN” at the start andend of the AGAIN loop add (3x200x1.805)=651μs.As a result we have 217000+651=217651μs.Notice in nested loop,as in all other timedelay loops, the timeis approximate sincewe have ignored thefirst and lastinstructions in thesubroutine.
  125. 125. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 23HANELTIME DELAYFOR VARIOUS8051 CHIPSDelayCalculation forOther 8051Two factors can affect the accuracy ofthe delayCrystal frequencyThe duration of the clock period of the machinecycle is a function of this crystal frequency8051 designThe original machine cycle duration was set at12 clocksAdvances in both IC technology and CPUdesign in recent years have made the 1-clockmachine cycle a common feature1DS89C420/30/40/50 Dallas Semi4DS5000 Dallas Semi6P89C54X2 Philips12AT89C51 AtmelClocks per Machine CycleChip/MakerClocks per machine cycle for various 8051 versions
  126. 126. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 24HANELTIME DELAYFOR VARIOUS8051 CHIPSDelayCalculation forOther 8051(cont’)Find the period of the machine cycle (MC) for various versions of8051, if XTAL=11.0592 MHz.(a) AT89C51 (b) P89C54X2 (c) DS5000 (d) DS89C4x0Solution:(a) 11.0592MHz/12 = 921.6kHz;MC is 1/921.6kHz = 1.085μs = 1085ns(b) 11.0592MHz/6 = 1.8432MHz;MC is 1/1.8432MHz = 0.5425μs = 542ns(c) 11.0592MHz/4 = 2.7648MHz ;MC is 1/2.7648MHz = 0.36μs = 360ns(d) 11.0592MHz/1 = 11.0592MHz;MC is 1/11.0592MHz = 0.0904μs = 90ns
  127. 127. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 25HANELTIME DELAYFOR VARIOUS8051 CHIPSDelayCalculation forOther 8051(cont’)For an AT8051 and DSC89C4x0 system of 11.0592 MHz, find howlong it takes to execute each instruction.(a) MOV R3,#55 (b) DEC R3 (c) DJNZ R2 target(d) LJMP (e) SJMP (f) NOP (g) MUL ABSolution:AT8051 DS89C4x0(a) 1 1085ns = 1085ns 2 90ns = 180ns(b) 1 1085ns = 1085ns 1 90ns = 90ns(c) 2 1085ns = 2170ns 4 90ns = 360ns(d) 2 1085ns = 2170ns 3 90ns = 270ns(e) 2 1085ns = 2170ns 3 90ns = 270ns(f) 1 1085ns = 1085ns 1 90ns = 90ns(g) 4 1085ns = 4340ns 9 90ns = 810ns11NOP32SJMP32LJMP421180519MUL AB4DJNZ R2 target1DEC R32MOV R3,#55DSC89C4x0Instruction
  128. 128. Home Automation, Networking, and Entertainment LabDept. of Computer Science and Information EngineeringNational Cheng Kung University, TAIWANChung-Ping Young楊中平I/O PORTPROGRAMMINGThe 8051 Microcontroller and EmbeddedSystems: Using Assembly and CMazidi, Mazidi and McKinlay
  129. 129. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 2HANELI/OPROGRAMMING8051(8031)(89420)P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7RST(RXD) P3.0(TXD) P3.1(-INT0) P3.2(-INT1) P3.3(T0) P3.4(T1) P3.5(-WR) P3.6(-RD )P3.7XTAL2XTAL1GNDVccP0.0 (AD0)P0.1 (AD1)P0.2 (AD2)P0.3 (AD3)P0.4 (AD4)P0.5 (AD5)P0.6 (AD6)P0.7 (AD7)-EA/VPPALE/PROG-PSENP2.7 (A15)P2.6 (A14)P2.5 (A13)P2.4 (A12)P2.3 (A11)P2.2 (A10)P2.1 (A9)P2.0 (A8)12345678910111213141516171819204039383736353433323130292827262524232221Provides+5V supplyvoltage tothe chipGrondP1P38051 Pin DiagramA total of 32pins are setaside for thefour ports P0,P1, P2, P3,where eachport takes 8pinsP0P2
  130. 130. Department of Computer Science and Information EngineeringNational Cheng Kung University, TAIWAN 3HANELI/OPROGRAMMINGI/O Port PinsThe four 8-bit I/O ports P0, P1, P2 andP3 each uses 8 pinsAll the ports upon RESET areconfigured as input, ready to be usedas input portsWhen the first 0 is written to a port, itbecomes an outputTo reconfigure it as an input, a 1 must besent to the portTo use any of these ports as an input port, itmust be programmedP1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7RST(RXD)P3.0(TXD