This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

user input, interface with multiple scanf?



Dear all,

I just have mine 28335 a few weeks ago and have tried a few examples downloaded within sprc530. I got some few question regarding the user scanf problem about pwm, also, im just know how to write simple C only.

1. How can I update my scanf values from time to time after the 1st time entered in the dialog box while the scanf is written inside either a while, for loop or no loop. Or I cant use the scanf statement while programming the dsp?

Cause currently my problem is the scanf value will only update into the global variable until the for loop has finished its loop.

2. Can I manually pop up the standard input dialog box using interrupt?

Lets say if my program isnt written in a loop, but I want to update another value by simply press keyboards, interrupt, and pop up the dialog box again. Isit possible?

example program;

printf("Enter frequency between 1 to 50Hz:\n");
scanf("%f",&freq);

if ( freq > 0 || freq <51)
{
    badFreq = false;
    }

    if (freq < 0 || freq >50)
    {
    badFreq = true;
    }

    while (badFreq)
    {
    printf("You must enter frequency between 1 to 50Hz.\n");
    scanf("%f",&freq);

    if ( freq > 0 || freq <51)
    {
    badFreq = false;
    }

    }    //end while

    frequency = freq;

===================================================================

Please give me advice and any guidance from your all experience. I really appreciate it.

Thank you.

  • Until now I still cant solve for my problem.

    The simplest way that I mentioned my problem was:

    When I scanf a value inside a while loop in the pop up standard input dialog box, the program will run about half second, then halt. This can be notice on the board connected indicator light.

    This means that  the indicator light will turn on and off again and again when I enter a scanf value again and again without exit the while loop.

    If i exit the loop, the standard input dialog box is pop off, then the program will run with what i enter in scanf.

    1) Is it something to do with memory?

    2) can i manually pop out and off the standard input dialog box? Because as i mentioned previously from my observation, my scanf value will not update to my variable until the loop exit, which means that the standard input dialog box pop off.

    Please help.

    Or there is another way to scanf variable multiple times? Or we cant use the scanf statement when programming dsp?

     

    thank you