We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,I have tried to create a systick delay using systick interrupt as shown in the code bellow.
But It shows me those warnings shown bellow,and nothing happens on my STM32 shown bellow.Where did i go wrong?Thanks.
#include "stm32f407xx.h" volatile uint16_t delay_count=0; void SysTick_Handler(void)//called every 1ms { if (delay_count>0) { delay_count--; } } void delay_ms(uint16_t delay_temp) { delay_count=delay_temp; while(delay_count){} } int main() { RCC->AHB1ENR|=(1uL<<3); //set thirdbit //GPIOD->MODER&=~(1uL<<31);//reset 0 on 31 01 to gpio_moder 31,30 bits in register //GPIOD->MODER|=(1uL<<30);//set 1 on 30 output mode for pin 15 port D GPIOD->MODER=0x55000000; SysTick_Config(SystemCoreClock/1000);//1 ms interrupt GPIOD->OTYPER=0; //all register is push pull GPIOD->OSPEEDR=0;//speed low //GPIOD->ODR|=(1<<15); //Sets pin 15 while(1) { GPIOD->BSRR=(1uL<<15); delay_ms(500); GPIOD->BSRR=(1uL<<(15+16)); delay_ms(500); } }
Build target 'Target 1'bob.c(3): warning: no previous extern declaration for non-static variable 'delay_count' [-Wmissing-variable-declarations]volatile uint16_t delay_count=0; ^bob.c(3): note: declare 'static' if the variable is not intended to be used outside of this translation unitvolatile uint16_t delay_count=0; ^bob.c(4): warning: no previous prototype for function 'SysTick_Handler' [-Wmissing-prototypes]void SysTick_Handler(void)//called every 1ms ^bob.c(4): note: declare 'static' if the function is not intended to be used outside of this translation unitvoid SysTick_Handler(void)//called every 1ms^static bob.c(11): warning: no previous prototype for function 'delay_ms' [-Wmissing-prototypes]void delay_ms(uint16_t delay_temp) ^bob.c(11): note: declare 'static' if the function is not intended to be used outside of this translation unitvoid delay_ms(uint16_t delay_temp)^static 3 warnings generated.compiling bob.c...linking...Program Size: Code=600 RO-data=424 RW-data=4 ZI-data=1640 ".\Objects\try1.axf" - 0 Error(s), 3 Warning(s).Build Time Elapsed: 00:00:00Load "C:\\Keil_v5\\less01\\Objects\\try1.axf" Erase Done.Programming Done.Verify OK.Application running ...Flash Load finished at 13:12:31Load "C:\\Keil_v5\\less01\\Objects\\try1.axf" Erase Done.Programming Done.Verify OK.Application running ...Flash Load finished at 13:12:46