STM32F4 Discovery Board: Functions calling in Atollic TrueStudio

OP (Company: Student) #7072033
Hello Everyone!

Hope you are all doing well.

I'm pretty new in the programming of MCU and I need some explanations 
about few things. I hope somebody could give me some.

So! I'm working with the STM32F4 Discovery Board and using the IDE 
Atollic TrueStudio.

I wrote a code for calculating the distance with the distance sensor 
HC-SR04.
My code is working fine when I'm writting it in successively lines. I 
mean without functions.

Now I try to write the same code this time by using functions and then 
just call each functions in the main code. The code is now not working 
anymore.

Could someone give me some explanations what I need/must do in order to 
fix my problem?

Here is my code with functions. Like I've said, I just put the lines of 
code into functions. But the code is no more working.
Attached files:
Guest
Benutze den Debugger, um heraus zu finden wo das Programm nicht wie 
erwartet funktioniert. "no more working" ist mir zu schwammig.

Warum benutzt du das das völlig veraltete Atollic Studio und diese 
veralteten Bibliotheken?


Warum hast du Hinweise zur Formatierung von Quelltexten nicht beachtet? 
SO ist das kaum lesbar. Ist mir zu mühsam, das auseinander zu klamüsern.
Guest
printf() in einer ISR ist oft eine ganz blöde Idee, da es selbst 
wiederum von Interrupts abhängt.  Leider hast du nicht gezeigt, wie das 
in deinem Projekt implementiert ist.

Am Besten hängst du das mal in compilierbarer Form an, also vollständig.
Guest
stefanus wrote:
> Warum benutzt du das das völlig veraltete Atollic Studio und diese
> veralteten Bibliotheken?

Das hat überhaupt nichts mit veraltet zu tun und die SPL funktioniert 
oft besser als das beknackte Cube. SPL ist gut getestet und ausgereift.

Man sollte aber in main() eine Schleife ausführen und z.B. in die 
Schleife die Anzeige des Ergebnisses verlegen, anstatt das in der ISR zu 
machen.
Das ist die Grundstruktur eines jeden MC Programmes - denn was soll so 
ein MC machen, wenn er ans Ende von main() kommt?
OP (Company: Student)
matzetronics wrote:
> stefanus wrote:
>> Warum benutzt du das das völlig veraltete Atollic Studio und diese
>> veralteten Bibliotheken?
>
> Das hat überhaupt nichts mit veraltet zu tun und die SPL funktioniert
> oft besser als das beknackte Cube. SPL ist gut getestet und ausgereift.
>
> Man sollte aber in main() eine Schleife ausführen und z.B. in die
> Schleife die Anzeige des Ergebnisses verlegen, anstatt das in der ISR zu
> machen.
> Das ist die Grundstruktur eines jeden MC Programmes - denn was soll so
> ein MC machen, wenn er ans Ende von main() kommt?

Hallo matzetronics!

Also! Ich habe, als ich den Code ohne Funktionen geschrieben habe, keine 
Schleife benutzt. Das Ergebnis habe ich immer in der ISR zeigen lassen. 
Und es hat funktioniert.
OP (Company: Student)
matzetronics wrote:
> stefanus wrote:
>> Warum benutzt du das das völlig veraltete Atollic Studio und diese
>> veralteten Bibliotheken?
>
> Das hat überhaupt nichts mit veraltet zu tun und die SPL funktioniert
> oft besser als das beknackte Cube. SPL ist gut getestet und ausgereift.
>
> Man sollte aber in main() eine Schleife ausführen und z.B. in die
> Schleife die Anzeige des Ergebnisses verlegen, anstatt das in der ISR zu
> machen.
> Das ist die Grundstruktur eines jeden MC Programmes - denn was soll so
> ein MC machen, wenn er ans Ende von main() kommt?


Hallo nochmal matzetronics!

Ich habe gemacht wie du es gesagt hast und es hat funktionniert. 
Herzlichen Dank für den Hinweis.

VG

Reply

A question of your own? This thread is over 4 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.