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));
}

PIC32MZ tutorial -- Core Timer的更多相关文章

  1. PIC32MZ tutorial -- Watchdog Timer

    Watchdog is a very necessary module for embedded system. Someone said that embedded system operates ...

  2. PIC32MZ tutorial -- 32-bit Timer

    The microcontroller is PIC32MZ2048ECH144 on the PIC32MZ EC Starter Kit. This microcontroller has fou ...

  3. PIC32MZ tutorial -- OC Interrupt

    In my previous blog "PIC32MZ tutorial -- Output Compare", I shows how to apply Output Comp ...

  4. PIC32MZ tutorial -- External Interrupt

    In my older blog "PIC32MZ tutorial -- Key Debounce", I shows how to acheive key debounce w ...

  5. PIC32MZ tutorial -- Timer Interrupt

    An interrupt is an internal or external event that requires quick attention from the controller. The ...

  6. PIC32MZ tutorial -- Output Compare

    Output Compare is a powerful feature of embedded world. The PIC32 Output Compare module compares the ...

  7. PIC32MZ tutorial -- Input Capture

    Today I accomplish a simple application for PIC32MZ EC Starter Kit. This application uses Input Capt ...

  8. PIC32MZ tutorial -- Change Notification

    In my last post I implement "Key Debounce" with port polling, port polling is not very eff ...

  9. PIC32MZ tutorial -- Key Debounce

    Today I accomplish a application on PIC32MZ EC Starter Kit. The feature of application is to light u ...

随机推荐

  1. HTML 表格

    HTML 表格:表格由<table>标签来定义,行数由<tr>标签来定义,单元格由<td>标签来定义:<table border="1"& ...

  2. Python之路,day10-Python基础

    一.进程进程:一个程序要运行时所需的所有资源的集合 进程是资源的集合,相当于一个车间 一个进程至少需要一个线程,这个线程为主线程 一个进程里可以有多个线程 cpu cores越多,代表着你可以真正并发 ...

  3. python对象

    一: 基本概念 在pyhton中一切皆对象,就像类unix中的一切皆文件一样,恩,一切.把事物当作对象进行处理, 这样自然就成了面向对象的编程了. 所有的 Python 对像都拥有三个特性:身份,类型 ...

  4. Asp.net MVC 的八个扩展点

    http://www.cnblogs.com/richieyang/p/5180939.html MVC模型以低耦合.可重用.可维护性高等众多优点已逐渐代替了WebForm模型.能够灵活使用MVC提供 ...

  5. 关于eclipse保存代码很慢,提示the user operation is waiting的问题

    关于eclipse保存代码很慢,提示the user operation is waiting的问题 首先 去掉 project - build Automaticlly 然后 project-> ...

  6. 初转java随感(一)程序=数据结构+算法

    大学刚学编程的时候,有一句很经典的话程序=数据结构+算法 今天有了进一步认识. 场景: 1.当前局面 (1)有现成的封装好的分页组件 返回结果是page.类型为:Page.包括 page 分页信息,d ...

  7. An invalid character [32] was present in the Cookie value

    系统安装Tomcat版本为:tomcat8,登录时报错"An invalid character [32] was present in the Cookie value" 处理方 ...

  8. [zz] Principal Components Analysis (PCA) 主成分分析

    我理解PCA应该分为2个过程:1.求出降维矩阵:2.利用得到的降维矩阵,对数据/特征做降维. 这里分成了两篇博客,来做总结. http://matlabdatamining.blogspot.com/ ...

  9. C# HmacMD5 加密

    string HmacMD5(string source, string key) { HMACMD5 hmacmd = new HMACMD5(Encoding.Default.GetBytes(k ...

  10. 理解Condition的用法

    这个示例中BoundedBuffer是一个固定长度的集合,这个在其put操作时,如果发现长度已经达到最大长度,那么会等待notFull信号,如果得到notFull信号会像集合中添加元素,并发出notE ...