SlideShare a Scribd company logo
Department of Computer Sc. & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree
Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh)
Sector-26, Chandigarh - 160019
MICROPROCESSOR
CS-304
DELAYS AND COUNTERS
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
Topics We’ll Cover
• Counters and Time Delays
• Hexadecimal Counters
• Modulo Ten Counter
• Generating Pulse Waveform
• Debugging Counters and Time
Delay Programs
CS-604
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
Introduction
⚫ This chapter deals with designing of counters and time
delays through software programming.
⚫ Counter and time delays are important technique. They
are commonly used in designing of traffic signals,
digital clocks, setting up reasonably accurate timing
between two events.
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
Counters
⚫ Designing a counter: A counter is
determined by loading an appropriate
count in the register.
⚫ A loop is setup to decrement the count
(down-counter) and increment the count
for (up- counter) when an event occurs.
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
Time -Delays
⚫ The procedure for designing a time delay is
same as counter.
⚫ A number is loaded in the register, depending
upon the delay required .
⚫ The register is decremented until count is not
equal to zero by setting a loop.
⚫ A conditional jump is executed when the count
is equal to zero.
⚫ The loop causes delay depending upon the
clock period of the system and number of
instructions.
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
Time Delay Using One Register
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
Calculating Time Delays
⚫ Assume clock frequency of system =2MHz.
⚫ So Clock period = 0.5 microsecond.
⚫ Time to execute the MVI instructions=
7 x0.5=3.5µs
⚫ Time Delay in loop= (Clock period x Total
T states in loop x initial count in decimal).
⚫ Time delay =(0.5 x 10-6x 14 x 255)=1785µs
+3.5µs.
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
⚫ T states of JNZ instruction is shown as 10/7.
⚫ JNZ instruction requires 10 T-states when
loop executes.
⚫ JNZ instruction requires 7-states when loop
fails to execute.
⚫ Loop runs for 255 times and at the last cycle
JNZ executes in 7 T states.
So Time Delay = (1788.5-3x0.5) µs
= 1787 µs.
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
Time Delay Using Register Pair
2384 H=16x16x16x2+16x16x3+16x8+4x1=9092
Total Delay =24 x 9092 x 0.5x10-6
=109 ms
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
Flowchart for
Hexadecimal
counter
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
Generating Pulse Waveform
⚫ PROBLEM ANALYSIS
In this problem, the period of the square wave is 500
us•, therefore, the pulse should be on (logic l) for 250
uS and off (logic 0) for the remaining 250 Its. The
alternate pattern of 0/l bits can be provided by
loading the accumulator with the number AAH (1010
1010) and rotating the pattern once through each
delay loop. Bit Do of the output port is used to
provide logic 0 and l; therefore, all other bits can be
masked by ANDing the accumulator with the byte 01
H. The delay of 250 us can be very easily obtained
with an 8-bit delay count and one register.
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
Pro
gra
m
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
Program Description
Register D is loaded with the bit pattern AAH (1010 1010), and the bit
pattern is moved into the accumulator. The bit pattern is rotated left once
and saved again in register D. The accumulator contents must be saved
because the accumulator is used later in the program. The next instruction,
ANI, ANDs (A) to mask all but bit Do, as illustrated below.
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
⚫ Delay Calculations In this problem, the pulse
width is relatively small (250 us); therefore, to
obtain a reasonably accurate output pulse
width, we should account for all the T-states.
The total delay should include the delay in the
loop and the execution time of theinstructions
outside the loop.
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
1. The number of instructions outside the loop is seven; it includes
six instructions before the loop beginning at the symbol ROTATE
and the last instruction JMP.
Delay outside the Loop: To = 46 T-states x 325 ns — 14.95 us
2. The delay loop includes two instructions (DCR and JNZ) with 14
T-states except for the last cycle, which has II T-states.
Loop Delay: TL = 14 T-states x 325 ns x (Count - l) + 11 T-states x
325 ns
= 4.5 us (Count- l) + 3.575
3. The total delay required is 250 ps. Therefore, the count can be
calculated as follows:
250us - 14.95us +4.5us (Count - 1) + 3.575us
Count =52.410 = 34H
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
Debugging Counter & Time Delay Programs
⚫ Errors in counting T-states in a delay loop. Typically, the
first instruction—to load a delay register—is mistakenly
included in the loop.
⚫ Errors in recognizing how many times a loop is repeated.
⚫ Failure to convert a delay count from a decimal number
into its hexadecimal equivalent.
⚫ Conversion error in converting a delay count from
decimal to hexadecimal number or vice versa.
⚫ Specifying a wrong Jump location.
⚫ Failure to set a flag, especially with 16-bit
Decrement/lncrement instructions.
⚫ Using a wrong Jump instruction.
⚫ Failure to display either the first or the last count.
⚫ Failure to provide a delay between the last and the last-
but-one count.
Department of Computer Science & Engineering
Chandigarh College of Engineering & Technology (CCET -Degree Wing)
(A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019
THANK YOU!
Any Queries?
CS-604

More Related Content

Similar to Delays and counter.pptx

Bivariatealgebraic integerencoded arai algorithm for
Bivariatealgebraic integerencoded arai algorithm forBivariatealgebraic integerencoded arai algorithm for
Bivariatealgebraic integerencoded arai algorithm for
eSAT Publishing House
 
MODULE TITLE PROGRAMMABLE LOGIC CONTROLLERSTOPIC TITLE.docx
MODULE TITLE    PROGRAMMABLE LOGIC CONTROLLERSTOPIC TITLE.docxMODULE TITLE    PROGRAMMABLE LOGIC CONTROLLERSTOPIC TITLE.docx
MODULE TITLE PROGRAMMABLE LOGIC CONTROLLERSTOPIC TITLE.docx
roushhsiu
 
5378086.ppt
5378086.ppt5378086.ppt
5378086.ppt
kavita417551
 
PERFORMANCE ANALYSIS OF D-FLIP FLOP USING CMOS, GDI, DSTC TECHNIQUES
PERFORMANCE ANALYSIS OF D-FLIP FLOP USING CMOS, GDI, DSTC TECHNIQUESPERFORMANCE ANALYSIS OF D-FLIP FLOP USING CMOS, GDI, DSTC TECHNIQUES
PERFORMANCE ANALYSIS OF D-FLIP FLOP USING CMOS, GDI, DSTC TECHNIQUES
IRJET Journal
 
Measurement of losses in direct torque controlled
Measurement of losses in direct torque controlledMeasurement of losses in direct torque controlled
Measurement of losses in direct torque controlled
eSAT Publishing House
 
Instrumentation limited (sumeer training report)
Instrumentation limited (sumeer training report)Instrumentation limited (sumeer training report)
Instrumentation limited (sumeer training report)
Shruti Bhargava
 
intelligent braking system report
intelligent braking system reportintelligent braking system report
intelligent braking system report
Sumit Kumar
 
Biogeography-Based Optimization, BBO, Evolutionary Algorithm, Migration, Part...
Biogeography-Based Optimization, BBO, Evolutionary Algorithm, Migration, Part...Biogeography-Based Optimization, BBO, Evolutionary Algorithm, Migration, Part...
Biogeography-Based Optimization, BBO, Evolutionary Algorithm, Migration, Part...
cscpconf
 
Robust PID Controller Design for Non-Minimum Phase Systems using Magnitude Op...
Robust PID Controller Design for Non-Minimum Phase Systems using Magnitude Op...Robust PID Controller Design for Non-Minimum Phase Systems using Magnitude Op...
Robust PID Controller Design for Non-Minimum Phase Systems using Magnitude Op...
IRJET Journal
 
Reconfigurable CORDIC Low-Power Implementation of Complex Signal Processing f...
Reconfigurable CORDIC Low-Power Implementation of Complex Signal Processing f...Reconfigurable CORDIC Low-Power Implementation of Complex Signal Processing f...
Reconfigurable CORDIC Low-Power Implementation of Complex Signal Processing f...
Editor IJMTER
 
Data Acquisition
Data AcquisitionData Acquisition
Data Acquisition
azhar557
 
Scheduling Fixed Priority Tasks with Preemption Threshold
Scheduling Fixed Priority Tasks with Preemption ThresholdScheduling Fixed Priority Tasks with Preemption Threshold
Scheduling Fixed Priority Tasks with Preemption Threshold
Deepak Raj
 
How to Build an Effective Manufacturing Training Plan
How to Build an Effective Manufacturing Training PlanHow to Build an Effective Manufacturing Training Plan
How to Build an Effective Manufacturing Training Plan
Simutech Multimedia
 
Simulation of Signal Reflection in Digital Design
Simulation of Signal Reflection in Digital DesignSimulation of Signal Reflection in Digital Design
Simulation of Signal Reflection in Digital Design
Kaushik Patra
 
Explicit model predictive control of fast dynamic system
Explicit model predictive control of fast dynamic systemExplicit model predictive control of fast dynamic system
Explicit model predictive control of fast dynamic system
eSAT Journals
 
Explicit model predictive control of fast dynamic system
Explicit model predictive control of fast dynamic systemExplicit model predictive control of fast dynamic system
Explicit model predictive control of fast dynamic system
eSAT Publishing House
 
Selection of FDI-Tolerant Time-Sensitive Networking (TSN)-Based Architecture
Selection of FDI-Tolerant Time-Sensitive Networking (TSN)-Based ArchitectureSelection of FDI-Tolerant Time-Sensitive Networking (TSN)-Based Architecture
Selection of FDI-Tolerant Time-Sensitive Networking (TSN)-Based Architecture
Voica Gavrilut
 
IRJET- Design of 16 Bit Low Power Vedic Architecture using CSA & UTS
IRJET-  	  Design of 16 Bit Low Power Vedic Architecture using CSA & UTSIRJET-  	  Design of 16 Bit Low Power Vedic Architecture using CSA & UTS
IRJET- Design of 16 Bit Low Power Vedic Architecture using CSA & UTS
IRJET Journal
 
Time series analysis 101
Time series analysis 101Time series analysis 101
Time series analysis 101
Balvinder Hira
 

Similar to Delays and counter.pptx (20)

Bivariatealgebraic integerencoded arai algorithm for
Bivariatealgebraic integerencoded arai algorithm forBivariatealgebraic integerencoded arai algorithm for
Bivariatealgebraic integerencoded arai algorithm for
 
MODULE TITLE PROGRAMMABLE LOGIC CONTROLLERSTOPIC TITLE.docx
MODULE TITLE    PROGRAMMABLE LOGIC CONTROLLERSTOPIC TITLE.docxMODULE TITLE    PROGRAMMABLE LOGIC CONTROLLERSTOPIC TITLE.docx
MODULE TITLE PROGRAMMABLE LOGIC CONTROLLERSTOPIC TITLE.docx
 
5378086.ppt
5378086.ppt5378086.ppt
5378086.ppt
 
PERFORMANCE ANALYSIS OF D-FLIP FLOP USING CMOS, GDI, DSTC TECHNIQUES
PERFORMANCE ANALYSIS OF D-FLIP FLOP USING CMOS, GDI, DSTC TECHNIQUESPERFORMANCE ANALYSIS OF D-FLIP FLOP USING CMOS, GDI, DSTC TECHNIQUES
PERFORMANCE ANALYSIS OF D-FLIP FLOP USING CMOS, GDI, DSTC TECHNIQUES
 
Measurement of losses in direct torque controlled
Measurement of losses in direct torque controlledMeasurement of losses in direct torque controlled
Measurement of losses in direct torque controlled
 
05725150
0572515005725150
05725150
 
Instrumentation limited (sumeer training report)
Instrumentation limited (sumeer training report)Instrumentation limited (sumeer training report)
Instrumentation limited (sumeer training report)
 
intelligent braking system report
intelligent braking system reportintelligent braking system report
intelligent braking system report
 
Biogeography-Based Optimization, BBO, Evolutionary Algorithm, Migration, Part...
Biogeography-Based Optimization, BBO, Evolutionary Algorithm, Migration, Part...Biogeography-Based Optimization, BBO, Evolutionary Algorithm, Migration, Part...
Biogeography-Based Optimization, BBO, Evolutionary Algorithm, Migration, Part...
 
Robust PID Controller Design for Non-Minimum Phase Systems using Magnitude Op...
Robust PID Controller Design for Non-Minimum Phase Systems using Magnitude Op...Robust PID Controller Design for Non-Minimum Phase Systems using Magnitude Op...
Robust PID Controller Design for Non-Minimum Phase Systems using Magnitude Op...
 
Reconfigurable CORDIC Low-Power Implementation of Complex Signal Processing f...
Reconfigurable CORDIC Low-Power Implementation of Complex Signal Processing f...Reconfigurable CORDIC Low-Power Implementation of Complex Signal Processing f...
Reconfigurable CORDIC Low-Power Implementation of Complex Signal Processing f...
 
Data Acquisition
Data AcquisitionData Acquisition
Data Acquisition
 
Scheduling Fixed Priority Tasks with Preemption Threshold
Scheduling Fixed Priority Tasks with Preemption ThresholdScheduling Fixed Priority Tasks with Preemption Threshold
Scheduling Fixed Priority Tasks with Preemption Threshold
 
How to Build an Effective Manufacturing Training Plan
How to Build an Effective Manufacturing Training PlanHow to Build an Effective Manufacturing Training Plan
How to Build an Effective Manufacturing Training Plan
 
Simulation of Signal Reflection in Digital Design
Simulation of Signal Reflection in Digital DesignSimulation of Signal Reflection in Digital Design
Simulation of Signal Reflection in Digital Design
 
Explicit model predictive control of fast dynamic system
Explicit model predictive control of fast dynamic systemExplicit model predictive control of fast dynamic system
Explicit model predictive control of fast dynamic system
 
Explicit model predictive control of fast dynamic system
Explicit model predictive control of fast dynamic systemExplicit model predictive control of fast dynamic system
Explicit model predictive control of fast dynamic system
 
Selection of FDI-Tolerant Time-Sensitive Networking (TSN)-Based Architecture
Selection of FDI-Tolerant Time-Sensitive Networking (TSN)-Based ArchitectureSelection of FDI-Tolerant Time-Sensitive Networking (TSN)-Based Architecture
Selection of FDI-Tolerant Time-Sensitive Networking (TSN)-Based Architecture
 
IRJET- Design of 16 Bit Low Power Vedic Architecture using CSA & UTS
IRJET-  	  Design of 16 Bit Low Power Vedic Architecture using CSA & UTSIRJET-  	  Design of 16 Bit Low Power Vedic Architecture using CSA & UTS
IRJET- Design of 16 Bit Low Power Vedic Architecture using CSA & UTS
 
Time series analysis 101
Time series analysis 101Time series analysis 101
Time series analysis 101
 

Recently uploaded

Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 

Recently uploaded (20)

Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 

Delays and counter.pptx

  • 1. Department of Computer Sc. & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) Sector-26, Chandigarh - 160019 MICROPROCESSOR CS-304 DELAYS AND COUNTERS
  • 2. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 Topics We’ll Cover • Counters and Time Delays • Hexadecimal Counters • Modulo Ten Counter • Generating Pulse Waveform • Debugging Counters and Time Delay Programs CS-604
  • 3. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 Introduction ⚫ This chapter deals with designing of counters and time delays through software programming. ⚫ Counter and time delays are important technique. They are commonly used in designing of traffic signals, digital clocks, setting up reasonably accurate timing between two events.
  • 4. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 Counters ⚫ Designing a counter: A counter is determined by loading an appropriate count in the register. ⚫ A loop is setup to decrement the count (down-counter) and increment the count for (up- counter) when an event occurs.
  • 5. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 Time -Delays ⚫ The procedure for designing a time delay is same as counter. ⚫ A number is loaded in the register, depending upon the delay required . ⚫ The register is decremented until count is not equal to zero by setting a loop. ⚫ A conditional jump is executed when the count is equal to zero. ⚫ The loop causes delay depending upon the clock period of the system and number of instructions.
  • 6. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 Time Delay Using One Register
  • 7. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 Calculating Time Delays ⚫ Assume clock frequency of system =2MHz. ⚫ So Clock period = 0.5 microsecond. ⚫ Time to execute the MVI instructions= 7 x0.5=3.5µs ⚫ Time Delay in loop= (Clock period x Total T states in loop x initial count in decimal). ⚫ Time delay =(0.5 x 10-6x 14 x 255)=1785µs +3.5µs.
  • 8. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 ⚫ T states of JNZ instruction is shown as 10/7. ⚫ JNZ instruction requires 10 T-states when loop executes. ⚫ JNZ instruction requires 7-states when loop fails to execute. ⚫ Loop runs for 255 times and at the last cycle JNZ executes in 7 T states. So Time Delay = (1788.5-3x0.5) µs = 1787 µs.
  • 9. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 Time Delay Using Register Pair 2384 H=16x16x16x2+16x16x3+16x8+4x1=9092 Total Delay =24 x 9092 x 0.5x10-6 =109 ms
  • 10. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 Flowchart for Hexadecimal counter
  • 11. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 Generating Pulse Waveform ⚫ PROBLEM ANALYSIS In this problem, the period of the square wave is 500 us•, therefore, the pulse should be on (logic l) for 250 uS and off (logic 0) for the remaining 250 Its. The alternate pattern of 0/l bits can be provided by loading the accumulator with the number AAH (1010 1010) and rotating the pattern once through each delay loop. Bit Do of the output port is used to provide logic 0 and l; therefore, all other bits can be masked by ANDing the accumulator with the byte 01 H. The delay of 250 us can be very easily obtained with an 8-bit delay count and one register.
  • 12. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 Pro gra m
  • 13. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 Program Description Register D is loaded with the bit pattern AAH (1010 1010), and the bit pattern is moved into the accumulator. The bit pattern is rotated left once and saved again in register D. The accumulator contents must be saved because the accumulator is used later in the program. The next instruction, ANI, ANDs (A) to mask all but bit Do, as illustrated below.
  • 14. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 ⚫ Delay Calculations In this problem, the pulse width is relatively small (250 us); therefore, to obtain a reasonably accurate output pulse width, we should account for all the T-states. The total delay should include the delay in the loop and the execution time of theinstructions outside the loop.
  • 15. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 1. The number of instructions outside the loop is seven; it includes six instructions before the loop beginning at the symbol ROTATE and the last instruction JMP. Delay outside the Loop: To = 46 T-states x 325 ns — 14.95 us 2. The delay loop includes two instructions (DCR and JNZ) with 14 T-states except for the last cycle, which has II T-states. Loop Delay: TL = 14 T-states x 325 ns x (Count - l) + 11 T-states x 325 ns = 4.5 us (Count- l) + 3.575 3. The total delay required is 250 ps. Therefore, the count can be calculated as follows: 250us - 14.95us +4.5us (Count - 1) + 3.575us Count =52.410 = 34H
  • 16. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 Debugging Counter & Time Delay Programs ⚫ Errors in counting T-states in a delay loop. Typically, the first instruction—to load a delay register—is mistakenly included in the loop. ⚫ Errors in recognizing how many times a loop is repeated. ⚫ Failure to convert a delay count from a decimal number into its hexadecimal equivalent. ⚫ Conversion error in converting a delay count from decimal to hexadecimal number or vice versa. ⚫ Specifying a wrong Jump location. ⚫ Failure to set a flag, especially with 16-bit Decrement/lncrement instructions. ⚫ Using a wrong Jump instruction. ⚫ Failure to display either the first or the last count. ⚫ Failure to provide a delay between the last and the last- but-one count.
  • 17. Department of Computer Science & Engineering Chandigarh College of Engineering & Technology (CCET -Degree Wing) (A Govt. College under Chandigarh UT Administration, Chandigarh) ,Sector-26, Chandigarh - 160019 THANK YOU! Any Queries? CS-604