How to use 89C51 to collect multi-channel pulse signals?

Publisher:和谐的24号Latest update time:2015-04-24 Source: laoguKeywords:89C51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
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?

Previous article:The structure of MCS-51 series microcontroller
Next article:LCD 240*128 T6963C C51 Program

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号