PIC32MZ tutorial -- Core Timer
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的更多相关文章
- PIC32MZ tutorial -- Watchdog Timer
Watchdog is a very necessary module for embedded system. Someone said that embedded system operates ...
- PIC32MZ tutorial -- 32-bit Timer
The microcontroller is PIC32MZ2048ECH144 on the PIC32MZ EC Starter Kit. This microcontroller has fou ...
- PIC32MZ tutorial -- OC Interrupt
In my previous blog "PIC32MZ tutorial -- Output Compare", I shows how to apply Output Comp ...
- PIC32MZ tutorial -- External Interrupt
In my older blog "PIC32MZ tutorial -- Key Debounce", I shows how to acheive key debounce w ...
- PIC32MZ tutorial -- Timer Interrupt
An interrupt is an internal or external event that requires quick attention from the controller. The ...
- PIC32MZ tutorial -- Output Compare
Output Compare is a powerful feature of embedded world. The PIC32 Output Compare module compares the ...
- PIC32MZ tutorial -- Input Capture
Today I accomplish a simple application for PIC32MZ EC Starter Kit. This application uses Input Capt ...
- PIC32MZ tutorial -- Change Notification
In my last post I implement "Key Debounce" with port polling, port polling is not very eff ...
- PIC32MZ tutorial -- Key Debounce
Today I accomplish a application on PIC32MZ EC Starter Kit. The feature of application is to light u ...
随机推荐
- setTimeout的使用与参数传递
在使用JavaScript的时候,我们有时需要间隔的执行一个方法,比如用来产生网页UI动画特效啥的.这是我们常常会使用方法setInterval或setTimeout,但是由于这两个方法是由脚 ...
- connections
recv(), recvfrom() http://lxr.free-electrons.com/source/net/socket.c http://grepcode.com/file/reposi ...
- phar文件的使用
1.用php命令行 php phar文件 2.生成bat文件,在命令行下使用,以composer.phar为例 ( 1)在php.exe所在目录新建composer.bat文件 (2)把compose ...
- 理解jquery的$.extend()、$.fn和$.fn.extend()
jQuery为开发插件提拱了两个方法,分别是: jQuery.fn.extend(); jQuery.extend(); jQuery.fn jQuery.fn = jQuery.prototype ...
- 用 windows GDI 实现软光栅化渲染器--gdi3d(开源)
尝试用windows GDI实现了一个简单的软光栅化渲染器,把OpenGL渲染管线实现了一遍,还是挺有收获的,搞清了以前一些似是而非的疑惑. ----更新2015-10-16代码已上传.gihub地址 ...
- 1.AutoMapper核心:扁平化
对象 - 对象映射的一个常见用法是获取一个复杂的对象模型,并将其展开成一个更简单的模型. 您可以采取复杂的模型,如: public class Order { private readonly ILi ...
- E 最熟悉的陌生人 (纪念当年就读的梅州市江南高级中学)
最熟悉的陌生人 作者:张慧桥 枪与玫瑰” 负责审讯的兄弟真是好样的,回来后的第四天上午就让黄志深那小子招了出来. 这可真的不容易! 现在公安部对我们审讯工作有很多的规定,其中一条就是不准刑讯逼供,就是 ...
- Log4net按照不同级别写入多个日志文件
[assembly: log4net.Config.XmlConfigurator(Watch = true)]//注入 在一个Web应用项目中,我使用了Fluent NHibernate作为数据访问 ...
- Random
/* * Random:产生随机数的类 * * 构造方法: * public Random():没有给种子,用的是默认种子,是当前时间的毫秒值 * public Random(long seed):给 ...
- OAF_文件系列6_实现OAF导出XML文件javax.xml.parsers/transformer(案例)
20150803 Created By BaoXinjian