cancel
Showing results for 
Search instead for 
Did you mean: 

Why is my ADC only showing zero as an output while simulating the stm32f103C6 model in proteus?

Krishnangshu
Associate II

Krishnangshu_0-1696934804825.png

The above is my schematic layout of ,STM32F103C6 Series, attached to a virtual terminal with transmitting and receiving lines mentioned and the pin PA2 is used as an ADC input pin.

Krishnangshu_1-1696935020724.png

The above is the power rails configuration .

Krishnangshu_2-1696935105658.png

The above is the pinout view where PA9 and PA10 are used for transmitting and receiving which are attached to the virtual terminal as showed.

Krishnangshu_3-1696935358908.png

The above is the code where I declared test as an unsigned integer of 16 bits and character msg of length 10.

Then I have written the code for starting the ADC and then stopping for Conversion whereafter I have retrieved the values from HAL_ADC_GetValue and transmited to the virtual monitor by the help of UART Transmit function

Krishnangshu_4-1696935626017.png

Then I have build my program and converted into hex file whereafter I copied its path to the proteus stm32 model's program file.

Krishnangshu_5-1696935761308.png

The above is the output I am getting.

I am very confused on what went wrong in my program and simulation,

It would be very helpful If you guyz could assist me on this issue.

13 REPLIES 13

Can you attach your main file? I am not able to understand where to use this.

I told you to output the values on GPIOs before outputting them on UART (I've already attached the main file). You have to see GPIOB showing the ADC value in the simulation ! If not, there is an issue in your simulation environment.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Could I still print the values on GPIOB if I do not have the stm32 board?

Hello,

What do you mean by print the value on GPIOB.

The idea is to have the value on GPIOB port. So in your the simulation, you have to see the converted value on the port: 0=Blue, 1=Red. Or connect LEDs on port B to show the binary value of the converted ADC signal.

If it doesn't work I suspect an issue with Proteus simulation.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.