Traditional Culture Encyclopedia - Photography and portraiture - How to set the timer of 5 1 single chip microcomputer?
How to set the timer of 5 1 single chip microcomputer?
The setting steps of the microcontroller timer are as follows:
1. Set the working mode of the timer. There are four working modes and two modes (counter/timer). For example:
MOV TMOD,# 0 1; Set the timer 0-bit timer mode, and the working mode is 1.
2. Assign an initial value according to the timing time. For example, the timing is 10 millisecond, so if the crystal oscillator is 12M, it is 10000 machine cycles. The timer is an overflow application interrupt, so the initial value is the overflow value minus the timing period.
MOV TH0 # high (65536- 10000)
MOV TL0 # low (65536- 10000)
3. Start the interrupt and timer.
SETB ET0
SETB Electronic Arts Circle
SETB TR0
- Related articles
- Chang 'e V made meritorious service: A five-star red flag rose on the moon, stronger than the American flag.
- Software for finding a job in different places What customer service software is recommended in different places?
- What positions are included in the early, middle and late stages of animation production?
- Which wedding photography shop in Shijiazhuang is good?
- The real pinnacle of writing a composition
- Where is the ballet in Nanning better?
- Kunming underground human photography
- Records of the seminar on rules and discipline
- Member wonder girl introduced.
- Modern War in Jiangxi Province