This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

to solve the problem

i am using three variables for delay function these three variables are used to calculate specific delay in which dynamically varied in from 1-100 according to the user input.kindly find my below code.in which my delay funcion is not working
#include "stm32f0xx.h"

#define BSRR_VAL 0x0300

int u=100,min_value=280,max_value=28000;

void on_time(int ontime);

int main(void)
{

RCC->AHBENR |= RCC_AHBENR_GPIOCEN;
GPIOC->MODER |= (GPIO_MODER_MODER8_0) ;
GPIOC->OTYPER &= ~(GPIO_OTYPER_OT_8) ;
GPIOC->OSPEEDR |= (GPIO_OSPEEDER_OSPEEDR8);
GPIOC->PUPDR = ~(GPIO_PUPDR_PUPDR8);

while (1) { /* Set PC8 and PC9 */ GPIOC->BSRR = BSRR_VAL;
on_time();

/* Reset PC8 and PC9 */ GPIOC->BRR = BSRR_VAL;
on_time();

}

}

void on_time()
{ unsigned int y,ontime;

ontime=u*y;

}

if i enter a value in u(100) it should be max value.i will be varying this variable from 1-100 such a way that it should be my max delay(10msec)