Core Timer is a very popular feature of PIC32 since it is a piece of the MIPS M4K core itself and is common to all MIPS processors. Most RTOS's timer are based on core timer. This timer has a fixed prescaler 1:2, and it is a 32-bit timer, no need to combine with two 16-bit timer like we do with other timers (Timer2 and Timer3 or Timer4 and Timer5). At this moment I only use core timer to implement time delay. To accomplish it, I write two functions: ReadCoreTimer() and CoreT_DelayMs().

  

unsigned int __attribute__((nomips16)) ReadCoreTimer(void)
{
unsigned int timer; // get the count reg
asm volatile("mfc0 %0, $9" : "=r"(timer)); return timer;
} void CoreT_DelayMs(unsigned int delayMs)
{
unsigned int delayStart; delayStart = ReadCoreTimer(); while ((ReadCoreTimer() - delayStart) < (delayMs * CORE_TIMER_MILLISECONDS));
}

最新文章

  1. windows下PHP与Apache的安装配置
  2. Emoji表情符号录入MySQL数据库报错的解决方案(MySQL utf8与utf8mb4区别)
  3. 使用注解实现IOC
  4. EF Code First教程-02 约定配置
  5. Leetcode--Add two number
  6. js面向对象(构造函数与继承)
  7. ExecutorService.execute(Runnable x) 判断是否完成,得到返回值
  8. CSS 之 @media
  9. 关于API,前后端分离
  10. js设置元素class方法小结及classList相关
  11. AngularJS学习之旅—AngularJS 事件(十四)
  12. 20165221 《网络对抗技术》EXP2:后门原理与实践
  13. OpenStack搭建Q版在控制节点上的环境准备(step2)
  14. 上传input中file文件到云端,并返回链接
  15. mac 安装 RabbitMQ
  16. Python day15装饰器基本理论,以及结合全局变量模拟session
  17. bootstrap导航条等样例持续更新》。。
  18. doc2vec使用笔记
  19. 转:苹果Xcode帮助文档阅读指南
  20. EOS Dapp开发(1)-基于Docker的开发环境搭建

热门文章

  1. 扩展 ASP.NET MVC 模型扩展 &ndash; ASP.NET MVC 4 系列
  2. case使用例子
  3. Head First设计模式之装饰者模式(Decorator Pattern)
  4. [2014.01.27]wfGifAnimator 动画GIF组件 3.0
  5. linux eclipse c++
  6. Java 和C/C++的“语法”上的差异!
  7. Can&#39;t connect to MySQL server on localhost (0)
  8. ruby生成随机成绩
  9. springmvc--json--返回json的日期格式问题
  10. NVMe over Fabrics又让RDMA技术火了一把