无计数和QUOT;计数器"微控制器是可能的? [英] Counting without "counter" in microcontroller is Possible?

查看:352
本文介绍了无计数和QUOT;计数器"微控制器是可能的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好朋友我在微控制器领域想知道这是不可能的罪名不使用计数器我的意思是通过监控连接到该事件generator.i针的事件,我问这个问题,因为新的presently我想计算传感器的频率我已经使用DSO(数字存​​储示波器),它(DSO)检查了它的频率说,它的频率为98khz但我们现在都一个8位计数器的最大值为255,那么怎么样有可能......传感器连接到PB0(Atmega16的TCNT0的/计数器0).........请帮助

Hello friends i am new in microcontroller domain wants to know is this not possible to counts an events without using counter i mean by monitoring the pin which is connected to the the event generator.i am asking this question because presently i want to calculate the frequency of sensor i have already checked it frequency by using DSO(Digital storage oscilloscope) and it(DSO) says its frequency is 98khz but as we all now that the maximum value of an 8 bit counter is 255 then how it is possible......The sensor is connected to PB0(TCNT0/Counter 0 of Atmega16) .........please help

推荐答案

您可以做两种不同的方式。第一是使用prescaler。你可以将其设置为1024为例所以每1024个时间PB0被触发(或什么都正确的说法是,它已经有一段时间我处理的MCU)的计数器加1所以基本上计数器将计数每增加千赫(约)。

You can do it 2 different ways. The 1st is using the prescaler. You can set it to 1024 for example so every 1024th time PB0 is triggered(or what ever the correct term is, it has been a while since I dealt with MCUs) the counter is incremented by 1. So essentially the counter would be counting every KHz (approximately).

使用没有prescaler但设置MCU第二方式,使每一个计数器溢出你加1其他登记的时间,每一个注册溢出你以1递增另一个寄存器使用8位时间定时器以及2个额外的8位寄存器可以数到16,777,215。我其实preFER此第二方法,但我大概是一个人在这:)

The 2nd way is using no prescaler but to set the MCU so that every time the counter overflows you increment some other register by 1, and every time that register overflows you increment another register by 1. Using the 8 bit timer and those 2 additional 8 bit registers you can count up to 16,777,215. I actually prefer this 2nd method but I am probably alone in this : )

此外樽和放大器;安迪·布朗是正确的关于STM32和微处理器的标签,U应删除它们。

Also Greybeard & Andy Brown are right about the stm32 and microprocessor tags, u should remove them.

这篇关于无计数和QUOT;计数器"微控制器是可能的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆