Q: How to use 89C51 to collect multi-channel pulse signals? The pulse signal is a square wave, and 89C51 is needed to count the pulses. If there is only one channel, can a counter be used? What if there are more channels?
A:
It depends on how high the frequency is. If it is not high, you can count multiple channels by querying. (yanggt) 2005-3-5 14:15:00
The frequency is between 1-3000Hz, is it easy to implement? (athome) 2005-3-5 16:22:36
3000Hz, more than ten channels are no problem. (yanggt) 2005-3-5 22:55:08
yanggt: Could you give me more specific advice? I am slow to comprehend and haven't figured it out in two days! (athome) 2005-3-11 15:56:35
For example, to sample 8-channel signals, connect the 8-channel signals to a certain port of the microcontroller (such as port P1), and then read the signals on this port at a rate twice the highest frequency of the signal. If the level of a certain bit changes, the count value of the changed channel will be increased by one. Similarly, more than a dozen channels can be processed in the same way. (cjs) 2005-3-11 16:36:12 -35
Just in case, write 1 to the acquisition pin first, and then read it in. (Xuan Xianjia) 2005-3-11 16:50:53
One more sentence, the frequency should be calculated with the minimum signal width.
For example, a pulse high (low) level is 1us, and the low (high) level is 1ms,
you can't say it is 1khz, but 1mhz.
Count the number of jumps of each signal in 1 second, and then divide them by 2, the result is the frequency. (yanggt) 2005-3-12 14:42:56 Here
are some instructions for your reference:
MOV B, P1
CLP: MOV A, P1
XCH A, B
XRL A, B; The bit corresponding to the pin where the jump occurs
= 1
CCH0: JNB ACC.0, CCH1
INC CNTR0
...
...
CCH1: JNB ACC.1, CCH2
2005-3-12 14:47:19
Thank you for your help, but I think some places are not appropriate, for
example, if the keyboard or LCD screen or some other place has an interrupt request, or
if some place needs to be accurately delayed, the query of P1 port is delayed, isn't it easy to lose the pulse
number?
These require programming skills, and they can all be solved.
"If the keyboard or LCD screen or some other place has an interrupt request", these will not
happen often. There is enough time to handle them.
"Somewhere requires accurate delay, delaying the query of P1 port", there is also a timer!
Keywords:89C51
Reference address:How to use 89C51 to collect multi-channel pulse signals?
A:
It depends on how high the frequency is. If it is not high, you can count multiple channels by querying. (yanggt) 2005-3-5 14:15:00
The frequency is between 1-3000Hz, is it easy to implement? (athome) 2005-3-5 16:22:36
3000Hz, more than ten channels are no problem. (yanggt) 2005-3-5 22:55:08
yanggt: Could you give me more specific advice? I am slow to comprehend and haven't figured it out in two days! (athome) 2005-3-11 15:56:35
For example, to sample 8-channel signals, connect the 8-channel signals to a certain port of the microcontroller (such as port P1), and then read the signals on this port at a rate twice the highest frequency of the signal. If the level of a certain bit changes, the count value of the changed channel will be increased by one. Similarly, more than a dozen channels can be processed in the same way. (cjs) 2005-3-11 16:36:12 -35
Just in case, write 1 to the acquisition pin first, and then read it in. (Xuan Xianjia) 2005-3-11 16:50:53
One more sentence, the frequency should be calculated with the minimum signal width.
For example, a pulse high (low) level is 1us, and the low (high) level is 1ms,
you can't say it is 1khz, but 1mhz.
Count the number of jumps of each signal in 1 second, and then divide them by 2, the result is the frequency. (yanggt) 2005-3-12 14:42:56 Here
are some instructions for your reference:
MOV B, P1
CLP: MOV A, P1
XCH A, B
XRL A, B; The bit corresponding to the pin where the jump occurs
= 1
CCH0: JNB ACC.0, CCH1
INC CNTR0
...
...
CCH1: JNB ACC.1, CCH2
2005-3-12 14:47:19
Thank you for your help, but I think some places are not appropriate, for
example, if the keyboard or LCD screen or some other place has an interrupt request, or
if some place needs to be accurately delayed, the query of P1 port is delayed, isn't it easy to lose the pulse
number?
These require programming skills, and they can all be solved.
"If the keyboard or LCD screen or some other place has an interrupt request", these will not
happen often. There is enough time to handle them.
"Somewhere requires accurate delay, delaying the query of P1 port", there is also a timer!
Previous article:The structure of MCS-51 series microcontroller
Next article:LCD 240*128 T6963C C51 Program
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
MoreDaily News
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
Guess you like
- [Welcome to the New Year and National Day] DCExpert takes you to "full stack" hands-on: rechargeable touch-controlled creative LED lamp based on ESP8266
- Mir MYC-YT507 development board review: Play NES games with the Famicom
- [RT-Thread reading notes] Week 4: Digest the first six chapters and fill in the gaps
- Steam oven water level detection - which one is more suitable, the float type or the photoelectric type?
- POE PD+DCDC non-isolated solution
- Help: Transformer detection of low frequency or DC residual current
- How to realize network remote control of balance car? ?
- Help with max30102 heart rate and blood oxygen test module issues
- Espressif releases new products really fast: the first Wi-Fi 6 + Bluetooth 5 (LE) RISC-V SoC is released
- November 10th prize-winning live broadcast: Protecting clean water sources - ADI water quality monitoring program registration is open~