??? 05/05/09 22:12 Read: times |
#165081 - Divide and conquer Responding to: ???'s previous message |
It is a standard programming practice that, if the same operation needs to be done in more than one place, you write a "sub-routine" to do it, and call that "sub-routine" at each and every point that the thing needs to be done.
This is the kind of approach that you need to adopt: whether it's a button or a serial command that invokes it, the action is the same - so make it into a "sub-routine" In the 'C' programming language, the concept of the "sub-routine" is implemented by writing a function. This also means that your serial port handling can be (almost) entirely independent of what actions are to be performed - as they are all just "hidden" within the functions that get called. Therefore you can look at any serial port code for examples... |
Topic | Author | Date |
Control program via buttons and via terminal | 01/01/70 00:00 | |
Good info on this site | 01/01/70 00:00 | |
Divide and conquer | 01/01/70 00:00 | |
Control program via buttons and via terminal | 01/01/70 00:00 | |
howto test input from serial without stop all operations![]() | 01/01/70 00:00 | |
tutorial, faq | 01/01/70 00:00 |