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

How can I generate an input for my ADC?

I am simulating a STM32 microcontroller and I am trying to work on my code. My project is to input sound to the ADC, then process the data. But I can't find how to give a signal on my ADC (on Keil since I don't have the microcontroller on my hands yet)so I can test my code.. I am kinda lost here..

  • If your processor has good simulation support - as you can find if you check the Keil support pages - then there is documentation that tells what virtual registers that can be used to put stimuli to the ADC. This allows you to write an external program run by the debugger that regularly changes the value the ADC in the program simulation will see.

  • Build a static data table with you desired samples, and then have the ADC read abstraction pull values from the table, and process those.

    You could test C code on a PC too, and pull data from a file if you desired, and pump that data through your routines.

  • So after trying it many times, it seems that when I run the function, there is an error along of the lines "cannot divide by zero", so the CLOCK is zero, I guess. I am not very good at Keil but on Target Options there is the Xtal 8Mhz. Should I put a timer other than that so that my function recognizes CLOCK as something other than zero?