EasyManua.ls Logo

ST ST7 - Limit the Size of Variables to the very Minimum; Conclusion

ST ST7
317 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
248/317
8 - C Language and the C Compiler
8.8.4.3 Limit the size of variables to the very minimum
Donot use long integers where integers are sufficient; and above all, avoidusingfloating arith-
metic. Floating operations take a long time to process, and may impede the response time of
a program. In addition, floating arithmetic does not guarantee proper results for equality tests.
Sine the ST7 is a 8-bit machine, try to use as
char variablesasoftenaspossible.
Another point about long and floating arithmetic was described earlier, some precautions are
needed when interrupts are used.
8.9 CONCLUSION
This chapter has demonstrated that C language is well suited to microcontrollers like the ST7;
when care is taken as specified throughout this chapter, the performance of the program
written in C is adequate, and the ease you will gain writing it will make you have no regrets
about using it rather than assembly programming. C makes debugging, documenting and
maintaining your software easier, and will better prepare you to face the requirements of soft-
ware quality assurance.

Table of Contents

Related product manuals