Search this site (www.microchipC.com).





CCS C Compiler for Microchip PIC micros

Your ad here

 

If I had to condense 3 years of PIC micro experience into one page, what would I say?

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.

Interrupts

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.

 



This site is non-profit. Ad revenue almost covers hosting costs.

We welcome any suggesions or comments! Send them to Shane Tolmie on support@microchipc.com. This site is a completely separate site to www.microchip.com, and is maintained independently of Microchip Ltd., manufacturers of the PIC micro. All code on this site is free for non-commercial use, unless stated otherwise. Commercial use normally free, however, it is prohibited without contacting support@microchipc.com for permission. All content on this site created by Shane Tolmie is copyrighted by Shane Tolmie 1999-2009. Click to advertise on this website - $29.90 for a banner ad which will reach 55,000 user sessions per month. One months free trial!