本文整理汇总了C++中UART1_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ UART1_Init函数的具体用法?C++ UART1_Init怎么用?C++ UART1_Init使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UART1_Init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: backgroundTask
/**
* @brief Text
* @param None
* @retval None
*/
void backgroundTask(void *pvParameters)
{
prvHardwareInit();
/* The parameter in vTaskDelayUntil is the absolute time
* in ticks at which you want to be woken calculated as
* an increment from the time you were last woken. */
TickType_t xNextWakeTime;
/* Initialize xNextWakeTime - this only needs to be done once. */
xNextWakeTime = xTaskGetTickCount();
/* Create the blink timer */
prvBlinkTimer = xTimerCreate("RefreshTimer", 500 / portTICK_PERIOD_MS, pdTRUE, 0, prvBlinkTimerCallback);
if (prvBlinkTimer != NULL)
xTimerStart(prvBlinkTimer, portMAX_DELAY);
UART1_Init();
vTaskDelayUntil(&xNextWakeTime, 1000 / portTICK_PERIOD_MS);
I2C_EEPROM_Init();
// I2C_EEPROM_WriteByte(0x00, 0xEC);
// data = 0x00;
// data = I2C_EEPROM_ReadByte(0x00);
// if (data != 0xEC)
// BUZZER_BeepNumOfTimes(20);
// else
// BUZZER_BeepNumOfTimes(5);
while (1)
{
vTaskDelayUntil(&xNextWakeTime, 1000 / portTICK_PERIOD_MS);
}
}
示例2: main
int main(void)
{
uint32_t u32Item;
/* Init System, IP clock and multi-function I/O */
SYS_Init();
/* Init UART0 for printf */
UART0_Init();
/* Init UART1 for testing */
UART1_Init();
/*---------------------------------------------------------------------------------------------------------*/
/* SAMPLE CODE */
/*---------------------------------------------------------------------------------------------------------*/
printf("\n\nCPU @ %dHz\n", SystemCoreClock);
do{
TestItem();
u32Item = getchar();
printf("%c\n",u32Item);
switch(u32Item)
{
case '1': UART_FunctionTest(); break;
case '2': IrDA_FunctionTest(); break;
case '3': RS485_FunctionTest(); break;
case '4': LIN_FunctionTest(); break;
case '5': AutoFlow_FunctionTest(); break;
case '6': LIN_FunctionTestUsingLinCtlReg(); break;
default: break;
}
}while(u32Item != 27);
}
示例3: main
/*---------------------------------------------------------------------------------------------------------*/
int32_t main(void)
{
/* Unlock protected registers */
SYS_UnlockReg();
SYS_Init();
UART0_Init();
UART1_Init();
printf("\n\n");
printf("+------------------------------------------------------------+\n");
printf("| NuMicro USB Virtual COM Dual Port Sample Code |\n");
printf("+------------------------------------------------------------+\n");
USBD_Open(&gsInfo, VCOM_ClassRequest, NULL);
/* Endpoint configuration */
VCOM_Init();
USBD_Start();
NVIC_EnableIRQ(USBD_IRQn);
NVIC_EnableIRQ(UART0_IRQn);
NVIC_EnableIRQ(UART1_IRQn);
while(1)
{
VCOM_TransferData();
}
}
示例4: main
/*---------------------------------------------------------------------------------------------------------*/
int main(void)
{
/* Unlock protected registers */
SYS->REGWRPROT = 0x59;
SYS->REGWRPROT = 0x16;
SYS->REGWRPROT = 0x88;
/* Init System, IP clock and multi-function I/O */
SYS_Init();
/* Lock protected registers */
SYS->REGWRPROT = 0x0;
/* Init UART0 for printf */
UART0_Init();
/* Init UART1 for testing */
UART1_Init();
/*---------------------------------------------------------------------------------------------------------*/
/* SAMPLE CODE */
/*---------------------------------------------------------------------------------------------------------*/
printf("\n\nCPU @ %dHz\n", SystemCoreClock);
printf("\n\nUART Sample Program\n");
/* UART RS485 sample master function */
RS485_9bitModeMaster();
while(1);
}
示例5: UART1_Config
/**
* @brief Configure UART1 for the communication with HyperTerminal
* @param None
* @retval None
*/
void UART1_Config(void)
{
/* EVAL COM (UART) configuration -----------------------------------------*/
/* USART configured as follow:
- BaudRate = 115200 baud
- Word Length = 8 Bits
- One Stop Bit
- Odd parity
- Receive and transmit enabled
- UART Clock disabled
*/
UART1_Init((uint32_t)115200, UART1_WORDLENGTH_8D,UART1_STOPBITS_1, UART1_PARITY_NO,
UART1_SYNCMODE_CLOCK_DISABLE, UART1_MODE_TXRX_ENABLE);
/* Enable the UART Receive interrupt: this interrupt is generated when the UART
receive data register is not empty */
//UART1_ITConfig(UART1_IT_RXNE_OR, ENABLE);
/* Enable the UART Transmit complete interrupt: this interrupt is generated
when the UART transmit Shift Register is empty */
UART1_ITConfig(UART1_IT_RXNE_OR, ENABLE);
/* Enable UART */
UART1_Cmd(ENABLE);
/* Enable general interrupts */
// enableInterrupts();
}
示例6: main
/*---------------------------------------------------------------------------------------------------------*/
int main(void)
{
/* Unlock protected registers */
SYS_UnlockReg();
/* Init System, peripheral clock and multi-function I/O */
SYS_Init();
/* Lock protected registers */
SYS_LockReg();
/* Init UART0 for printf */
UART0_Init();
/* Init UART1 for testing */
UART1_Init();
/*---------------------------------------------------------------------------------------------------------*/
/* SAMPLE CODE */
/*---------------------------------------------------------------------------------------------------------*/
printf("\n\nCPU @ %dHz\n", SystemCoreClock);
printf("\n\nUART Sample Program\n");
/* UART RS485 sample master function */
RS485_FunctionTest();
while(1);
}
示例7: main
void main()
{
int i;
trisb=0;
portb=0;
Lcd_Init(); // Initialize LCD
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
while (1) // Endless loop
{
if (UART1_Data_Ready()) // If data is received,
{
for(i=0;i<100;i++)
{
uart_rd[i]= UART1_Read();
}
for(i=0;i<100;i++)
{
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,uart_rd[i]);
delay_ms(10000);
}
}
}
}
示例8: SetUp
void SetUp()
{
OSCCON = 0x70;
OPTION_REG = 0x07; //タイマー0設定
ANSELA = 0x2F;
ANSELB = 0x00;
ANSELD = 0x00;
ANSELE = 0x00;
TRISA = 0x2F;
TRISB = 0x20;
TRISC = 0x00;
TRISD = 0x00;
TRISE = 0x00;
PORTA = 0x00;
PORTB = 0x00;
PORTC = 0x00;
PORTD = 0x00;
PORTE = 0x00;
ADC_Init();
UART1_Init(9600);
#if DEBUG_MODE
Soft_UART_Init(&PORTB, 4, 6, 9600, 0);
#else
Soft_UART_Init(&PORTB, 6, 4, 9600, 0);
#endif
Delay_ms(10);
}
示例9: main
// *************************** Capture image dimensions out of BMP**********
int main(void){
TExaS_Init(SSI0_Real_Nokia5110_Scope); // set system clock to 80 MHz
Output_Init();
ADC0_Init();
DAC_Init();
SysTick_Init();
Menu_Init();
Sound_Init();
UART1_Init();
Button0_Init();
Timer0_Init(Play, 80000000/11025); // 11.025 kHz 80000000/11025
Timer1_Init(Master_Funk, 80000000/60);
//Timer2_Init(SomeUART function, high speed); //for UART
/* ST7735_FillScreen(0x0000); // set screen to black
ST7735_SetCursor(1, 1);
ST7735_OutString("GAME OVER");
ST7735_SetCursor(1, 2);
ST7735_OutString("Nice try,");
ST7735_SetCursor(1, 3);
ST7735_OutString("Earthling!");
ST7735_SetCursor(2, 4);
LCD_OutDec(1234); */
while(1){
}
}
示例10: PDMA_Example
void PDMA_Example()
{
uint8_t unItem;
/* Init System, IP clock and multi-function I/O */
SYS_Init(); //In the end of SYS_Init() will issue SYS_LockReg() to lock protected register. If user want to write protected register, please issue SYS_UnlockReg() to unlock protected register.
/* Init UART0 for printf */
UART0_Init();
/* Init UART1 for PDMA test */
UART1_Init();
do
{
/* PDMA Sample Code: UART1 Tx/Rx Loopback */
// printf("\n\n");
printf("+------------------------------------------------------------------------+\n");
printf("| PDMA Driver Sample Code |\n");
printf("| |\n");
printf("+------------------------------------------------------------------------+\n");
printf("| [1] Using TWO PDMA channel to test. < TX1(CH1)-->RX1(CH0) > |\n");
printf("| [2] Using ONE PDMA channel to test. < TX1-->RX1(CH0) > |\n");
printf("+------------------------------------------------------------------------+\n");
unItem = uart_getchar();
IsTestOver =FALSE;
if((unItem=='1') || (unItem == '2'))
{
PDMA_UART(unItem);
// printf("\n\n PDMA sample code is complete.\n");
}
}while(unItem!=0x27);
// return 0;
}
示例11: System_init
void System_init(void)
{
System_Clock_init();
UART1_Init();
delay_init(16);
HekrInit(UART1_SendChar);
_asm("rim");
}
示例12: main1
int main1(void){
TExaS_Init();
ADC_Init(); // turn on ADC, set channel to 1
ST7735_InitR(INITR_REDTAB);
PortF_Init();
SysTick_Init(); // This makes things work
UART1_Init();
while(1){} // do-nothing loop
}
示例13: Uart_Init
/**********************************************
UART1 configured as follow:
- BaudRate = 115200 baud
- Word Length = 8 Bits
- One Stop Bit
- No parity
- Receive and transmit enabled
- Receive interrupt
- UART1 Clock disabled
*********************************************/
void Uart_Init(void)
{
UART1_DeInit();
UART1_Init((u32)9600, UART1_WORDLENGTH_8D, UART1_STOPBITS_1, \
UART1_PARITY_NO , UART1_SYNCMODE_CLOCK_DISABLE , UART1_MODE_TXRX_ENABLE);
UART1_ITConfig(UART1_IT_RXNE_OR,ENABLE );
UART1_Cmd(ENABLE );
}
示例14: Init_UART
//串口UART1初始化
void Init_UART(void)
{
//默认初始化
UART1_DeInit();
//设置波特率9600 8位数据 1位停止位 无校验 外部时钟不可用 模式接收发送
UART1_Init((u32)9600, UART1_WORDLENGTH_8D, UART1_STOPBITS_1, UART1_PARITY_NO, UART1_SYNCMODE_CLOCK_DISABLE, UART1_MODE_TXRX_ENABLE);
//设置接收寄存器溢出中断
UART1_ITConfig(UART1_IT_RXNE_OR, ENABLE);
}
示例15: USART1_INIT
void USART1_INIT(void)
{
// UART1_DeInit();
UART1_Init(9600, UART1_WORDLENGTH_8D, UART1_STOPBITS_1,UART1_PARITY_NO,UART1_SYNCMODE_CLOCK_DISABLE, UART1_MODE_TXRX_ENABLE );
UART1_ITConfig(UART1_IT_RXNE_OR, ENABLE);//UART1_IT_RXNE_OR
UART1->CR1 &= (uint8_t)(~UART1_CR1_UARTD);
// UART1_Cmd(ENABLE);
UART1_ClearFlag(UART1_FLAG_RXNE);
}