示例#1
0
//--------------------------------------------------------------------------------
//
//  Main program loop.
//
void main()
{
    __disable_interrupt();
    _pulseDataAddress = (char *) EEPROM_PULSE_DATA;
    _numberOfPulses = *_pulseDataAddress++;
    SetupPorts();
    SetupUART();
    SetupTimer2();
    SetupTimer1();
    __enable_interrupt();
    while (1)
    {
        __wait_for_interrupt();
    }
}
示例#2
0
文件: port.c 项目: HclX/freertos
	static void prvSleep( TickType_t xExpectedIdleTime )
	{
		/* Allow the application to define some pre-sleep processing. */
		configPRE_SLEEP_PROCESSING( xExpectedIdleTime );

		/* xExpectedIdleTime being set to 0 by configPRE_SLEEP_PROCESSING()
		means the application defined code has already executed the WAIT
		instruction. */
		if( xExpectedIdleTime > 0 )
		{
			__wait_for_interrupt();
		}

		/* Allow the application to define some post sleep processing. */
		configPOST_SLEEP_PROCESSING( xExpectedIdleTime );
	}
示例#3
0
文件: delay.c 项目: dimka-rs/stm8-iar
void Delayus(unsigned int usec){
  CLK_PCKENR1 = CLK_PCKENR1 | (1 << 5); //bit 5 - timer2 clock
  TIM2_CR1_bit.OPM = 1; //one pulse mode
  //TIM2_CR1_bit.URS = 1; //only hw causes UEV
  TIM2_IER_bit.CC1IE = 1; //enable interrupt on compare 1
  TIM2_CCR1H = usec/256; //load high byte
  TIM2_CCR1L = usec%256; //load low byte
  TIM2_CNTRH = 0; // reset counter
  TIM2_CNTRL = 0; // reset counter
  TIM2_SR1_bit.CC2IF = 0; //clear CC2 interrupt flag
  TIM2_PSCR = 0x04; // Divide by 2^4 to get 1MHz clock
  TIM2_EGR_bit.UG = 1; //generate UEV to update actual prescaler
  ITC_SPR4 = ITC_SPR4 | 0x30; //IRQ14 Vector14 is TIM2 cc int priority   ///???
  TIM2_CR1_bit.CEN = 1; //start timer
  __enable_interrupt();
  __wait_for_interrupt();
}