回复:定时器的疑问!

Corben_Nil

  • 帖子

    86
  • 精华

    0
  • 被关注

    0

论坛等级:游民

注册时间:2003-08-28

普通 普通 如何晋级?

发布于 2003-11-04 16:05:31

0楼

事实上你理解错了(也有可能书翻错了)。
10 millisecond Resolution
The 10-ms timers count the number of 10-ms timer intervals that have elapsed since the active 10-ms timer was enabled. The execution of the timer instruction starts the timing; however the 10-ms timers are updated at the beginning of each scan cycle (in other words, the timer current and timer bit remain constant throughout the scan), by adding the accumulated number of 10-ms intervals (since the beginning of the previous scan) to the current value for the active timer.

Since the timer can be started anywhere within a 10-ms interval, the preset must be set to one time interval greater than the minimum desired timer interval. For example, to guarantee a timed interval of at least 140 ms using a 10-ms timer, the preset time value should be set to 15.
上面说的是,由于10ms计时器可能从头一个10ms周期内的任意时候开始计数(10ms周期是由系统底层提供),因此,你得到的时间精度误差总是在0~-10ms,无论你计多长时间。
所以,你如用10ms计时器计20ms,误差会很大。你可以用1ms的计时器,精度-1ms
毛主席教导我们:Good Good Study, Day Day Up!
评论
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC S7-200

共有33289条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

快扫描右侧二维码晒一晒吧!

再发帖或跟帖交流2条,就能晋升VIP啦!开启更多专属权限!

  • 分享

  • 只看
    楼主

top
X 图片
您收到0封站内信:
×
×
信息提示
很抱歉!您所访问的页面不存在,或网址发生了变化,请稍后再试。