芯片解密|单片机解密|IC解密|芯片破解|芯片复制| PCB抄板|软件开发

飞芯科技-芯片解密|单片机解密|IC解密|芯片破解|芯片复制| PCB抄板|软件开发

单片机解密NXP_LPC1114延时函数集合

单片机解密#include "LPC11XX.h"
单片机解密#include "gpio.h"
单片机解密#include "timer16.h"

/*系统时钟配置为48MHz,AHB不分频,一次定时器时钟为48Mhz,因此得出以下分频值,匹配值*/
void Delay_Us(unsigned int DelayTimes)
{
/* * setup timer #1 for delay */

//LPC_SYSCON->SYSAHBCLKCTRL |= (1<<8);     /*开启定时器Timer16_1时钟--时钟配置中开启该时钟*/
  LPC_TMR16B1->TCR = 0x02;                 /* reset timer */
  LPC_TMR16B1->PR  = 48;                   /* set prescaler to zero 根据AHB时钟确定分频值*/
  LPC_TMR16B1->MR0 = DelayTimes;             /* 所需的延时时间 */
  LPC_TMR16B1->IR  = 0xff;                 /* reset all interrrupts 复位所有的中断*/
  LPC_TMR16B1->MCR = 0x04;                 /* stop timer on match --达到匹配停止*/
  LPC_TMR16B1->TCR = 0x01;                 /* start timer 启动定时器*/
  
while (LPC_TMR16B1->TCR & 0x01);           /*等待直到时间到*/
LPC_TMR16B1->TCR = 0x00;                 /* Close timer --关闭定时器*/
}
void Delay_Ms(unsigned int DelayTimes)
{
/* * setup timer #1 for delay */

//LPC_SYSCON->SYSAHBCLKCTRL |= (1<<8);       //开启定时器Timer16_1时钟
  LPC_TMR16B1->TCR = 0x02;                 /* reset timer */
  LPC_TMR16B1->PR  = 48000;                 /* set prescaler to zero */
  LPC_TMR16B1->MR0 = DelayTimes;
  LPC_TMR16B1->IR  = 0xff;                 /* reset all interrrupts */
  LPC_TMR16B1->MCR = 0x04;                 /* stop timer on match */
  LPC_TMR16B1->TCR = 0x01;                 /* start timer */
  
while (LPC_TMR16B1->TCR & 0x01);           /*等待直到时间到*/
LPC_TMR16B1->TCR = 0x00;                 /* Close timer */
}
void Delay_Sec(unsigned char DelayTimes)
{
/* * setup timer #1 for delay */

//LPC_SYSCON->SYSAHBCLKCTRL |= (1<<8);       //开启定时器Timer16_1时钟
  LPC_TMR16B1->TCR = 0x02;                 /* reset timer */
  LPC_TMR16B1->PR  = 48000000;             /* set prescaler to zero */
  LPC_TMR16B1->MR0 = DelayTimes;
  LPC_TMR16B1->IR  = 0xff;                 /* reset all interrrupts */
  LPC_TMR16B1->MCR = 0x04;                 /* stop timer on match */
  LPC_TMR16B1->TCR = 0x01;                 /* start timer */
  
while (LPC_TMR16B1->TCR & 0x01);           /*等待直到时间到*/
LPC_TMR16B1->TCR = 0x00;                 /* Close timer */
}



联系方式

地址:石家庄市新华区民族路77号华强广场D座2009
电话:0311-88816616/87087811
手机:13315190088
传真:0311-67901001
联系人:张工
网址:www.feixindz.com
邮箱:feixindz@163.com
微信:xinpianjiemi
QQ:527263666/568069805

在线客服
热线电话

企业微信