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


C++ UART_Init函数代码示例

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


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

示例1: main

int main(void)
{
		UART_InitTypeDef UART_InitStruct1; 
		UART_InitStruct1.UARTxMAP= UART0_RX_PA14_TX_PA15; 
		UART_InitStruct1.UART_BaudRate=115200;
		UART_Init(&UART_InitStruct1);
		UART_ITConfig(UART0,UART_IT_RDRF, ENABLE);
	  NVIC_EnableIRQ(UART0_RX_TX_IRQn);	
		OLED_Init();
	while(1){
		//UART_SendData(UART0,1);
		//OLED_Write_Char(2,2,ch);
		//UART_SendData(UART0,'x');
		//UART_Send_String(UART0,"abcdefg");
	}
}
开发者ID:oldjohnh,项目名称:car,代码行数:16,代码来源:main.c

示例2: main

int main(void)
{
	DDRA = 0x01;
	DDRD = 0x02;
	UART_Init();
	unsigned char data = 0x1E;
	
    while(1)
    {
		PORTA |= (1 << PA0);
		//_delay_ms(100);
		//UART_Transmit(data);
		PORTA &= ~(1 << PA0);
		//_delay_ms(100);
	}
}
开发者ID:estav25,项目名称:TTK4155_Embedded_System,代码行数:16,代码来源:Butel_Estavoyer.c

示例3: main

void main()
{
	lcd_init();
	lcd_pos(0, 0);
	lcd_write_string("Ξ�½ΠΑυξΘ£Ί1234‘ζ");
	UART_Init();
	while (1) 
	{
		LED_ON();
		delay_ms(100);
		LED_OFF();
		delay_ms(100);
		SendData('b');
		SendData('\n');
	}
}
开发者ID:DlutLiuZhao,项目名称:ThermostaticBath,代码行数:16,代码来源:main.c

示例4: main

int main()
{
	PORT_Init();
	UART_Init(19200);
	while (1)
	{
		PrintWelcome();

		while (1)
		{
			AcceptCommands();
			EvaluateStatus(UPDATE_ONLY_ON_CHANGE);
		}			
	}
	return 0;
}
开发者ID:LuceS,项目名称:pi4j-arch,代码行数:16,代码来源:OlimexAvrIoM16-Pi4JGpioExtension.c

示例5: main

int main(void)
{
	UART_Init();
	microrl_terminalInit();
	LoggerHAL_Init();
	CommandLine_Init();
	logger_Test();

	Led_t greenLed;
	Led_Init(&greenLed, GPIOC, GPIO_Pin_9);
	Led_SetState(&greenLed, led_on);
    while(1)
    {
    	microrl_terminalProcess();
    }
}
开发者ID:medik88,项目名称:stm32_system_logger,代码行数:16,代码来源:main.c

示例6: main

// ============================ Implementation ================================
int main(void) {
    UART_Init();
    Delay.ms(100);
    klPrintf("Helm is up to sing\r");

    GeneralInit();
    uint32_t tmr;
    Delay.Reset(&tmr);
    // ==== Main cycle ====
    while(1) {
        ESnd.Task();
        Detector.Task();
        //if (Delay.Elapsed(&tmr, 2000)) EVENT_SomeoneDetected();
    } // while(1)
    return 0;
}
开发者ID:Kreyl,项目名称:nute,代码行数:17,代码来源:main.cpp

示例7: main

int32_t main (void)
{
    uint8_t Tx_Data[6];
    uint8_t Rx_Data[6];

    /* Init System, IP clock and multi-function I/O */
    SYS_Init();

    /* Init UART for printf */
    UART_Init();

    printf("+-------------------------------------------------------+\n");
    printf("|    Software I2C sample code                           |\n");
    printf("|    SW Master                                          |\n");
    printf("|    HW Slave                                           |\n");
    printf("+-------------------------------------------------------+\n");

    printf("Initiate I2C for slave\n");
    InitI2C_HW();

    printf("Initiate software I2C for Master\n");
    I2C_SW_Open(100000);

    printf("Please connect:\n");
    printf("SW SDA - P1.4 (PIN47)  <->   HW SDA - P3.4 (PIN9) \n");
    printf("SW SCL - P1.5 (PIN2)   <->   HW SCL - P3.5 (PIN10) \n");

    Tx_Data[0]=0;
    Tx_Data[1]=0;
    Tx_Data[2]=0xA5;
    Tx_Data[3]=0xcc;
    Tx_Data[4]=0xbb;
    Tx_Data[5]=0xdd;

    printf("Access I2C slave:\n");

    I2C_SW_Send(0x15,Tx_Data,6);
    CLK_SysTickDelay(5000);
    I2C_SW_Get(0x15,Rx_Data,4);

    if((Rx_Data[0] != 0xaa) || (Rx_Data[1] != 0x22) || (Rx_Data[2] != 0x33) || (Rx_Data[3] != 0x44))
        printf("Data Error!!\n");
    else
        printf("Pass!!\n");

    return 0;
}
开发者ID:OpenNuvoton,项目名称:Mini51BSP,代码行数:47,代码来源:main.c

示例8: main

int main() 
{
    int adcValue;
    float volt;
    
    ADC_Init();       /* Initialize the ADC module */
    UART_Init(9600);  /* Initialize UART at 9600 baud rate */
    
    while(1)
    {
        adcValue = ADC_GetAdcValue(0); // Read the ADC value of channel zero
        volt = (adcValue*5.00)/1023;
        UART_Printf("ADC0 Value:%4d  Equivalent Voltage:%f\n\r",adcValue,volt);     // Send the value on UART
    }
    
    return (0);
}
开发者ID:ExploreEmbedded,项目名称:Pic16f877a_ExploreStarterPIC,代码行数:17,代码来源:main.c

示例9: main

int main(void)
{
    uint32_t u32DataCount;

    /* Init System, IP clock and multi-function I/O */
    SYS_Init();

    /* Init UART for printf */
    UART_Init();

    /* Init SPI */
    SPI_Init();

    printf("\n\n");
    printf("+----------------------------------------------------------------------+\n");
    printf("|                       SPI Driver Sample Code                         |\n");
    printf("+----------------------------------------------------------------------+\n");
    printf("\n");

    printf("Configure SPI as a slave.\n");

    for(u32DataCount=0; u32DataCount<TEST_COUNT; u32DataCount++)
    {
        g_au32SourceData[u32DataCount] = 0x00550000 + u32DataCount;
        g_au32DestinationData[u32DataCount] = 0;
    }

    SPI->CNTRL |= SPI_CNTRL_FIFO_Msk;
    SPI->FIFO_CTL |= (SPI_FIFO_CTL_RX_INTEN_Msk | SPI_FIFO_CTL_TX_INTEN_Msk);
    SPI->FIFO_CTL = (SPI->FIFO_CTL & ~(SPI_FIFO_CTL_TX_THRESHOLD_Msk | SPI_FIFO_CTL_RX_THRESHOLD_Msk) |
                     (2 << SPI_FIFO_CTL_TX_THRESHOLD_Pos) |
                     (1 << SPI_FIFO_CTL_RX_THRESHOLD_Pos));
    NVIC_EnableIRQ(SPI_IRQn);

    while(!g_u8Done);

    printf("Received data:\n");
    for(u32DataCount=0; u32DataCount<TEST_COUNT; u32DataCount++)
    {
        printf("%d:\t0x%08X\n", u32DataCount, g_au32DestinationData[u32DataCount]);
    }

    printf("The data transfer was done.\n");

    while(1);
}
开发者ID:OpenNuvoton,项目名称:Mini51BSP,代码行数:46,代码来源:main.c

示例10: Test_Init

/**
  @brief UART, SPI, I2C, GPIO initialization

  @return none

**/
void Test_Init(void)
{

   if(FUNCTION_TO_TEST == SPI) { /* Check if SPI is tested */
      SPI_Init();         /* SPI initialization */

   } else if(FUNCTION_TO_TEST == UART) { /* Check if UART is tested */
      UART_Init(B9600, COMLCR_WLS_8BITS);    /* UART initialization: 9600 baud rate and 8 bits data */

   } else if(FUNCTION_TO_TEST == I2C) { /* Check if I2C is tested */
      I2C_Init();         /* I2C initialization */

   } else if(FUNCTION_TO_TEST == GPIO) { /* Check if GPIO is tested */
      Port_Init();
   }

}
开发者ID:EENTN2,项目名称:EVAL-ADICUP360,代码行数:23,代码来源:Test.c

示例11: uart_print

void uart_print(void)
{
    TSB_WD_MOD_WDTE = 0U;
    TSB_WD->CR = 0x000000B1;
    SIO_Configuration(UART0);
    myUART.BaudRate = 115200U;
    myUART.DataBits = UART_DATA_BITS_8;
    myUART.StopBits = UART_STOP_BITS_1;
    myUART.Parity = UART_NO_PARITY;
    myUART.Mode = UART_ENABLE_TX;
    myUART.FlowCtrl = UART_NONE_FLOW_CTRL;

    UART_Enable(UART0);
    UART_Init(UART0, &myUART);
		
    UART_Print("Hello World!\n");
}
开发者ID:coocox,项目名称:Mplib,代码行数:17,代码来源:uart_print.c

示例12: XBeeInit

void XBeeInit(){
	char * commands [] = {"ATDL66", "ATDH0", "ATMY6D", "ATAP1", "ATCN", ""};
	int i = 0;
	int j;
	UART_Init();
	while (RxFifo_Size()>0){ //flush FIFO
		UART_InChar();
	}

		ID = 1;
  UART_OutString("x");
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
	 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);	 //SysTick_Wait10ms(110);		//wait waitTime number of ms;
	sendATCommand("+++", 110, 0);
	//UART_InString(response, 5);
	//RIT128x96x4StringDraw(response, 10, 10 , 15);
	
	for (i=0;i<5;i++){
		sendATCommand(commands[i], 20, 1);
	}
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
	 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10);
 SysTick_Wait10ms(10); }
开发者ID:glockwork,项目名称:EE445L,代码行数:46,代码来源:XbeeOutlab10changed.c

示例13: main

int main(void){ 
  PLL_Init(Bus80MHz); 	// 80 MHz
  UART_Init();      		// initialize UART device
	//initialize ADC, hardware timer trigger, 100Hz sampling
	ADC0_InitTimer0ATriggerSeq3PD3(f100HZ);  
	TxFifo_Init();	// initialize FIFO
	ST7735_InitR(INITR_REDTAB); // initialize LCD
	ST7735_InitTemperatureGraph();	// initialize graph area
	
	EnableInterrupts();

	while(1){
		TxFifo_Get(&adcValue);	// get most recent ADC value from FIFO
		ST7735_UpdateTemperatureGraph(numSamples, adcValue); // plot new point and display ADC and temperature values
    numSamples++;                       // counts the number of samples
	}
}
开发者ID:liulvcong,项目名称:EE445L,代码行数:17,代码来源:main.c

示例14: main

int main(int argc, char **argv)
{
	int serial_fd = 0;

    UART_Init();

    char buf[]="hello world";
    char buf1[10];
    UART_Send(serial_fd, buf, 10);
    printf("\n");

    UART_Recv(serial_fd, buf1, 10);

    printf("uart receive %s\n", buf1);
    close(serial_fd);
    return 0;
}
开发者ID:chalot,项目名称:360,代码行数:17,代码来源:comm.c

示例15: UART1Init

// -----------------------------------------------------------------------------
static void UART1Init(uint32_t baud_rate)
{
  UART_InitTypeDef uart_init;

  uart_init.UART_WordLength = UART_WordLength_8D;
  uart_init.UART_StopBits = UART_StopBits_1;
  uart_init.UART_Parity = UART_Parity_No ;
  uart_init.UART_BaudRate = baud_rate;
  uart_init.UART_HardwareFlowControl = UART_HardwareFlowControl_None;
  uart_init.UART_Mode = UART_Mode_Tx_Rx;
  uart_init.UART_FIFO = UART_FIFO_Enable;
  uart_init.UART_TxFIFOLevel = UART_FIFOLevel_1_4;
  uart_init.UART_RxFIFOLevel = UART_FIFOLevel_3_4;
  UART_DeInit(UART0);
  UART_Init(UART0, &uart_init);
  UART_Cmd(UART0, ENABLE);
}
开发者ID:ctraabe,项目名称:NaviCtrl,代码行数:18,代码来源:ublox.c


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