void board_init(void) { /* SysTick end of count event each 10ms */ RCC_GetClocksFreq(&RCC_Clocks); SysTick_Config(RCC_Clocks.HCLK_Frequency / 100); timer2_init(); timer14_init(); Usart_Init(USART2,9600); send_data(USART2, "uart2 is OK!\r\n", strlen("uart2 is OK!\r\n")); //不同的传感器的引脚及用到的板级外设不同 //sensor_init(); #if defined (BEEP) //蜂鸣器用作调试设备 beep_init(); Delay(20); BEEP_OFF(); #endif #if defined (DEBUG) //串口用作调试端口 Usart_Init(DEBUG_UART,115200); send_data(DEBUG_UART, "uart is OK!\r\n", strlen("uart is OK!\r\n")); #endif #if defined (EEPROM) //24cxx IIC接口初始化 IIC_Init(); #endif }
int main() { Usart_Init(); printf("\r\nStart OS.%s\r\n",BOOT_MESSAGE); StartOS(OSDEFAULTAPPMODE); return 0; }
int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f10x_xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f10x.c file */ // char msg[] = "Hello STM32 !"; // int i = 0; Usart_Init(); /* Output a message on Hyperterminal using printf function */ //这里我们只向外输出一个字符串就好 // for(i = 0; i < 13; i++) { // while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET); // USART_SendData(USART1,msg[i]); // // } printf("Hello STM32 !\n\r"); while(1) { // GPIO_SetBits(GPIOA,GPIO_Pin_6); // // GPIO_ResetBits(GPIOA,GPIO_Pin_6); } }
int main(void) { LED_Init(LED_2 | LED_3); Beep_Init(); SysTick_Init(1, SYSTICK_MS); LED_On(LED_2 | LED_3); Usart_Init(); //Beep_On(); SysTick_Delay(200, SYSTICK_MS); //Beep_Off(); LED_Off(LED_2 | LED_3); Key_Init(KEY_S1 | KEY_S2 | KEY_S3 | KEY_S4); Keyboard_Init(); //LCD_Init(); ADS1118_Init(); while(1) { printf("准备完毕 开始转换!\n"); ADS1118_CS_Reset(); while(!GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_6)); ConversionValue = ADS1118_Read(count);//8283 ADS1118_CS_Set(); printf(" The Value is 0X%08x ,%08d\n",ConversionValue,ConversionValue); ad= ConversionValue*4.096/32768; printf("AD=%fV\n",ad); SysTick_Delay(1000, SYSTICK_MS); // Keyboard_Loop(); // //LCD_Clear(Color_White); // //LCD_Set_ForeColor(Color_Red); // //if(Keyboard_Scan() == KEYBOARD_S1) { LCD_Show_String(30,50,200,16,16, "Key Board Test"); } // if(Keyboard_Detect(KEYBOARD_S1, KEYBOARD_DOWN)) { printf("S1\r\n"); } // if(Keyboard_Detect(KEYBOARD_S2, KEYBOARD_DOWN)) { printf("S2\r\n"); } // if(Keyboard_Detect(KEYBOARD_S3, KEYBOARD_DOWN)) { printf("S3\r\n"); } // if(Keyboard_Detect(KEYBOARD_S4, KEYBOARD_DOWN)) { printf("S4\r\n"); } // if(Keyboard_Detect(KEYBOARD_S5, KEYBOARD_DOWN)) { printf("S5\r\n"); } // if(Keyboard_Detect(KEYBOARD_S6, KEYBOARD_DOWN)) { printf("S6\r\n"); } // if(Keyboard_Detect(KEYBOARD_S7, KEYBOARD_DOWN)) { printf("S7\r\n"); } // if(Keyboard_Detect(KEYBOARD_S8, KEYBOARD_DOWN)) { printf("S8\r\n"); } // if(Keyboard_Detect(KEYBOARD_S9, KEYBOARD_DOWN)) { printf("S9\r\n"); } // if(Keyboard_Detect(KEYBOARD_S10, KEYBOARD_DOWN)) { printf("S10\r\n"); } // if(Keyboard_Detect(KEYBOARD_S11, KEYBOARD_DOWN)) { printf("S11\r\n"); } // if(Keyboard_Detect(KEYBOARD_S12, KEYBOARD_DOWN)) { printf("S12\r\n"); } // if(Keyboard_Detect(KEYBOARD_S13, KEYBOARD_DOWN)) { printf("S13\r\n"); } // if(Keyboard_Detect(KEYBOARD_S14, KEYBOARD_DOWN)) { printf("S14\r\n"); } // if(Keyboard_Detect(KEYBOARD_S15, KEYBOARD_DOWN)) { printf("S15\r\n"); } // if(Keyboard_Detect(KEYBOARD_S16, KEYBOARD_DOWN)) { printf("S16\r\n"); } // //LCD_Set_ForeColor(Color_Green); // //LCD_Show_String(30,70,200,16,16, "TFT-LCD test"); // //LCD_Set_ForeColor(Color_Blue); // //LCD_Show_String(30,90,200,16,16, "www.doflye.net"); // //LCD_Draw_Circle(100,180,20); // //SysTick_Delay(1000, SYSTICK_MS); } }
void SYS_Config(void) { LCD_init(); //init LCD 12864 ConfigHWled(); //init LED indecate ConfigHWSpiport(); //CONFIG FROM THE SPI1 COMMUCATION TO ADE7878 CHIP. Config_ADE7878_IRQ(); //CONFIG FROM THE ADE7878'S "IRQ" TO OUR ... Usart_Init(); //init USART3 PORT //Timer_Init(); //init TIME0 // while(1); }
void main() { DOOR_INIT(); Usart_Init(); send_string_uart("ϵͳÒÑÆô¶¯£¡\r\n"); while(1) { Key_INIT(); Floor_Init(); Motor_INIT(); } }
int main(void) { Usart_Init(MYUBRR); sei(); Usart_transmit("DYGPS Veiculo Solar\0"); while(1) { } }
void initRobot() { //--PWM------------ TRISC = 0b00000000; PORTC = 0b00000000; PWM1_Init(5000); PWM2_Init(5000); Pwm1_Start(); Pwm2_Start(); //--ADC-----------_ ADCON1 = 0x80; // Configure analog inputs and Vref TRISA = 0xFF; // PORTA is input //--Usart--------- Usart_Init(9600); }
EXPORT void portOsStartupHook(void) { Usart_Init(); SysTick_Config(CPU_FREQUENCY / 1000); }