當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。