I had a new user to PIC micros ask me what he should learn. This is what I told him, the 3 most important techniques that I use in all my programming.
Learn how to use interrupts - they are used in buffering. In my experience, usually the arrangement is a main() loop, with interrupts collecting data to be processed by main().
Ring Buffering
Any PIC micro must collect data, then analyze it or process it. Most of the time, theres not enough time to analyze the data as its collected.
Therefore, use ring buffering. Collect the data in the background, with interrupts, filling up a ring buffer with routines such as ring_buffer_put(). In the background, at the programs leisure, use ring_buffer_get() to get the data out, and process it.
State Machines
Most problems can be simplified using state machines. Learn them - trust me, it'll save you time.
Links
Search the web, using terms like 'state machine c' or 'ring buffer c' on www.google.com. The following web will get you started: http://www.bknd.com/cc5x/multitasking.shtml.
- Interrupts
- Ring Buffering
- State machines
Learn how to use interrupts - they are used in buffering. In my experience, usually the arrangement is a main() loop, with interrupts collecting data to be processed by main().
Ring Buffering
Any PIC micro must collect data, then analyze it or process it. Most of the time, theres not enough time to analyze the data as its collected.
Therefore, use ring buffering. Collect the data in the background, with interrupts, filling up a ring buffer with routines such as ring_buffer_put(). In the background, at the programs leisure, use ring_buffer_get() to get the data out, and process it.
State Machines
Most problems can be simplified using state machines. Learn them - trust me, it'll save you time.
Links
Search the web, using terms like 'state machine c' or 'ring buffer c' on www.google.com. The following web will get you started: http://www.bknd.com/cc5x/multitasking.shtml.
No comments:
Post a Comment