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. perl回文数解析,比C容易多了

    #!/usr/bin/perl -w ; @array = split "", shift @ARGV; ..($#array+1)/2-1]; @array_2 = revers ...

  2. 模型(Model)– ASP.NET MVC 4 系列

           为 MVC Music Store 建模        在 Models 目录中为专辑.艺术家.流派建模: public class Album { public virtual int ...

  3. 20160113 js中选择多个check一块删除

    js中<script type="text/javascript"> $(document).ready(function (e) { $("#Button2 ...

  4. tomcat集群

    apache整合tomcat部署集群 http://www.cnblogs.com/God-froest/p/apache_tomcat.html 今天看到"基于apache的tomcat负 ...

  5. Changing SID Server 2012

    Changing SID Server 2012  Windows Server > Windows Server 2012 General Question 0 Sign in to vote ...

  6. filesort是通过相应的排序算法

    filesort是通过相应的排序算法,将取得的数据在max_length_for_sort_data的默认值是1024. --------------------------------------- ...

  7. 浅入浅出“服务器推送”之一:Comet简介

    最近有个项目,其中有项需求要从服务器端主动向客户端推送数据,本以为很简单,但在实际做的过程中发现很棘手,并没有想象中的简单.从网上搜索学习,发现主流讲的还是Ajax的长轮询技术或者流技术,websoc ...

  8. [转]libevent简介和使用

    libevent是一个基于事件触发的网络库,memcached底层也是使用libevent库. 总体来说,libevent有下面一些特点和优势:* 事件驱动,高性能:* 轻量级,专注于网络: * 跨平 ...

  9. oracle for循环查找结果

    -- Call the procedure begin ' ) loop dbms_output.put_line('v_rlt = '||v_rlt.ID||v_rlt.inspection_no) ...

  10. Memcached 数据缓存系统

    Memcached 数据缓存系统 常用命令及使用:http://www.cnblogs.com/wayne173/p/5652034.html Memcached是一个自由开源的,高性能,分布式内存对 ...