• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ OpenTimer1函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中OpenTimer1函数的典型用法代码示例。如果您正苦于以下问题:C++ OpenTimer1函数的具体用法?C++ OpenTimer1怎么用?C++ OpenTimer1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了OpenTimer1函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: prepareForSensorRead

void prepareForSensorRead(void)
{
    //OpenSPI(SPI_FOSC_64, MODE_00, SMPEND);

    //Initialisation des ports de sélection des capteurs
    LATA |= 0x3F; // Waiting state is high
    ADCON1 |= 0x0F;
    TRISA &= 0xC0; // Ports en sortie

    DATA_DIRECTION = 1; // Data in
    CLOCK_PORT = 1;
    CLOCK_DIRECTION = 0; // RB1 en sortie

    OpenTimer1(     TIMER_INT_OFF
                &   T1_16BIT_RW
                &   T1_SOURCE_INT
                &   T1_PS_1_2
                &   T1_OSC1EN_OFF
                &   T1_SYNC_EXT_OFF); // Used to measure time between measurements

    IPR1bits.TMR2IP = 0;

    OpenTimer2(     TIMER_INT_ON
                &   T2_PS_1_16
                &   T2_POST_1_16);   // Used to specify time between measurements

    isSensorReadReady = TRUE;

    //shouldUpdateSensors = TRUE;
}
开发者ID:QuentinFiard,项目名称:PSC-Aile-de-Traction---Electronique,代码行数:30,代码来源:Capteurs.c


示例2: ServoInitFunc

void ServoInitFunc(void) {
    servo(0);

    ConfigIntTimer1(T1_INT_PRIOR_1 & T1_INT_ON);
    //1msec(4/80Mhz×1×200=0.01msec)
    OpenTimer1(T1_ON & T1_GATE_OFF & T1_PS_1_1 & T1_SYNC_EXT_OFF & T1_SOURCE_INT,200-1);
}
开发者ID:RoboticsDevelopmentProjects,项目名称:spp-base-library,代码行数:7,代码来源:maekawa.c


示例3: prvSetupTimerInterrupt

/*
 * Setup a timer for a regular tick.
 */
void prvSetupTimerInterrupt( void )
{
const unsigned long ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PRESCALE) / configTICK_RATE_HZ ) - 1;

	OpenTimer1( ( T1_ON | T1_PS_1_8 | T1_SOURCE_INT ), ulCompareMatch );
	ConfigIntTimer1( T1_INT_ON | configKERNEL_INTERRUPT_PRIORITY );
}
开发者ID:bnahill,项目名称:tsunami,代码行数:10,代码来源:port.c


示例4: configureRange

/*! **********************************************************************
 * Function: configureRange(void)
 *
 * Include: Range.h
 *
 * Description: Configures the Range module
 *
 * Arguments: None
 *
 * Returns: None
 *************************************************************************/
void configureRange(void)
{
    unsigned char config;

    INIT_PIN = 0;

    //Enable global interrupts and interrupt priority
    INT_SETUP()

    readTemp();

    //Make sure the AD is configured
    configureAD();

    CCP1_INPT = 1;
    INIT_TRIS = 0;  //Make the INIT

    //Open  Timer
    config = T1_16BIT_RW & T1_SOURCE_INT & T1_OSC1EN_OFF & T1_PS_1_1 & T1_SYNC_EXT_OFF &TIMER_INT_ON;
    OpenTimer1(config);

    config = CAPTURE_INT_ON & CAP_EVERY_RISE_EDGE;

    //CloseCapture1, which will clear any interrupt flags etc
    CloseCapture1();

    //Open the input capture on compare1
    OpenCapture1(config);
}
开发者ID:MTRX3700Dirac,项目名称:Yavin4DefenceSystem,代码行数:40,代码来源:Range.c


示例5: PmodHB5_INIT

void PmodHB5_INIT(UART_MODULE uartID)
{
	PORTSetPinsDigitalOut(IOPORT_D, BIT_7); //HB5 Direction
	PORTSetPinsDigitalOut(IOPORT_D, BIT_1); //HB5 Enable
	PORTSetPinsDigitalIn(IOPORT_D, BIT_9);  //HB5 Sensor A
	PORTSetPinsDigitalIn(IOPORT_C, BIT_1);  //HB5 Sensor B

	hBridge.sensorAport = IOPORT_D;
	hBridge.sensorAportBit = BIT_9;
	hBridge.sensorBport = IOPORT_C;
	hBridge.sensorBportBit = BIT_1;
	hBridge.directionPort = IOPORT_D;
	hBridge.directionPortBit = BIT_7;
	hBridge.currentDirection = PMOD_HB5_DIR_CW;
	hBridge.newDirection = PMOD_HB5_DIR_CW;
	hBridge.ocChannel = 2;
	

    OpenOC2(OC_ON | OC_TIMER2_SRC | OC_PWM_FAULT_PIN_DISABLE, 0, 0);
    OpenTimer2(T2_ON | T2_PS_1_256, SYSTEM_CLOCK/PB_DIV/PRESCALE/(TOGGLES_PER_SEC/2));
    
	OpenTimer1(T1_ON | T1_SOURCE_INT | T1_PS_1_256, T1_TICK);
    ConfigIntTimer1(T1_INT_ON | T1_INT_PRIOR_2);
	INTEnableSystemMultiVectoredInt();
	
	UARTPutS("\r\nPmodHB5 init complete\r\n",uartID);

}
开发者ID:duttondj,项目名称:Digilent-PMOD-driver-libraries,代码行数:28,代码来源:pmodhb5_test_driver.c


示例6: InitApp

/* App initialisation
 * init ADC
 * init timer 1
 * init interrupts
 */
void InitApp(void)
{
    cur_State = LIPO_ALGO_STARTED;
    strncpy(battery.battery_type,"LIPO\0",5);
    battery.charge.restore_Lowest_Voltage = 5;
    battery.number_of_cells = 1;
    battery.charge.restore_Charge_Current = 0.5;
    seconds = 0;

    OpenADC( ADC_FOSC_64 & ADC_RIGHT_JUST & ADC_6_TAD,
            ADC_CH0 & ADC_INT_OFF & ADC_REF_VDD_VSS,
            ADC_1ANA );
    /* open timers */
    OpenTimer1( TIMER_INT_ON &
                T1_8BIT_RW &
                T1_SOURCE_EXT &
                T1_PS_1_1 &
                T1_OSC1EN_ON &
                T1_SYNC_EXT_OFF );

    //ei();

    USBDeviceInit();            //usb_device.c
    #if defined(USB_INTERRUPT)
      USBDeviceAttach();        //usb_device.c
    #endif

    /* TODO init PI structure */
    PI.Ki = 2;
    PI.Kp = 35;
    /* TODO init analog port */
}
开发者ID:nabillo,项目名称:Chargeur,代码行数:37,代码来源:user.c


示例7: rt_hw_board_init

/**
* This function will initial board.
 */
void rt_hw_board_init()
{
    // Configure the device for maximum performance, but do not change the PBDIV clock divisor.
	// Given the options, this function will change the program Flash wait states,
	// RAM wait state and enable prefetch cache, but will not change the PBDIV.
    // The PBDIV value is already set via the pragma FPBDIV option above.
   	SYSTEMConfig(SYS_FREQ, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE);

   	/* use DBPRINTF */
   	/* rt_hw_console_init(); */

	rt_hw_usart_init();
	rt_console_set_device("uart1");

   	rt_hw_show_info();

    // enable multi-vector interrupts
    INTEnableSystemMultiVectoredInt();
    rt_hw_interrupt_disable();

//    // STEP 2. configure the core timer
//    OpenCoreTimer(CORE_TICK_RATE);
//
//    // set up the core timer interrupt with a prioirty of 2 and zero sub-priority
//    mConfigIntCoreTimer((CT_INT_ON | CT_INT_PRIOR_2 | CT_INT_SUB_PRIOR_0));

    // STEP 2. configure Timer 1 using internal clock, 1:256 prescale
    OpenTimer1(T1_ON | T1_SOURCE_INT | T1_PS_1_256, T1_TICK);
    // set up the timer interrupt with a priority of 2
    ConfigIntTimer1(T1_INT_ON | T1_INT_PRIOR_2);

    /* Setup the software interrupt. */
	mConfigIntCoreSW0( CSW_INT_ON | CSW_INT_PRIOR_1 | CSW_INT_SUB_PRIOR_0 );
}
开发者ID:304471720,项目名称:rt-thread,代码行数:37,代码来源:board.c


示例8: init_core

void init_core(void)
{
	// === Timer und Capture/Compare-Einheit ===

	// 10 MHz Oszillatortakt -> 40 MHz Systemtakt -> 10 MHz Instruktionstakt
	
	// 10 MHz Instruktionstakt / 16 Prescaler -> 1,6 µs Timertaktlänge, daher theoretisch alle 65536
	// Timertakte = 104,8ms ein Timerüberlauf
	OpenTimer0(TIMER_INT_ON & T0_16BIT & T0_SOURCE_INT & T0_PS_1_16);
	
	// 10 MHz Instruktionstakt / 8 Prescaler -> 0,8 µs Timertaktlänge
	OpenTimer1(T1_16BIT_RW & TIMER_INT_OFF & T1_PS_1_8 & T1_SYNC_EXT_ON & T1_SOURCE_CCP & T1_SOURCE_INT);
	OpenCapture1(CAPTURE_INT_ON & C1_EVERY_FALL_EDGE);
	
//	TxQ.Head = TxQ.Tail = RxCheckSum = 0;
	
	INTCONbits.PEIE = true;	// Wofür ist das?
	// INTCONbits.TMR0IE = true;

	// === Fernbedienungsdecoder ===

	raw_rc_data[0] = 0xDEADBEEF;
	current_rc_frame_ok = false;
	new_rc_values_available = false;

}
开发者ID:Orksokopter,项目名称:firmware,代码行数:26,代码来源:core.c


示例9: __ISR

/* Specify Interrupt Priority Level = 2 */
void __ISR(_TIMER_1_VECTOR, IPL2) _Timer1Handler(void) {

    mT1ClearIntFlag();
    if(bitIndex == 0)
    {
        
        OpenTimer1(T1_ON | T1_SOURCE_INT | T1_PS_1_1, (getEtu()/5));
        write(PIN_IO);
        bitIndex++;
    }
    else if(bitIndex == 39)
    {
        write(PIN_IO);
        bitIndex++;
        setFlag();
    }
    else if(bitIndex == 40)
    {
        bitIndex =0;
        ConfigINT2(EXT_INT_ENABLE | FALLING_EDGE_INT | EXT_INT_PRI_1);
        ConfigIntTimer1(T1_INT_OFF);
    }
    else
    {
        write(PIN_IO);
        bitIndex++;
    }
}
开发者ID:12019,项目名称:smartcard_spy,代码行数:29,代码来源:interrupts.c


示例10: timerStart

extern void timerStart(timer * pTimer, const timerCalc * pTimerCalc)
{
  pTimer->m_TimerCalc = *pTimerCalc;

  const uint16_t        PrescalerBits = pTimer->m_TimerCalc.PrescalerBits;
  const uint16_t        PriorityBits  = pTimer->m_TimerCalc.PriorityBits;
  const uint16_t        Ticks         = pTimer->m_TimerCalc.Ticks;
  const timer_tCallback pCallback     = pTimer->m_pCallback;

  pTimer->m_OverflowCount = pTimer->m_TimerCalc.OverflowCount;

  switch (pTimer->m_TimerNumber) {
    case 1: 
      OpenTimer1(T1_ON | T1_SOURCE_INT | PrescalerBits, Ticks);
      ConfigIntTimer1((pCallback == NULL ? T1_INT_OFF : T1_INT_ON) | PriorityBits);
      break;
    case 2: 
      OpenTimer2(T2_ON | T2_SOURCE_INT | PrescalerBits, Ticks);
      ConfigIntTimer2((pCallback == NULL ? T2_INT_OFF : T2_INT_ON) | PriorityBits);
      break;
    case 3: 
      OpenTimer3(T3_ON | T3_SOURCE_INT | PrescalerBits, Ticks);
      ConfigIntTimer3((pCallback == NULL ? T3_INT_OFF : T3_INT_ON) | PriorityBits);
      break;
    case 4: 
      OpenTimer4(T4_ON | T4_SOURCE_INT | PrescalerBits, Ticks);
      ConfigIntTimer4((pCallback == NULL ? T4_INT_OFF : T4_INT_ON) | PriorityBits);
      break;
    case 5: 
      OpenTimer5(T5_ON | T5_SOURCE_INT | PrescalerBits, Ticks);
      ConfigIntTimer5((pCallback == NULL ? T5_INT_OFF : T5_INT_ON) | PriorityBits);
      break;
  }
}
开发者ID:tmitchell,项目名称:oosmos,代码行数:34,代码来源:timer.c


示例11: main

int main(void)
{
  uint16_t i;
  FRESULT rc;

  map_io();
  init_port();

  InitRTCC();

  uart2_init();
  xdev_out(uart2_put);
  xdev_in(uart2_get);

  dbg_printf("$" PROJECT_NAME "\n");
  dbg_printf("$" __DATE__ " " __TIME__ "\n");

  rc = f_mount(&fatfs, "", 1);
  dbg_printf("$FF,f_mount,%s\n", get_rc(rc));

  OpenTimer1(T1_PS_1_256 & T1_GATE_OFF & T1_SOURCE_INT & T1_IDLE_CON &
    T1_ON & T1_SYNC_EXT_OFF, 0xFFFF);
  ConfigIntTimer1(T1_INT_ON & T1_INT_PRIOR_1);
  OpenCapture1(IC_IDLE_STOP & IC_TIMER1_SRC & IC_INT_1CAPTURE & IC_EVERY_RISE_EDGE,
    IC_CASCADE_DISABLE & IC_TRIGGER_ENABLE & IC_UNTRIGGER_TIMER & IC_SYNC_TRIG_IN_DISABLE);
  ConfigIntCapture1(IC_INT_ON & IC_INT_PRIOR_5);
  _IC1IF = 0;
  

  while (1) {
    while (_RTCSYNC == 0);
    while (_RTCSYNC == 1);
    if (gps_pr > 0) {
      _T1IE = 0;
      float f = (float) TMR1 / gps_pr;
      _T1IE = 1;
      xprintf("%u\n", (uint16_t) (f * 1000));
    }
    if (ngpslines > 0) {
      ngpslines--;
      if (xgets(gps_line, 128)) {
        xprintf("$GPS%s\n", gps_line);
      }
    }
  }

  while (0) {
    while (_RTCSYNC == 0);
    while (_RTCSYNC == 1);
    if (gps_pr > 0) {
      _T1IE = 0;
      float f = (float) TMR1 / gps_pr;
      _T1IE = 1;
      xprintf("%u\n", (uint16_t) (f * 1000));
    }
  }

  return (EXIT_SUCCESS);
}
开发者ID:Ensase,项目名称:FatUARTloggerGPS.X,代码行数:59,代码来源:main.c


示例12: delayus

void delayus(unsigned t) {
    OpenTimer1(T1_ON | T1_PS_1_256, 0xFFFF);
    while (t--) { // t x 1ms loop
        WriteTimer1(0);
        while (ReadTimer1() < SYS_FREQ / 256 / 1000000);
    }
    CloseTimer1();
}// Delayus
开发者ID:BaliSolutions,项目名称:gibbot,代码行数:8,代码来源:NU32v2.c


示例13: SetupTimer1

void SetupTimer1(void)
{
    unsigned int T1CON1value, T1PERvalue;
    T1CON1value = T1_ON & T1_SOURCE_INT & T1_PS_1_8 & T1_GATE_OFF &
                  T1_SYNC_EXT_OFF;
    T1PERvalue = 0x01F4; //clock period = 0.0001s = ((T1PERvalue * prescaler)/FCY) (100Hz)
    OpenTimer1(T1CON1value, T1PERvalue);	
}
开发者ID:apullin,项目名称:basestation,代码行数:8,代码来源:init.c


示例14: __attribute__

// 100 us minimum for acuracy
void inline __attribute__((always_inline)) timer1_delay_us(unsigned int us)
{
    counter = (int)(us * 0.022);
    OpenTimer1(T1_ON | T1_SOURCE_INT | T1_PS_1_1, 50); // micro second interrupts
    while(counter < us);
    T1CONCLR = BIT_15; // stop the tomer
    TMR1 = 0x0;
}
开发者ID:tylerjw,项目名称:TimerDemo.X,代码行数:9,代码来源:timer1.c


示例15: InitTMR1

void InitTMR1(void)
{
    /* config: T1_OFF & T1_IDLE_CON & T1_SOURCE_INT & T1_PS_1_64 */
    // Interrupt period = 0.005 sec with a 64 prescaler
    OpenTimer1(T1_OFF & T2_GATE_OFF & T1_IDLE_CON & T1_PS_1_64 & T1_SOURCE_INT,3124);
    ConfigIntTimer1(T1_INT_PRIOR_6 & T1_INT_ON);
    T1CONbits.TON = 1; // Turn on timer 1
    return;
}
开发者ID:roussePaul,项目名称:AsservMotor.X,代码行数:9,代码来源:Timers.c


示例16: SetupTimer1

// timer 1 is used for main pid motor control loop
void SetupTimer1(void)
{
    unsigned int T1CON1value, T1PERvalue;
    T1CON1value = T1_ON & T1_SOURCE_INT & T1_PS_1_8 & T1_GATE_OFF &
                  T1_SYNC_EXT_OFF & T1_INT_PRIOR_7;
    T1PERvalue = 0x03E8; //clock period = 0.0002s = ((T1PERvalue * prescaler)/FCY) (5000Hz)
  	t1_ticks = 0;
    OpenTimer1(T1CON1value, T1PERvalue);
}
开发者ID:rqou,项目名称:imageproc-exynos,代码行数:10,代码来源:init.c


示例17: TIMERS_Init

/****************************************************************************
 Function
     TIMERS_Init

 Parameters
    none

 Returns
     None.

 Description
     Initializes the timer module
 Notes
     None.

 Author
     Max Dunne, 2011.11.15
 ****************************************************************************/
void TIMERS_Init(void) {
    TimerActiveFlags = 0;
    TimerEventFlags = 0;
    FreeRunningTimer = 0;
    OpenTimer1(T1_ON | T1_SOURCE_INT | T1_PS_1_1, F_PB / TIMER_FREQUENCY);
    ConfigIntTimer1(T1_INT_ON | T1_INT_PRIOR_3);

    mT1IntEnable(1);
}
开发者ID:BananaSlug,项目名称:24_hour_bot_2013,代码行数:27,代码来源:timers.c


示例18: initSpecialEventTrigger

/******************************************************************************
 * Function:        void initSpecialEventTrigger(void)
 *
 * PreCondition:    None
 * Input:           None
 * Output:          None
 * Side Effects:    None
 *
 * Overview:    The special event trigger is used for automatic ADC
 *
 * Note:        NYI ;-)
 *
 *****************************************************************************/
void initSpecialEventTrigger(void)
{
    OpenTimer1(TIMER_INT_OFF & T1_16BIT_RW & T1_SOURCE_INT &
            T1_PS_1_8 & T1_OSC1EN_OFF & T1_SYNC_EXT_OFF);
    T1CONbits.TMR1ON = 0;
//    mCCPTIMER_STOP()
    T3CONbits.T3CCP1 = 0;       // Timer1 is the clock source for compare ECCP1
    CCPR1 = 60000;              // 12M (clk) / 8 (TMR1 Prescaler)    -> 25Hz
    CCP1CONbits.CCP1M = 0b1011; // Compare Mode with Special Event Trigger
}
开发者ID:francoa,项目名称:HIDProj,代码行数:23,代码来源:lpcudk_14K50.c


示例19: delayms

void delayms(unsigned t)
// This uses Timer 1, can be changed to another timer.
{
    OpenTimer1(T1_ON | T1_PS_1_256, 0xFFFF);
    while (t--) { // t x 1ms loop
        WriteTimer1(0);
        while (ReadTimer1() < SYS_FREQ / 256 / 1000);
    }
    CloseTimer1();
} // Delayms
开发者ID:BaliSolutions,项目名称:gibbot,代码行数:10,代码来源:NU32v2.c


示例20: startTimer1

void startTimer1()
{
	// Setup the timer with a 1:1 prescaler with 16 bits resolution
	// Therefore the timer0 freq is 500 kHz / 4 / 4 = 31.250 kHz
	OpenTimer1( TIMER_INT_ON & T0_16BIT & T0_SOURCE_INT & T0_PS_1_4 );
	// Should take a little over 2 seconds to overflow the counter from TMR0 = 0
	// If you write in a different starting value for TMR0 it'll overflow sooner

	WriteTimer1(0);
	PIR1bits.TMR1IF = 0;  
}	
开发者ID:geislekj,项目名称:Plant-Sustainability-Device,代码行数:11,代码来源:main.c



注:本文中的OpenTimer1函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ OpenUnderlyingLayer函数代码示例发布时间:2022-05-30
下一篇:
C++ OpenThreadToken函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap