[51单片机] rtx51tiny里面一个任务执行多长时间?

[复制链接]
1691|4
 楼主| From_the_UESTC 发表于 2014-3-5 23:03 | 显示全部楼层 |阅读模式
; ; define Hardware-Timer Overflow in 8051 machine cycles.
INT_CLOCK EQU 10000 ; default is 10000 cycles
;
; ; define Round-Robin Timeout in Hardware-Timer Ticks.
TIMESHARING EQU 5 ; default is 5 ticks.
这是从使用手册上摘录下来的,貌似是50ms,那么下面这个任务所实现的led闪烁周期似应为2s。
void ledtask2(void)_task_ 2
{
while(1)
{
  P1_1=~P1_1;
  os_wait(K_TMO,20,0);
}

}
但是我做实验发现貌似只有1s,怎么回事?
ayb_ice 发表于 2014-3-6 09:40 | 显示全部楼层
20*50MS=1S

有什么问题呢
 楼主| From_the_UESTC 发表于 2014-3-6 10:33 | 显示全部楼层
ayb_ice 发表于 2014-3-6 09:40
20*50MS=1S

有什么问题呢

这样的话p1.1接的led闪烁周期不是应该是2秒吗?怎么我把程序下载到板子上周期却是0.5秒的样子。
 楼主| From_the_UESTC 发表于 2014-3-6 10:42 | 显示全部楼层
ayb_ice 发表于 2014-3-6 09:40
20*50MS=1S

有什么问题呢

谢谢回答,不过看了这篇**后我貌似明白了。
http://blog.tianya.cn/blogger/post_read.asp?BlogID=3685130&PostID=33067339
ayb_ice 发表于 2014-3-6 11:08 | 显示全部楼层
我错了,应该是
20*10MS=200MS

前提是机器周期是1US
您需要登录后才可以回帖 登录 | 注册

本版积分规则

29

主题

216

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部