2019-02-24 12:53 PM
Hi, I am using the stm32f407 card and I am developing keilda software but when I compile it does not fail but the delay does not work and I would be glad if you could help what could be the reason.
2019-02-24 01:33 PM
Please elaborate, some of us aren't telepaths.
2019-02-24 02:14 PM
Compilers detect syntax errors, not logic errors.
2019-02-24 03:04 PM
I'm sorry I have to write on the line of code, but when I write to the answer block, it wipes out what I write. Thank you for writing my question, but the delay doesn't do the job. I know that the compiler only extracts the syntax error, but when I load the program, I don't get the pending wait.
2019-02-24 05:39 PM
Ok, but in order to understand the issue I'd need to actually see some code..
What OS/Browser are you using?
2019-02-28 04:28 AM
#include "stm32f4xx.h" // Device header
#include "stm32f4xx_gpio.h" // Keil::Device:StdPeriph Drivers:GPIO
#include "stm32f4xx_rcc.h" // Keil::Device:StdPeriph Drivers:RCC
#include "RTE_Device.h" // Keil::Device:Startup
void delay(uint32_t time){
while(time>0){
time--;
}
}
int main(){
GPIO_InitTypeDef APORT;
GPIO_InitTypeDef DPORT;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD,ENABLE);
DPORT.GPIO_Mode = GPIO_Mode_OUT;
DPORT.GPIO_OType = GPIO_OType_PP;
DPORT.GPIO_Pin = GPIO_Pin_All;
DPORT.GPIO_PuPd = GPIO_PuPd_NOPULL;
DPORT.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_Init(GPIOD,&DPORT);
APORT.GPIO_Mode = GPIO_Mode_OUT;
APORT.GPIO_OType = GPIO_OType_PP;
APORT.GPIO_Pin = GPIO_Pin_8| GPIO_Pin_9;
APORT.GPIO_PuPd = GPIO_PuPd_NOPULL;
APORT.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_Init(GPIOA,&APORT);
while(1)
{
GPIO_SetBits(GPIOD, GPIO_Pin_12);
delay(20000);
GPIO_ResetBits(GPIOD, GPIO_Pin_12);
}
I am using win10 as the operating system.
most simply I've run this code for trial purposes but the delay is not working.
2019-02-28 06:02 AM
The compiler will simplify your code and remove things detected as useless. Add an asm("nop;"); in your loop, or disable the compiler optimisations...