SlideShare une entreprise Scribd logo
1  sur  45
MICROCONTROLLER
MCS-51:
ADVANCE
PROGRAMMING
Arkhom JODTANG
Civil Aviation Training Center
Advance Programming
Contents
 Workshop 1 (Mathematic Processing)
 Workshop 2 (Memory Adjusting)
 Workshop 3 (Shift information)
 Workshop 4 (Memory Filter)
 Workshop 5 (Clock Generator)
2
Workshop 1
 Write program to processing the mathematic below:
 128-bits Additional Program
 First number store in 40h (MSB) to 4Fh (LSB)
 Second number store in 50h (MSB) to 5Fh (LSB)
 Write result in Carry flag and 60h (MSB) to 6Fh (LSB)
 Program limited at 30 Bytes
3
Design
4
Result
5
Workshop 2
 Write program to increase the memory area
address 30h to 4Fh by one
 Program limited at 30 Bytes
6
Design
7
Result
8
Workshop 3
 Write program to Left-shift nibble in every byte
the memory area address 30h to 4Fh
 Program limited at 40 Bytes
9
Design
10
Result
11
Workshop 4
 Write program to suppress the byte which is less
than 7FH in every byte the memory area
address 30h to 4Fh
 Program limited at 40 Bytes
12
Design
13
Result
14
Workshop 5
 Write program to generate clock signal with any
frequency and any Percentage of Duty cycle
 Program limited at 20 Bytes
15
Design
16
Result
17
After this page are using for production
only, please ignore them.
END of SLIDE18
Flowchart Symbols
 Terminator
 The start or end of program flow
 Initial / Preparation
 Setting a value at the beginning of the
process or initialize the routine
 Process
 Any kind of processing function, such as a
variable assignment or mathematical
operation.
 Predefined Process
 A named process, such as a subroutine, a
module, Procedure or Function.
Start
19
Flowchart Symbols
Condition  Decision
 Select flow direction from condition
 Connector
 Jumping destination
 Flow line
connect the flowchart symbols and
show the sequence of operations
during the program execution.
True
False
20
Flowchart Sample
Start
A = 30H
Process
End
MainLoop:
DJNZ A, MainLoop
21
Sample of Branch Instruction
(Unconditional Jump)
ORG 0H
MOV R1,#40H
Loop:
MOV @R1,#22H
INC R1
JMP Loop
END
22
Sample of Branch Instruction
(Conditional Jump)
ORG 0H
MOV R1,#40H
Loop:
MOV @R1,#11H
INC R1
CJNE R1, #50H, Loop
END
23
SJMP rel.
 Jump to specified relative address
 -128 to +127 locations (Short Jump)
 No condition.
 Sample
 SJMP NO_Task
 Jump to label name is No_Task
24
AJMP adr11
 Jump to any specific location
 Long distance. (211 = 2kByte long)
 No condition.
 Sample
 AJMP Loop3
 Jump to label name is Loop3
25
LJMP adr16
 Jump to any specific location
 Long distance. (216 = 64kByte long)
 No condition.
 3 Bytes instruction
 4 Machine cycles
 Sample
 LJMP Program5
 Jump to label name is Program5
26
JC rel
 Condition: Jump if carry bit is set
 Jump to specific destination
 Short Jump
 3 Machine cycles
 Sample
 JC Store_It
 If Carry bit = Set, Jump to label “Store_It”
27
JNC rel
 Condition: Jump if carry bit is clear
 Jump to specific destination
 Short Jump
 3 Machine cycles
 Sample
 JNC EasyTask
 If Carry = 0, Jump to EasyTask
28
JNC Sample
 Example 3: Program to make summation of Timer0 and Timer1 registers.
Store the result in R0 (Highest Byte), R1 and R2 (Lowest Byte).
29
 To assign value of
Carry Flag to R0
ORG 00H
MOV R0, #00H
JNC CarryIsZero
MOV R0,#01H
CarryIsZero:
END
Timer0
Timer1
+
TL0TH0
R1 R2R0
Bit
30
 Any bit in memory
 Carry
 Acc.0
 PSW.4
 20h.0
 00h
 7Fh
 P3.3
Addres
s
.7 .6 .5 .4 .3 .2 .1 .0 Name
19h
20h 07 06 05 04 03 02 01 00
21h 0F 0E 0D 0C 0B 0A 09 08
2Fh 7F 7E 7D 7C 7B 7A 79 78
JB bit, rel
 Condition: Jump if addressed bit is set
 Jump to specific destination
 Short Jump
 4 Machine cycles
 Sample
 JB 00h, EasyTask
 If bit address 00h is set, Jump to label EasyTask:
 JB P0.4, PressedS4
 If bit P0.4 = set. Jump to label PressedS4
31
JNB bit, rel
 Condition: Jump if addressed bit is clear
 Jump to specific destination
 Short Jump
 4 Machine cycles
 Sample
 JNB 00h, EasyTask
 If bit address 00h is clear, Jump to label EasyTask:
32
JBC bit, rel
 Condition: Jump if addressed bit is set
 Clear bit
 Jump to specific destination
 Short Jump
 4 Machine cycles
 Sample
 JBC 00h, EasyTask
 If bit address 00h is set, jump to label EasyTask:, Clear bit
00h
 JBC PSW.4, EasyTask
 If bit address PSW.4 is set, jump to label EasyTask:, Clear
bit PSW.4
33
JZ rel
 Condition: Jump if Acc equal to zero
 Jump to specific destination
 Short Jump
 3 Machine cycles
 Sample
 JZ EmptyNow
 If ACC = 0, Jump to label EmptyNow:
34
JNZ rel
 Condition: Jump if Acc not equal zero
 Jump to specific destination
 Short Jump
 3 Machine cycles
 Sample
 JNZ SomeValue
 If ACC > 0, Jump to label Somevalue:
35
CJNE A, Rx, rel
 Condition: Jump if Acc not equal to Rx
 Jump to specific destination
 Short Jump
 4 Machine cycles
 Effect to carry flag
 Sample
 CJNE A, 30h, Loop2
 If ACC ≠ 30h, Jump to label Loop2:
36
CJNE A, #X, rel
 Condition: Jump if Acc not equal to #X
 Jump to specific destination
 Short Jump
 4 Machine cycles
 Sample
 CJNE A, #3Eh, Loop3
 If ACC ≠ #30h, Jump to label Loop3:
37
CJNE Rn, #X, rel
 Condition: Jump if Rn not equal to #X
 Jump to specific destination
 Short Jump
 4 Machine cycles
 Sample
 CJNE R4, #40h, Loop4
 If R4 ≠ #40h, Jump to label Loop4:
38
CJNE @Ri, #X, rel
 Condition: Jump if register addressed by Ri
not equal to #X
 Jump to specific destination
 Short Jump
 4 Machine cycles
 Sample
 CJNE @R0, #E0h, Loop5
 If register which is addressed by R0 ≠ #E0h, Jump to
label Loop5:
39
CJNE (Homework)
 Write program to fill the memory area address 30h to 6Fh
with Decimal (BCD) counting number start from 1H
 The code must less than 15 line of assembly code
40
CJNE (Sample)
 Write program to fill the memory area
address 30h to 4Fh with counting number
start from 1H
41
CJNE (Sample)
 Write program to
fill the memory
area address 30h
to 4Fh with
counting number
start from 1H
42
DJNZ Rn, rel
 Process: Decrease Rn by one, then
 Condition: Jump if Rn not equal to zero
 Jump to specific destination
 Short Jump
 3 Machine cycles
 Sample
 DJNZ R5, Loop6
 Decrease R5 then check, If R5 ≠ 0, Jump to label
Loop6:
43
DJNZ Rx, rel
 Process: Decrease Rx by one, then
 Condition: Jump if Rx not equal to zero
 Jump to specific destination
 Short Jump
 4 Machine cycles
 Sample
 DJNZ R5, Loop6
 Decrease R5 then check, If R5 ≠ 0, Jump to label
Loop6:
44
DJNZ (Sample)
 ; DJNZ is very convenion for
 ; specified number of turn for
some process.
 ORG 0H
 MOV R5,#10D
 Loop:
 ; Process here
 DJNZ R5, Loop
 END
45
Start
R5 =10D
Process
End
Loop:
DJNZ R5, Loop

Contenu connexe

Tendances

What is to loop in c++
What is to loop in c++What is to loop in c++
What is to loop in c++03446940736
 
Applications of stack
Applications of stackApplications of stack
Applications of stackeShikshak
 
Loop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progamLoop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progamDr. Girish GS
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)IJERD Editor
 
Lec 3 ---- dfa
Lec 3  ---- dfaLec 3  ---- dfa
Lec 3 ---- dfaAbdul Aziz
 
Assembly language programs 2
Assembly language programs 2Assembly language programs 2
Assembly language programs 2HarshitParkar6677
 
Blackfin Loop Asm
Blackfin Loop AsmBlackfin Loop Asm
Blackfin Loop AsmAdithya Rao
 
Control Statements, Array, Pointer, Structures
Control Statements, Array, Pointer, StructuresControl Statements, Array, Pointer, Structures
Control Statements, Array, Pointer, Structuresindra Kishor
 
Finite state Transducers and mealy Machine
Finite state Transducers and mealy Machine Finite state Transducers and mealy Machine
Finite state Transducers and mealy Machine Nadeem Qasmi
 
17435 electronics instrumentation
17435  electronics instrumentation17435  electronics instrumentation
17435 electronics instrumentationsoni_nits
 
Verilog Lecture2 thhts
Verilog Lecture2 thhtsVerilog Lecture2 thhts
Verilog Lecture2 thhtsBéo Tú
 

Tendances (20)

Compiler Design Unit 5
Compiler Design Unit 5Compiler Design Unit 5
Compiler Design Unit 5
 
ARM inst set part 2
ARM inst set part 2ARM inst set part 2
ARM inst set part 2
 
What is to loop in c++
What is to loop in c++What is to loop in c++
What is to loop in c++
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
Loop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progamLoop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progam
 
Loops
LoopsLoops
Loops
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)
 
Loops c++
Loops c++Loops c++
Loops c++
 
Lec 3 ---- dfa
Lec 3  ---- dfaLec 3  ---- dfa
Lec 3 ---- dfa
 
Assembly language programs
Assembly language programsAssembly language programs
Assembly language programs
 
Assembly language programs 2
Assembly language programs 2Assembly language programs 2
Assembly language programs 2
 
Compiler Design Unit 3
Compiler Design Unit 3Compiler Design Unit 3
Compiler Design Unit 3
 
Pda
PdaPda
Pda
 
[ASM]Lab5
[ASM]Lab5[ASM]Lab5
[ASM]Lab5
 
Blackfin Loop Asm
Blackfin Loop AsmBlackfin Loop Asm
Blackfin Loop Asm
 
Control Statements, Array, Pointer, Structures
Control Statements, Array, Pointer, StructuresControl Statements, Array, Pointer, Structures
Control Statements, Array, Pointer, Structures
 
Hd6
Hd6Hd6
Hd6
 
Finite state Transducers and mealy Machine
Finite state Transducers and mealy Machine Finite state Transducers and mealy Machine
Finite state Transducers and mealy Machine
 
17435 electronics instrumentation
17435  electronics instrumentation17435  electronics instrumentation
17435 electronics instrumentation
 
Verilog Lecture2 thhts
Verilog Lecture2 thhtsVerilog Lecture2 thhts
Verilog Lecture2 thhts
 

Similaire à Microprocessor Week 8: Advance programming

1344 Alp Of 8086
1344 Alp Of 80861344 Alp Of 8086
1344 Alp Of 8086techbed
 
B sc e 5.2 mp unit 2 soft ware(alp)
B sc e 5.2 mp unit 2 soft ware(alp)B sc e 5.2 mp unit 2 soft ware(alp)
B sc e 5.2 mp unit 2 soft ware(alp)MahiboobAliMulla
 
Virtual Machine for Regular Expressions
Virtual Machine for Regular ExpressionsVirtual Machine for Regular Expressions
Virtual Machine for Regular ExpressionsAlexander Yakushev
 
Https _doc-0o-c4-apps-viewer.googleusercontent
Https  _doc-0o-c4-apps-viewer.googleusercontent Https  _doc-0o-c4-apps-viewer.googleusercontent
Https _doc-0o-c4-apps-viewer.googleusercontent vijaydeepakg
 
unit2-8085-programminG.pptx
unit2-8085-programminG.pptxunit2-8085-programminG.pptx
unit2-8085-programminG.pptxRajaSekhar533255
 
Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051logesh waran
 
Microprocessor lab
Microprocessor labMicroprocessor lab
Microprocessor labKD030303
 
Microcontroller 8051- soft.ppt
Microcontroller 8051- soft.pptMicrocontroller 8051- soft.ppt
Microcontroller 8051- soft.pptsteffydean
 
instructions of 8085 Microprocessor
instructions of 8085 Microprocessorinstructions of 8085 Microprocessor
instructions of 8085 MicroprocessorPooja mittal
 
instruction-set-of-8086-mr-binu-joy3.ppt
instruction-set-of-8086-mr-binu-joy3.pptinstruction-set-of-8086-mr-binu-joy3.ppt
instruction-set-of-8086-mr-binu-joy3.pptssuser2b759d
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching materialJohn Williams
 
Chapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 InstructionsChapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 Instructionscmkandemir
 

Similaire à Microprocessor Week 8: Advance programming (20)

Chapt 06
Chapt 06Chapt 06
Chapt 06
 
1344 Alp Of 8086
1344 Alp Of 80861344 Alp Of 8086
1344 Alp Of 8086
 
B sc e 5.2 mp unit 2 soft ware(alp)
B sc e 5.2 mp unit 2 soft ware(alp)B sc e 5.2 mp unit 2 soft ware(alp)
B sc e 5.2 mp unit 2 soft ware(alp)
 
OptimizingARM
OptimizingARMOptimizingARM
OptimizingARM
 
Virtual Machine for Regular Expressions
Virtual Machine for Regular ExpressionsVirtual Machine for Regular Expressions
Virtual Machine for Regular Expressions
 
Instruction types
Instruction typesInstruction types
Instruction types
 
Computer Architecture Assignment Help
Computer Architecture Assignment HelpComputer Architecture Assignment Help
Computer Architecture Assignment Help
 
Https _doc-0o-c4-apps-viewer.googleusercontent
Https  _doc-0o-c4-apps-viewer.googleusercontent Https  _doc-0o-c4-apps-viewer.googleusercontent
Https _doc-0o-c4-apps-viewer.googleusercontent
 
unit2-8085-programminG.pptx
unit2-8085-programminG.pptxunit2-8085-programminG.pptx
unit2-8085-programminG.pptx
 
UNIT 2 ERTS.ppt
UNIT 2 ERTS.pptUNIT 2 ERTS.ppt
UNIT 2 ERTS.ppt
 
Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051
 
Microprocessor lab
Microprocessor labMicroprocessor lab
Microprocessor lab
 
Microcontroller 8051- soft.ppt
Microcontroller 8051- soft.pptMicrocontroller 8051- soft.ppt
Microcontroller 8051- soft.ppt
 
instructions of 8085 Microprocessor
instructions of 8085 Microprocessorinstructions of 8085 Microprocessor
instructions of 8085 Microprocessor
 
module-3.pptx
module-3.pptxmodule-3.pptx
module-3.pptx
 
instruction-set-of-8086-mr-binu-joy3.ppt
instruction-set-of-8086-mr-binu-joy3.pptinstruction-set-of-8086-mr-binu-joy3.ppt
instruction-set-of-8086-mr-binu-joy3.ppt
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
 
Chapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 InstructionsChapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 Instructions
 
Arm instruction set
Arm instruction setArm instruction set
Arm instruction set
 

Plus de Arkhom Jodtang

MCS51 Training board Model CATC2016A
MCS51 Training board Model CATC2016AMCS51 Training board Model CATC2016A
MCS51 Training board Model CATC2016AArkhom Jodtang
 
Microprocessor Week 10: Applications
Microprocessor Week 10: ApplicationsMicroprocessor Week 10: Applications
Microprocessor Week 10: ApplicationsArkhom Jodtang
 
Microprocessor Week 9: Timer and Counter
Microprocessor Week 9: Timer and CounterMicroprocessor Week 9: Timer and Counter
Microprocessor Week 9: Timer and CounterArkhom Jodtang
 
Microprocessor Week 8: Subroutine
Microprocessor Week 8: Subroutine Microprocessor Week 8: Subroutine
Microprocessor Week 8: Subroutine Arkhom Jodtang
 
Microprocessor Week2: Data Transfer
Microprocessor Week2: Data TransferMicroprocessor Week2: Data Transfer
Microprocessor Week2: Data TransferArkhom Jodtang
 
Microprocessor Week 2: CH2 Circuit and Operation
Microprocessor Week 2: CH2 Circuit and OperationMicroprocessor Week 2: CH2 Circuit and Operation
Microprocessor Week 2: CH2 Circuit and OperationArkhom Jodtang
 
Microprocessor Week1: Introduction
Microprocessor Week1: IntroductionMicroprocessor Week1: Introduction
Microprocessor Week1: IntroductionArkhom Jodtang
 
Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)
Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)
Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)Arkhom Jodtang
 
Microprocessor Week 4-5 MCS-51 Arithmetic operation
Microprocessor Week 4-5 MCS-51 Arithmetic operationMicroprocessor Week 4-5 MCS-51 Arithmetic operation
Microprocessor Week 4-5 MCS-51 Arithmetic operationArkhom Jodtang
 
Use of Computer & IT, Laboratory MS Word
Use of Computer & IT, Laboratory MS WordUse of Computer & IT, Laboratory MS Word
Use of Computer & IT, Laboratory MS WordArkhom Jodtang
 
Microprocessor Laboratory 2: Logical instructions
Microprocessor Laboratory 2: Logical instructionsMicroprocessor Laboratory 2: Logical instructions
Microprocessor Laboratory 2: Logical instructionsArkhom Jodtang
 
Microprocessor: Delay technique
Microprocessor: Delay techniqueMicroprocessor: Delay technique
Microprocessor: Delay techniqueArkhom Jodtang
 
Distance Measuring Car
Distance Measuring CarDistance Measuring Car
Distance Measuring CarArkhom Jodtang
 
Tamech 2013 Presentation
Tamech 2013 PresentationTamech 2013 Presentation
Tamech 2013 PresentationArkhom Jodtang
 
Electronics & Avionics project
Electronics & Avionics projectElectronics & Avionics project
Electronics & Avionics projectArkhom Jodtang
 

Plus de Arkhom Jodtang (15)

MCS51 Training board Model CATC2016A
MCS51 Training board Model CATC2016AMCS51 Training board Model CATC2016A
MCS51 Training board Model CATC2016A
 
Microprocessor Week 10: Applications
Microprocessor Week 10: ApplicationsMicroprocessor Week 10: Applications
Microprocessor Week 10: Applications
 
Microprocessor Week 9: Timer and Counter
Microprocessor Week 9: Timer and CounterMicroprocessor Week 9: Timer and Counter
Microprocessor Week 9: Timer and Counter
 
Microprocessor Week 8: Subroutine
Microprocessor Week 8: Subroutine Microprocessor Week 8: Subroutine
Microprocessor Week 8: Subroutine
 
Microprocessor Week2: Data Transfer
Microprocessor Week2: Data TransferMicroprocessor Week2: Data Transfer
Microprocessor Week2: Data Transfer
 
Microprocessor Week 2: CH2 Circuit and Operation
Microprocessor Week 2: CH2 Circuit and OperationMicroprocessor Week 2: CH2 Circuit and Operation
Microprocessor Week 2: CH2 Circuit and Operation
 
Microprocessor Week1: Introduction
Microprocessor Week1: IntroductionMicroprocessor Week1: Introduction
Microprocessor Week1: Introduction
 
Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)
Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)
Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)
 
Microprocessor Week 4-5 MCS-51 Arithmetic operation
Microprocessor Week 4-5 MCS-51 Arithmetic operationMicroprocessor Week 4-5 MCS-51 Arithmetic operation
Microprocessor Week 4-5 MCS-51 Arithmetic operation
 
Use of Computer & IT, Laboratory MS Word
Use of Computer & IT, Laboratory MS WordUse of Computer & IT, Laboratory MS Word
Use of Computer & IT, Laboratory MS Word
 
Microprocessor Laboratory 2: Logical instructions
Microprocessor Laboratory 2: Logical instructionsMicroprocessor Laboratory 2: Logical instructions
Microprocessor Laboratory 2: Logical instructions
 
Microprocessor: Delay technique
Microprocessor: Delay techniqueMicroprocessor: Delay technique
Microprocessor: Delay technique
 
Distance Measuring Car
Distance Measuring CarDistance Measuring Car
Distance Measuring Car
 
Tamech 2013 Presentation
Tamech 2013 PresentationTamech 2013 Presentation
Tamech 2013 Presentation
 
Electronics & Avionics project
Electronics & Avionics projectElectronics & Avionics project
Electronics & Avionics project
 

Dernier

Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
The SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsThe SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsDILIPKUMARMONDAL6
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfRajuKanojiya4
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 

Dernier (20)

Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
The SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsThe SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teams
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdf
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 

Microprocessor Week 8: Advance programming

  • 2. Advance Programming Contents  Workshop 1 (Mathematic Processing)  Workshop 2 (Memory Adjusting)  Workshop 3 (Shift information)  Workshop 4 (Memory Filter)  Workshop 5 (Clock Generator) 2
  • 3. Workshop 1  Write program to processing the mathematic below:  128-bits Additional Program  First number store in 40h (MSB) to 4Fh (LSB)  Second number store in 50h (MSB) to 5Fh (LSB)  Write result in Carry flag and 60h (MSB) to 6Fh (LSB)  Program limited at 30 Bytes 3
  • 6. Workshop 2  Write program to increase the memory area address 30h to 4Fh by one  Program limited at 30 Bytes 6
  • 9. Workshop 3  Write program to Left-shift nibble in every byte the memory area address 30h to 4Fh  Program limited at 40 Bytes 9
  • 12. Workshop 4  Write program to suppress the byte which is less than 7FH in every byte the memory area address 30h to 4Fh  Program limited at 40 Bytes 12
  • 15. Workshop 5  Write program to generate clock signal with any frequency and any Percentage of Duty cycle  Program limited at 20 Bytes 15
  • 18. After this page are using for production only, please ignore them. END of SLIDE18
  • 19. Flowchart Symbols  Terminator  The start or end of program flow  Initial / Preparation  Setting a value at the beginning of the process or initialize the routine  Process  Any kind of processing function, such as a variable assignment or mathematical operation.  Predefined Process  A named process, such as a subroutine, a module, Procedure or Function. Start 19
  • 20. Flowchart Symbols Condition  Decision  Select flow direction from condition  Connector  Jumping destination  Flow line connect the flowchart symbols and show the sequence of operations during the program execution. True False 20
  • 21. Flowchart Sample Start A = 30H Process End MainLoop: DJNZ A, MainLoop 21
  • 22. Sample of Branch Instruction (Unconditional Jump) ORG 0H MOV R1,#40H Loop: MOV @R1,#22H INC R1 JMP Loop END 22
  • 23. Sample of Branch Instruction (Conditional Jump) ORG 0H MOV R1,#40H Loop: MOV @R1,#11H INC R1 CJNE R1, #50H, Loop END 23
  • 24. SJMP rel.  Jump to specified relative address  -128 to +127 locations (Short Jump)  No condition.  Sample  SJMP NO_Task  Jump to label name is No_Task 24
  • 25. AJMP adr11  Jump to any specific location  Long distance. (211 = 2kByte long)  No condition.  Sample  AJMP Loop3  Jump to label name is Loop3 25
  • 26. LJMP adr16  Jump to any specific location  Long distance. (216 = 64kByte long)  No condition.  3 Bytes instruction  4 Machine cycles  Sample  LJMP Program5  Jump to label name is Program5 26
  • 27. JC rel  Condition: Jump if carry bit is set  Jump to specific destination  Short Jump  3 Machine cycles  Sample  JC Store_It  If Carry bit = Set, Jump to label “Store_It” 27
  • 28. JNC rel  Condition: Jump if carry bit is clear  Jump to specific destination  Short Jump  3 Machine cycles  Sample  JNC EasyTask  If Carry = 0, Jump to EasyTask 28
  • 29. JNC Sample  Example 3: Program to make summation of Timer0 and Timer1 registers. Store the result in R0 (Highest Byte), R1 and R2 (Lowest Byte). 29  To assign value of Carry Flag to R0 ORG 00H MOV R0, #00H JNC CarryIsZero MOV R0,#01H CarryIsZero: END Timer0 Timer1 + TL0TH0 R1 R2R0
  • 30. Bit 30  Any bit in memory  Carry  Acc.0  PSW.4  20h.0  00h  7Fh  P3.3 Addres s .7 .6 .5 .4 .3 .2 .1 .0 Name 19h 20h 07 06 05 04 03 02 01 00 21h 0F 0E 0D 0C 0B 0A 09 08 2Fh 7F 7E 7D 7C 7B 7A 79 78
  • 31. JB bit, rel  Condition: Jump if addressed bit is set  Jump to specific destination  Short Jump  4 Machine cycles  Sample  JB 00h, EasyTask  If bit address 00h is set, Jump to label EasyTask:  JB P0.4, PressedS4  If bit P0.4 = set. Jump to label PressedS4 31
  • 32. JNB bit, rel  Condition: Jump if addressed bit is clear  Jump to specific destination  Short Jump  4 Machine cycles  Sample  JNB 00h, EasyTask  If bit address 00h is clear, Jump to label EasyTask: 32
  • 33. JBC bit, rel  Condition: Jump if addressed bit is set  Clear bit  Jump to specific destination  Short Jump  4 Machine cycles  Sample  JBC 00h, EasyTask  If bit address 00h is set, jump to label EasyTask:, Clear bit 00h  JBC PSW.4, EasyTask  If bit address PSW.4 is set, jump to label EasyTask:, Clear bit PSW.4 33
  • 34. JZ rel  Condition: Jump if Acc equal to zero  Jump to specific destination  Short Jump  3 Machine cycles  Sample  JZ EmptyNow  If ACC = 0, Jump to label EmptyNow: 34
  • 35. JNZ rel  Condition: Jump if Acc not equal zero  Jump to specific destination  Short Jump  3 Machine cycles  Sample  JNZ SomeValue  If ACC > 0, Jump to label Somevalue: 35
  • 36. CJNE A, Rx, rel  Condition: Jump if Acc not equal to Rx  Jump to specific destination  Short Jump  4 Machine cycles  Effect to carry flag  Sample  CJNE A, 30h, Loop2  If ACC ≠ 30h, Jump to label Loop2: 36
  • 37. CJNE A, #X, rel  Condition: Jump if Acc not equal to #X  Jump to specific destination  Short Jump  4 Machine cycles  Sample  CJNE A, #3Eh, Loop3  If ACC ≠ #30h, Jump to label Loop3: 37
  • 38. CJNE Rn, #X, rel  Condition: Jump if Rn not equal to #X  Jump to specific destination  Short Jump  4 Machine cycles  Sample  CJNE R4, #40h, Loop4  If R4 ≠ #40h, Jump to label Loop4: 38
  • 39. CJNE @Ri, #X, rel  Condition: Jump if register addressed by Ri not equal to #X  Jump to specific destination  Short Jump  4 Machine cycles  Sample  CJNE @R0, #E0h, Loop5  If register which is addressed by R0 ≠ #E0h, Jump to label Loop5: 39
  • 40. CJNE (Homework)  Write program to fill the memory area address 30h to 6Fh with Decimal (BCD) counting number start from 1H  The code must less than 15 line of assembly code 40
  • 41. CJNE (Sample)  Write program to fill the memory area address 30h to 4Fh with counting number start from 1H 41
  • 42. CJNE (Sample)  Write program to fill the memory area address 30h to 4Fh with counting number start from 1H 42
  • 43. DJNZ Rn, rel  Process: Decrease Rn by one, then  Condition: Jump if Rn not equal to zero  Jump to specific destination  Short Jump  3 Machine cycles  Sample  DJNZ R5, Loop6  Decrease R5 then check, If R5 ≠ 0, Jump to label Loop6: 43
  • 44. DJNZ Rx, rel  Process: Decrease Rx by one, then  Condition: Jump if Rx not equal to zero  Jump to specific destination  Short Jump  4 Machine cycles  Sample  DJNZ R5, Loop6  Decrease R5 then check, If R5 ≠ 0, Jump to label Loop6: 44
  • 45. DJNZ (Sample)  ; DJNZ is very convenion for  ; specified number of turn for some process.  ORG 0H  MOV R5,#10D  Loop:  ; Process here  DJNZ R5, Loop  END 45 Start R5 =10D Process End Loop: DJNZ R5, Loop