I
I
Ilyas2017-05-03 21:39:52
Programming
Ilyas, 2017-05-03 21:39:52

How to learn gracefully and competently to program MK?

The Internet and books are full of good lessons and examples on how to solve simple tasks using a microcontroller, such as a thermometer, etc. But if the task is to implement some more or less complex project, where, for example, several interrupts are involved and there is interaction with external devices, problems begin. How to write this code so that the devil does not break his leg in it? How to write it as quickly as possible and with minimum bugs? In general, where and how can you learn to program MK at an advanced level?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
vasiliev, 2017-05-04
@nossudak

Look towards real-time operating systems like freertos. With a large number of tasks assigned to the microcontroller, it is difficult to make something well-functioning and well-written without them.

M
Maria Maltseva, 2017-05-04
@Moriam

First, model the structure of the code, think over the interaction of separate parts - "pencil on paper" in the form of flowcharts, independent "virtual machines", and only after the whole structure of the future device is clear, start writing code. And then only practice; and there is code written a few months ago, it seems terrible, so you are on the right track)
The main thing is not to rush to code right away.

D
d-stream, 2017-05-03
@d-stream

Well, exactly the same as a person learns to walk: at first it sucks and falling on the ass, then - better, but clubfoot and only then begins to run ...
Stupid practice and practice again, after the first cones are stuffed - you can look into other people's implementations and there or see a rake similar to yours, or see and appreciate a certain technique. Abstractly in advance quickly, correctly and cheaply - it will not work ...

L
LampTester, 2017-05-24
@LampTester

I always say that programming controllers falls into two tasks: actual programming and circuitry. Therefore, you first need to learn how to program and master circuitry.
You can learn how to program by performing classic tasks - sorting, working with data structures, etc. There are many good and proven books and sites about this. Just do not take books like "C ++ in ten days" - this is not at all what will teach you how to write elegantly and competently . At the described stage, you will be interested in the basics that will help you learn how to break a complex task into simple actions.
Naturally, I do not even discuss code generators - you just need to forget about them. No C++, just ANSI C - emphasis on it.
Knowledge of circuitry is necessary in order to understand the features of iron and how to properly interact with it. On the basics of circuitry, there are also many proven books. But, again, this is not "Arduino for Beginners". Take normal books like Horowitz and Hill.
Well, practice, practice, practice. And, of course, do not forget that everyone has their own understanding of the terms "elegantly and competently". :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question