当前位置: 首页>>代码示例>>C++>>正文


C++ DelayUs函数代码示例

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


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

示例1: CCD_GetImage

//======================================================================
//函 数 名:     CCD_GetImage()                      
//入口参数:     无             
//返回值  :     无
//函数功能:     CCD驱动以及采样                                                  
//======================================================================
void CCD_GetImage(uint32_t ADCx) 
{
	unsigned char i;
    
    SI_1;  //SI端口置1
    CK_1;  //CK端口置1
    SI_0;  //SI端口置0
	
		
    for (i = 0; i < COL; i++) {
    //延时决定了CCD中的电容器积累的电荷量,同时决定了其是否达到饱和状态或足以采集黑线的状态
    //但是时间过长采集周期会变长,所以请使用蓝宙线性CCD上位机,根据实际图像效果调整延时. 
       CK_0;
                                    
       DelayUs(100);                 
                     
       IMAGE[i] =ADC_GetConversionValue(ADCx); 
        
       CK_1;
       DelayUs(100); 
    }
   
    CK_0;
	DelayUs(50); 
}
开发者ID:duduool,项目名称:smartcar_fx,代码行数:31,代码来源:ccd.c

示例2: reproduce_tono_whilePulsado

void reproduce_tono_whilePulsado(void){
	int contador;
	if((PORTA & 0b00010000) != 0){
		while(PORTB != 0xFF){
			RA0 = ~RA0;
			DelayUs(807);
		}
	}

	if((PORTA & 0b00001000) != 0){
		while(PORTB != 0xFF){
			RA0 = ~RA0;
			DelayUs(1136);
		}
	}

	if((PORTA & 0b00000100) != 0){
		while(PORTB != 0xFF){
			RA0 = ~RA0;
			DelayUs(1517);
		}
	}

	if((PORTA & 0b00000010) != 0){
		while(PORTB != 0xFF){
			RA0 = ~RA0;
			DelayUs(2273);
		}
	}
}
开发者ID:Palantir555,项目名称:Simon,代码行数:30,代码来源:main.c

示例3: Rk618CodecReset

static int Rk618CodecReset(RK618_DEVICE_CLASS *dev)
{
	int i;
	int change;
	unsigned int old, newVal;
	int ret;

	Codec618CmdWrite(dev, RK618_RESET, 0xfc);
	DelayUs(10);
	Codec618CmdWrite(dev, RK618_RESET, 0x43);
	DelayUs(10);

	for (i = 0; i < RK618_MFD_REG_LEN; i++)
		Codec618CmdWrite(dev, rk618_mfd_reg_defaults[i].reg,
			rk618_mfd_reg_defaults[i].value);

	memcpy(g_rk618_reg_cache, rk618_reg_defaults,
	       sizeof(rk618_reg_defaults));

	//close charge pump
	Codec618CmdWrite(dev, RK618_CLK_CHPUMP, 0x41);

	//bypass zero-crossing detection
	Codec618CmdWrite(dev, RK618_SINGNAL_ZC_CTL1, 0x3f);
	Codec618CmdWrite(dev, RK618_SINGNAL_ZC_CTL2, 0xff);

	//set ADC Power for MICBIAS
	//set ADC Power for MICBIAS
	Codec618CmdUpdataBits(dev, RK618_PWR_ADD1,
		RK618_ADC_PWRD, 0);

	return 0;
}
开发者ID:wjw890912,项目名称:RK_NanoD_WIFI_demo,代码行数:33,代码来源:RK618Device.c

示例4: DelayMs

void
DelayMs(unsigned char cnt)
{
#if	XTAL_FREQ <= 2MHZ
	do {
		DelayUs(996);
	} while(--cnt);
#endif

#if XTAL_FREQ >16MHZ
	unsigned char	i;
	do {
		i = 100;
		do {
			DelayUs(10);
		} while(--i);
	} while(--cnt);
#else
 #if    XTAL_FREQ > 2MHZ
 	unsigned char	i;
 	do {
 		i = 4;
 		do {
 			DelayUs(250);
 		} while(--i);
 	} while(--cnt);
 #endif
#endif
}
开发者ID:AD7ZJ,项目名称:PVTracker,代码行数:29,代码来源:delay.c

示例5: reproduce_tono

void reproduce_tono(void){
	int contador;
	//led verde -> 620Hz -> T=1614 us ->T/2=807 us -> 620 cycles
	if((PORTA & 0b00010000) != 0){
		for(contador=0; contador<620; contador++){
			RA0 = ~RA0;
			DelayUs(807);
		}
	}
	//led rojo ---> 440Hz --> T=2273 us --> T/2 = 1136 us --> 440cycles
	if((PORTA & 0b00001000) != 0){
			for(contador=0; contador<440; contador++){
			RA0 = ~RA0;
			DelayUs(1136);
		}
	}
	//led rojo ---> 329,628Hz --> T=3034 us --> T/2 = 1517 us --> 330cycles
	if((PORTA & 0b00000100) != 0){
			for(contador=0; contador<400; contador++){
			RA0 = ~RA0;
			DelayUs(1517);
		}
	}
	//led rojo ---> 220Hz --> T=4545 us --> T/2 = 2273 us --> 220cycles
	if((PORTA & 0b00000010) != 0){
			for(contador=0; contador<400; contador++){
			RA0 = ~RA0;
			DelayUs(2273);
		}
	}
}
开发者ID:Palantir555,项目名称:Simon,代码行数:31,代码来源:main.c

示例6: OWReset

// resetta il bus 1-wire e rileva la presenza di dispositivi
unsigned char OWReset(void)
	{
    unsigned char ow_detect; // variabile usata per rilevare la presenza di dispositivi 1wire
    TRIS_DQ=1; // avvio con linea in alta impedenza
    DQ=0; // predispongo uscita bassa
    TRIS_DQ=0; // linea in uscita
    // linea a livello basso per 500uS
	// nota: la linea deve essere tenuta a livello basso
	// minimo 480uS
	DelayUs(250);
    DelayUs(250);
	TRIS_DQ=1;  // linea in alta impedenza
    // dopo che la linea è stata posta in alta impedenza
	// bisogna attendere dai 15 ai 60uS per una risposta
	DelayUs(100); // attendo 100uS per stare tranquillo
    ow_detect=DQ; // rilevo in che stato si trova la linea
	// l'impulso di presenza dura dai 60 ai 240uS
	// attendo 430uS dopo l'impulso di presenza
	DelayUs(230);
    DelayUs(200);
	// restituisco il valore ottenuto:
	// 0 = ci sono dispositivi (OW_PRESENCE)
	// 1 = non ci sono dispositivi (OW_NO_PRESENCE)
	return ow_detect;
    }
开发者ID:ahmed8518,项目名称:my-prototipo,代码行数:26,代码来源:one-wire.c

示例7: WTV_Voice

void WTV_Voice(u8 addr)
{     
	char i;
      	WTV_RST_L;//rst=0;	
	//delay_ms(5);//wait_5ms( ); // 5ms  
	DelayMs(5 );
	WTV_RST_H;//rst=1;
	//delay_ms(8);//wait_8ms( ); //8ms 
	DelayMs(8 );
	WTV_CS_L;//cs=0;
	//delay_ms(5);//wait_5ms( ); // 5ms 
	DelayMs(5 );
	for(i=0;i<8;i++)
	{
		//_CLI();//TR0=0;
		WTV_CLK_L;//scl=0;
		if(addr & 0x01)
		{
			WTV_DATA_H;//sda=1;
		}
		else
		WTV_DATA_L;//sda=0;
		addr>>=1;
		//delay_us(150);//wait_150us( ); // 300us 
		DelayUs(150 );
		WTV_CLK_H;//scl=1;
		//delay_us(150);//wait_150us( );
		DelayUs(150 );
	}
	WTV_CS_H;//cs=1;
	//_SEI();//TR0=1
 }
开发者ID:loveywm,项目名称:HB-SC-001,代码行数:32,代码来源:Voice.c

示例8: DAC_TransmitByte

bool DAC_TransmitByte(int data)  { 
  LD_Set;
  int i; 
  if (data > 4096) 
    return 0; 
  for(i = 12; i > 0; i--){ 
    if (data & 0x800) { 
      SDI_Set;    // When 1 is transfered SDI is high 
    } 
    else  { 
      SDI_Clear;  // else is low 
    } 
    data <<= 1; 
    DelayUs(1); 
    CLK_Clear; 
    DelayUs(1); 
    CLK_Set; 
    DelayUs(1); 
  }
  CS_Set;   // Deselect chip 
  DelayUs(10); 
  LD_Clear; // End of transfer, shift temp register to output 
  DelayUs(10); 
  LD_Set; // End of transfer, shift temp register to output 
  return 1;
}
开发者ID:konradwyr,项目名称:Identyfikacja-online,代码行数:26,代码来源:DAC.c

示例9: main

int main(void)
{
	DelayInit();
	lcd16x2_init(LCD16X2_DISPLAY_ON_CURSOR_OFF_BLINK_OFF);
	
	SPIx_Init();
	
	while (1)
	{
		// Enable slave
		SPIx_EnableSlave();
		// Write command to slave to turn on LED blinking
		SPIx_Transfer((uint8_t) '1');
		DelayUs(10);
		// Write command to slave for asking LED blinking status
		SPIx_Transfer((uint8_t) '?');
		DelayUs(10);
		// Read LED blinking status (off/on) from slave by transmitting dummy byte
		receivedByte = SPIx_Transfer(0);
		// Disable slave
		SPIx_DisableSlave();
		// Display LED blinking status
		lcd16x2_clrscr();
		if (receivedByte == 0)
		{
			lcd16x2_puts("LED Blinking Off");
		}
		else if (receivedByte == 1)
		{
			lcd16x2_puts("LED Blinking On");
		}
		DelayMs(2500);
		
		// Enable slave
		SPIx_EnableSlave();
		// Write command to slave to turn off LED blinking
		SPIx_Transfer((uint8_t) '0');
		DelayUs(10);
		// Write command to slave for asking LED blinking status
		SPIx_Transfer((uint8_t) '?');
		DelayUs(10);
		// Read LED blinking status (off/on) from slave by transmitting dummy byte
		receivedByte = SPIx_Transfer(0);
		// Disable slave
		SPIx_DisableSlave();
		// Display LED blinking status
		lcd16x2_clrscr();
		if (receivedByte == 0)
		{
			lcd16x2_puts("LED Blinking Off");
		}
		else if (receivedByte == 1)
		{
			lcd16x2_puts("LED Blinking On");
		}
		DelayMs(2500);
	}
}
开发者ID:detik19,项目名称:stm32f103-keil,代码行数:58,代码来源:main.c

示例10: isd_setrec

//****************************************
//发送setrec指令
void isd_setrec(unsigned char adl,unsigned char adh)
{
	DelayMs(1);
	isd_send(adl); 
	DelayUs(2);
	isd_send(adh); 
	DelayUs(2);
	isd_send(0xa0); //发送setplay指令字节
	SS=1;
}
开发者ID:zou-can,项目名称:zhan-tai,代码行数:12,代码来源:12091602.c

示例11: _OWReadBit

// leggo un singolo bit dalla linea
unsigned char _OWReadBit(void)
	{
    DQ=0; // predispongo uscita bassa
    TRIS_DQ=0; // pin come uscita
    DelayUs(1);
    TRIS_DQ=1; // pin in alta impedenza
    // Devo aspettare minimo 10uS
	DelayUs(14);
    return DQ; // restituisco il valore sul quale si trova la linea
    }
开发者ID:ahmed8518,项目名称:my-prototipo,代码行数:11,代码来源:one-wire.c

示例12: TSL_StartOutputCycle

/* Sets SI high for the rising edge of a clock pulse, then sets SI low before the falling edge.
 *
 * This initiates an output cycle for the following 128 clock cycles.
 * Photodiode integration for the next cycle begins on the 19th clock pulse folowing
 * the start of an output cycle.
 */
 inline void TSL_StartOutputCycle(void)
 {
	/* Rising edge */
	GPIO_WriteBit(GPIOE, TSL_SERIAL_PIN, Bit_SET);
	DelayUs(1); /* Make sure SI pin is high before CLK goes high */
	GPIO_WriteBit(GPIOE, TSL_CLOCK_PIN, Bit_SET);
	DelayUs(TSL_CLOCK_DELAY_US);

	/* Falling edge */
	GPIO_WriteBit(GPIOE, TSL_SERIAL_PIN, Bit_RESET);
	DelayUs(1); /* Make sure SI pin is low before CLK goes low */
	GPIO_WriteBit(GPIOE, TSL_CLOCK_PIN, Bit_RESET);
}
开发者ID:scottlawsonbc,项目名称:FilamentDiameterSensor,代码行数:19,代码来源:tsl1401cl.c

示例13: _OWWriteBit

// scrivo un singolo bit sulla linea	
void _OWWriteBit(char bitval)
	{
    DQ=0; // predispongo uscita bassa  
    TRIS_DQ=0; // pin come uscita per avviare il timeslot
    DelayUs(1);
    // se il bit vale 1, porto la linea in alta impedenza
	if(bitval==1) 
		{
        TRIS_DQ=1;
		}
    DelayUs(100); // aspetto 100uS per la fine del timeslot
    TRIS_DQ=1; // riporto la linea come ingresso
    }
开发者ID:ahmed8518,项目名称:my-prototipo,代码行数:14,代码来源:one-wire.c

示例14: DelayMs

void DelayMs(unsigned char cnt)
{
#if	XTAL_FREQ <= 2
	do {
		DelayUs(996);
	} while(--cnt);
#else
	unsigned char	i;
	do {
		i = 4;
		do {
			DelayUs(250);
		} while(--i);
	} while(--cnt);
#endif
}
开发者ID:hunghtbk,项目名称:actor_thietkephancung,代码行数:16,代码来源:delay.c

示例15: setkey_treat

//*******************************************
//录音键处理程序
//从指定地址开始录音的程序就是在这段里面
void setkey_treat(void)
{
   set_key=1;//置IO口为1,准备读入数据
   DelayUs(1);
   if(set_key==0)
   {
        if(count==0)//判断是否为上电或复位以来第一次按录音键
        {
           st_add=170;
        }
        else
        {
          st_add=end_add+3; 
        }//每段语言间隔3个地址
        isd_powerup(); //AN键按下,ISD上电并延迟50ms
		isd_stopwrdn();
		isd_powerup(); 
        LED1=1;//录音指示灯亮,表示录音模式
    	isd_setrec(st_add&0x00ff,st_add>>8); //从指定的地址
        if(INT==1)// 判定芯片有没有溢出
        {		
            isd_rec(); //发送录音指令
        }
        time_total=st_add*2;//计时初始值计算
        TR0=1;//开计时器
        while(set_key==0);//等待本次录音结束
        TR0=0;//录音结束后停止计时
        isd_stop(); //发送4004停止命令
        end_add=time_total/2+2;//计算语音的结束地址
        LED1=0; //录音完毕,LED熄灭
        count++;//录音段数自加
  }
}
开发者ID:zou-can,项目名称:zhan-tai,代码行数:36,代码来源:12091602.c


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