The document discusses timers and counters on the MCS-51 microcontroller. It describes the timer registers TMOD, TCON, THx and TLx. It explains the four modes of the timers and how to set the mode using the TMOD register. Examples are provided to calculate delays generated by timers based on settings of the THx and TLx registers. Programming techniques like DJNZ are also demonstrated for repeated timing loops.
The 8051 microcontroller has 2 timers/counters called T0 and T1. As their names suggest, their main purpose is to measure time and count external events. Besides, they can be used for generating clock pulses to be used in serial communication, so called Baud Rate.
The presentation explain about the timers and associated registers in 8051
8051 timer counter
Introduction
TMOD Register
TCON Register
Modes of Operation
Counters
The microcontroller 8051 has two 16 bit Timer/ Counter registers namely Timer 0 (T0) and Timer 1 (T1) .
When used as a “Timer” the microcontroller is programmed to count the internal clock pulse.
When used as a “Counter” the microcontroller is programmed to count external pulses.
Maximum count rate is 1/24 of the oscillator frequency.
It has four 32-bit Timer blocks
Each Timer block can be used as a ‘Timer’ (like for e.g. triggering an interrupt every ‘t’ microseconds) or as a ‘Counter’ and can be also used to demodulate PWM signals given as input.
Each Timer module has its own Timer Counter(TC) and Prescale Register(PR) associated with it.
When a Timer is Reset and Enabled, the TC is set to 0 and incremented by 1 every ‘PR+1’ clock cycles
It has four 32-bit Timer blocks
Each Timer block can be used as a ‘Timer’ (like for e.g. triggering an interrupt every ‘t’ microseconds) or as a ‘Counter’ and can be also used to demodulate PWM signals given as input.
Each Timer module has its own Timer Counter(TC) and Prescale Register(PR) associated with it.
When a Timer is Reset and Enabled, the TC is set to 0 and incremented by 1 every ‘PR+1’ clock cycles
The 8051 microcontroller has 2 timers/counters called T0 and T1. As their names suggest, their main purpose is to measure time and count external events. Besides, they can be used for generating clock pulses to be used in serial communication, so called Baud Rate.
The presentation explain about the timers and associated registers in 8051
8051 timer counter
Introduction
TMOD Register
TCON Register
Modes of Operation
Counters
The microcontroller 8051 has two 16 bit Timer/ Counter registers namely Timer 0 (T0) and Timer 1 (T1) .
When used as a “Timer” the microcontroller is programmed to count the internal clock pulse.
When used as a “Counter” the microcontroller is programmed to count external pulses.
Maximum count rate is 1/24 of the oscillator frequency.
It has four 32-bit Timer blocks
Each Timer block can be used as a ‘Timer’ (like for e.g. triggering an interrupt every ‘t’ microseconds) or as a ‘Counter’ and can be also used to demodulate PWM signals given as input.
Each Timer module has its own Timer Counter(TC) and Prescale Register(PR) associated with it.
When a Timer is Reset and Enabled, the TC is set to 0 and incremented by 1 every ‘PR+1’ clock cycles
It has four 32-bit Timer blocks
Each Timer block can be used as a ‘Timer’ (like for e.g. triggering an interrupt every ‘t’ microseconds) or as a ‘Counter’ and can be also used to demodulate PWM signals given as input.
Each Timer module has its own Timer Counter(TC) and Prescale Register(PR) associated with it.
When a Timer is Reset and Enabled, the TC is set to 0 and incremented by 1 every ‘PR+1’ clock cycles
Interrupt programming with 8051 microcontrollerAnkit Bhatnagar
this ppt is related to the intrupts related to the 8051 microcontroller ..
topics are introduction to intrupts
intrerrupts vs pollings
difference between intrupts snd pollings
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
Online aptitude test management system project report.pdfKamal Acharya
The purpose of on-line aptitude test system is to take online test in an efficient manner and no time wasting for checking the paper. The main objective of on-line aptitude test system is to efficiently evaluate the candidate thoroughly through a fully automated system that not only saves lot of time but also gives fast results. For students they give papers according to their convenience and time and there is no need of using extra thing like paper, pen etc. This can be used in educational institutions as well as in corporate world. Can be used anywhere any time as it is a web based application (user Location doesn’t matter). No restriction that examiner has to be present when the candidate takes the test.
Every time when lecturers/professors need to conduct examinations they have to sit down think about the questions and then create a whole new set of questions for each and every exam. In some cases the professor may want to give an open book online exam that is the student can take the exam any time anywhere, but the student might have to answer the questions in a limited time period. The professor may want to change the sequence of questions for every student. The problem that a student has is whenever a date for the exam is declared the student has to take it and there is no way he can take it at some other time. This project will create an interface for the examiner to create and store questions in a repository. It will also create an interface for the student to take examinations at his convenience and the questions and/or exams may be timed. Thereby creating an application which can be used by examiners and examinee’s simultaneously.
Examination System is very useful for Teachers/Professors. As in the teaching profession, you are responsible for writing question papers. In the conventional method, you write the question paper on paper, keep question papers separate from answers and all this information you have to keep in a locker to avoid unauthorized access. Using the Examination System you can create a question paper and everything will be written to a single exam file in encrypted format. You can set the General and Administrator password to avoid unauthorized access to your question paper. Every time you start the examination, the program shuffles all the questions and selects them randomly from the database, which reduces the chances of memorizing the questions.
6th International Conference on Machine Learning & Applications (CMLA 2024)ClaraZara1
6th International Conference on Machine Learning & Applications (CMLA 2024) will provide an excellent international forum for sharing knowledge and results in theory, methodology and applications of on Machine Learning & Applications.
An Approach to Detecting Writing Styles Based on Clustering Techniquesambekarshweta25
An Approach to Detecting Writing Styles Based on Clustering Techniques
Authors:
-Devkinandan Jagtap
-Shweta Ambekar
-Harshit Singh
-Nakul Sharma (Assistant Professor)
Institution:
VIIT Pune, India
Abstract:
This paper proposes a system to differentiate between human-generated and AI-generated texts using stylometric analysis. The system analyzes text files and classifies writing styles by employing various clustering algorithms, such as k-means, k-means++, hierarchical, and DBSCAN. The effectiveness of these algorithms is measured using silhouette scores. The system successfully identifies distinct writing styles within documents, demonstrating its potential for plagiarism detection.
Introduction:
Stylometry, the study of linguistic and structural features in texts, is used for tasks like plagiarism detection, genre separation, and author verification. This paper leverages stylometric analysis to identify different writing styles and improve plagiarism detection methods.
Methodology:
The system includes data collection, preprocessing, feature extraction, dimensional reduction, machine learning models for clustering, and performance comparison using silhouette scores. Feature extraction focuses on lexical features, vocabulary richness, and readability scores. The study uses a small dataset of texts from various authors and employs algorithms like k-means, k-means++, hierarchical clustering, and DBSCAN for clustering.
Results:
Experiments show that the system effectively identifies writing styles, with silhouette scores indicating reasonable to strong clustering when k=2. As the number of clusters increases, the silhouette scores decrease, indicating a drop in accuracy. K-means and k-means++ perform similarly, while hierarchical clustering is less optimized.
Conclusion and Future Work:
The system works well for distinguishing writing styles with two clusters but becomes less accurate as the number of clusters increases. Future research could focus on adding more parameters and optimizing the methodology to improve accuracy with higher cluster values. This system can enhance existing plagiarism detection tools, especially in academic settings.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
We have compiled the most important slides from each speaker's presentation. This year’s compilation, available for free, captures the key insights and contributions shared during the DfMAy 2024 conference.
Literature Review Basics and Understanding Reference Management.pptxDr Ramhari Poudyal
Three-day training on academic research focuses on analytical tools at United Technical College, supported by the University Grant Commission, Nepal. 24-26 May 2024
Using recycled concrete aggregates (RCA) for pavements is crucial to achieving sustainability. Implementing RCA for new pavement can minimize carbon footprint, conserve natural resources, reduce harmful emissions, and lower life cycle costs. Compared to natural aggregate (NA), RCA pavement has fewer comprehensive studies and sustainability assessments.
Forklift Classes Overview by Intella PartsIntella Parts
Discover the different forklift classes and their specific applications. Learn how to choose the right forklift for your needs to ensure safety, efficiency, and compliance in your operations.
For more technical information, visit our website https://intellaparts.com
HEAP SORT ILLUSTRATED WITH HEAPIFY, BUILD HEAP FOR DYNAMIC ARRAYS.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the minimum element and place the minimum element at the beginning. Repeat the same process for the remaining elements.
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
3. MCS51 Timer / Counter
The 8051 has two timers/counters are Timer 0 and Timer 1
Both of them can be used either as timers to generate a
time delay or as counters to count events from external
signal coming to microcontroller.
By Set interval value, enable timer to start running while
monitoring overflow bit to know the completion interval.
3
4. Timer Register
4
TMOD (Timer operation Mode) register
TCON (Timer Control) register
THx Register (TH1 for Timer 1, TH0 for Timer 0)
TLx Register (TL1 for Timer 1, TL0 for Timer 0)
5. Mode 1 Equivalent circuit
5
Modified from http://blog.circuits4you.com/2015/07/programming-timers-on-8051.html
/ 12
THx TLx
Clock
Gen.
Machine Cycle
6. TMOD (Timer operation Mode) register
6
Gate:
“0” : enable timer by TRx bit
“1” : enable timer by TRx bit with external signal at pin INTx
C/T: Counter and Timer selector
1 for Count signal from Tx Pin (Counter)
0 for Count internal clock signal (Timer)
M1: Mode bit 1 (MSB)
M0: Mode bit 0 (LSB)
TMOD
Timer 1 Timer 0
Gate C/T M1 M0 Gate C/T M1 M0
0 0 0 1 0 0 0 0
10. Example 9.1
10
TMOD
Gate C/T M1 M0 Gate C/T M1 M0
x x x x x x x x
Find the value for TMOD if we want to program
Timer 0 in mode 1, count from internal clock source,
and use instructions to start and stop the timer.
Timer 1 in mode 2, count from external and start
counting by instruction.
01100001
11. Mode 1 Equivalent circuit
11
Modified from http://blog.circuits4you.com/2015/07/programming-timers-on-8051.html
/ 12
THx TLx
Clock
Gen.
Machine Cycle
12. Example 9.1
12
TMOD
Timer 1 Timer 0
Gate C/T M1 M0 Gate C/T M1 M0
0 0 0 0 x x x x
Find the value for TMOD if we want to program
Timer 0 in mode 1, count from internal clock
source, and use instructions to start and stop the
timer.
Solution:
Timer 0, So, we care only Timer 0 Nibble
13. Example 9.1
13
TMOD
Timer 1 Timer 0
Gate C/T M1 M0 Gate C/T M1 M0
0 0 0 0 x x 0 1
Find the value for TMOD if we want to program
Timer 0 in mode 1, count from internal clock source,
and use instructions to enable the timer.
Solution:
Timer 0: So, we care only Timer 0 Nibble
Mode 1: M1 = 0, M0 = 1
14. Example 9.1
14
TMOD
Timer 1 Timer 0
Gate C/T M1 M0 Gate C/T M1 M0
0 0 0 0 x 0 0 1
Find the value for TMOD if we want to program
Timer 0 in mode 1, count from internal clock source,
and use instructions to enable the timer.
Solution:
Timer 0: So, we care only Timer 0 Nibble
Mode 1: M1 = 0, M0 = 1
Internal Clock: That mean Timer. So, C/T = 0
15. Example 9.1
15
TMOD
Timer 1 Timer 0
Gate C/T M1 M0 Gate C/T M1 M0
0 0 0 0 0 0 0 1
Find the value for TMOD if we want to program Timer 0
in mode 1, count from internal clock source, and use
instructions to enable the timer.
Solution:
Timer 0: So, we care only Timer 0 Nibble
Mode 1: M1 = 0, M0 = 1
Internal Clock: That mean Timer. So, C/T = 0
Enable by TR0 bits: Gate = 0
16. Example 9.1
16
TMOD
Timer 1 Timer 0
Gate C/T M1 M0 Gate C/T M1 M0
0 0 0 0 0 0 0 1
Find the value for TMOD if we want to program Timer 0 in mode 1, count from
internal clock source, and use instructions to enable the timer.
Solution:
Timer 0: So, we care only Timer 0 Nibble
Mode 1: M1 = 0, M0 = 1
Internal Clock: That mean Timer. So, C/T = 0
Enable by TR0 bits: Gate = 0
Answer: Value of TMOD is #00000001B or #01H
(Use instruction MOV TMOD, #01H)
17. TCON (Timer Control register)
17
TF1: Timer 1 Over Flow bit
This bit will set when timer is over flow
TR1: Timer 1 Enable bit
Start running of Timer 1
TF0: Timer 0 Over Flow bit
This bit will set when timer is over flow
TR0: Timer 0 Enable bit
Start running of Timer 0
IE1, IT1, IE0, IT0 will describe in next chapter
TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0
0 0 0 1 0 0 0 0
18. Mode 1’s Operation
18
THx TLx
0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 1
THx and TLx store start value
Timer operation always count-up (increase) on [THx, TLX] each machine cycle
SETB TRx instruction to start running timer
Over flow when Increase FFFF to 0000
Interval value = FFFF – [TH,TL]
FFFF give minimum interval time
0000 give maximum interval time
Example:
MOV TH0, #22H
MOV TL0, #00H
; Then interval is FFFF – 2200 = DDFF Machine Cycle.
Tips: Monitor TFx with instruction
“MonitorLable : JNB TFx, MonitorLable”
19. Example 9.2
19
Calculate amount of time delay in the DELAY subroutine below
generated by the timer. Assume that XTAL = 11.0592 MHz.
Delay:
MOV TMOD, #01
MOV TL0, #0F2H
MOV TH0, #0FFH
SETB TR0
MonitorTX : JNB TF0, MonitorTX
CLR TR0
CLR TF0
RET
20. Example 9.2
20
Solution:
The timer works with a clock frequency of 1/12
of the X’TAL frequency; therefore, we have
11.0592 MHz / 12 = 921.6 kHz as the timer
(Machine Cycle) frequency.
As a result, each clock has a period of T = 1 /
921.6 kHz = 1.085 (is. In other words, Timer 0
counts up each 1.085 s resulting in delay =
number of counts x 1.085 s.
21. Example 9.2
21
Solution:
As the timer counts up, it goes through the
states of FFF3, FFF4, FFF5, FFF6, FFF7, FFF8,
FFF9, FFFA, FFFB, FFFC, FFFD, FFFE, and
FFFFH. One more clock rolls it to 0000, raising
the timer flag (TF0 = 1). At that point, the JNB
instruction falls through.
Timer 0 is stopped by the instruction “CLR TRO”.
The DELAY subroutine ends
22. Example 9.2
22
Place Machine cycle to the code:
Delay:
MOV TMOD, #01 2
MOV TL0, #0F2H 2
MOV TH0, #0FFH 2
SETB TR0 1
MonitorTX : JNB TF0, MonitorTX 14
CLR TR0 1
CLR TF0 1
RET 2
Total = 25
23. Example 9.2
23
From total machine cycle used was 25 machine cycles.
25 x 1.058 s. = 27.125 s.
So, This subroutine generate delay for 27.125 s.
Conclusion: Total Machine cycle to overflow is
Machine Cycle = 1 + FFFF – Interval (TH,TL) value
24. Workshop 9.1
24
Calculate amount of time delay in the DELAY subroutine below
generated by the timer. Assume that XTAL = 22.1184 MHz.
Delay:
MOV TMOD, #01
MOV TL0, #034H
MOV TH0, #012H
SETB TR0
MonitorTX : JNB TF0, MonitorTX
CLR TR0
CLR TF0
RET
25. Example 9.3
25
Connect Port 3.0 with
Input Switch and Port 1.0
with LED Display
Write Program for MCS51
to Turn ON LED for 2
Second after user press
input switch.
Show calculate delay
generate by MCS51.
Assume that X’TAL =
11.0592 MHz.
Start
TMOD
End
P3.0
= 1
ON
Display
Delay 2
Seconds
OFF
Display
WaitSW:
R3 =33D
DJNZ R3, Loop
Delay
Loop:
26. Example 9.3
26
Connect Port 3.0 with
Input Switch and Port
1.0 with LED Display
From code below
calculate delay
generate by MCS51.
Assume that X’TAL =
11.0592 MHz.
MOV TMOD, #10H ; Set Timer Mode
CLR P1.0
WaitSW: JB P3.0, WaitSW
SETB P1.0
ACALL Delay
CLR P1.0
SJMP $
Delay:
MOV R3,#31D
MainProcess:
MOV TL1,#08H
MOV TH1,#1H
SETB TR1
Monitoring: JNB TF1, Monitoring
CLR TR1
CLR TF1
DJNZ R3, MainProcess
RET
END
28. DJNZ (Sample)
; DJNZ is very convenion for
; specified number of turn for
some process.
MOV R3,#31D
Loop:
; Process here
DJNZ R3, Loop
END
28
Start
R5 =10D
End
Loop:
DJNZ R5, Loop
Process
29. Example 9.4
29
From code below calculate frequency of signal generate by MCS51. Assume that X’TAL =
11.0592 MHz.
MOV TMOD, #10H
Loop:
CPL P1.1
ACALL Delay
JMP Loop ; All Loop All Delay + 7 = FF04H = 65286D Machine cycle
Delay:
MOV TL1,#08H
MOV TH1,#1H
SETB TR1
Monitoring: JNB TF1, Monitoring
CLR TR1
CLR TF1
RET ; All Delay code FEFF
END
30. Example 9.5
30
Write assembly
program for MCS51
to generate Pulse
signal with duty cycle
20% to pin P1.1
MOV TMOD, #10H
Loop: SETB P1.1
ACALL DelayON
CLR P1.1
ACALL DelayOFF
JMP Loop
DelayON: MOV TL1,#00D
MOV TH1,#236D ; 256-20
SETB TR1
MonitoringOn: JNB TF1, MonitoringOn
CLR TR1
CLR TF1
RET
DelayOFF: MOV TL1,#00D
MOV TH1,#176D ; 256-80
SETB TR1
MonitoringOff: JNB TF1, MonitoringOff
CLR TR1
CLR TF1
RET
END