I have half an hour spare (and no life) so I thought I'd post a few tips here for the newer users to pic's and pic programming.
So here goes Mav's top tips.
KNOW YOU PIC
A huge bulk of the questions asked on the forums are down to people not reading data sheets on the pic they are using. Data sheets for every PIC can be found at www.microchip.com , and these should be your first port of call.
Even before you think about code you should read through the data sheet and try to understand it back to front, when coding keep a copy of the datasheet handy at all times as this will be your holy reference book.
For example if you are going to use an 18F452 on your project ,, have it's data sheet next to you at all times as although the PDS documentation guides your hand very well , it isn't meant to explain the slight difference, registers, hardware modes on every chip, thats what the data sheets are for.
Also have the data sheets for any other chip you may be using ,, be it logic expander , led driver , whatever ,, they are essential reading.
THINK OUT YOUR GOALS
What is it you want to acheive with a project ? What external components to the PIC will be required (if any) to acheive this goal ? Write down or at least mentally note what your trying to do in the first place . It sounds silly but this can really help you keep mental clarity as your trying to acheive these goals.
DON'T BITE OFF MORE THAN YOU CAN CHEW
It's a common mistake for new users to try to reach an advanced goal on their first project like an uber tracking system or a robot with sensors to detect everything and it's dog, this often ends in failure and frustration because they don't understand pics or programming enough to realise their concept, it kills confidence and the fun of it.
Start small and work your way up, even a professional programmer will tell you their first program was "hello world" and if they say otherwise they are lying.
Learn to walk with it and become comfortable with the basics ,, then do a bit of jogging with something a little more complex ,, you will be sprinting with the rest of us soon enough.
SMASH IT UP
I don't mean literallybut it can be handy when you do progress to something a little more complex , to break it down into blocks, figure out each block (for example interfacing to a memory) and once you have it cracked move to the next (say interfacing to a h-bridge) once you understand all these individual bits , it's a lot easier to pull them all together into a complex project.
LET MR SPOCK BE YOUR GUIDE
Try to think in a logical manner A leads to B leads to C , any digital system , PIC's included by their nature work this way , everything in the universe is based around rules PICS even more soPICS execute commands in a linear fashion 1 then 2 the 3 and so on.
When your dreaming up your next project let your imagination run wild ,, once your down to coding ,, become as mr spock ,, logical just like the pic.
If you can learn to think this way code becomes easy.
MR SPOCK SAYS "PSEUDO CODE IS LOGICAL"
I know it old fashioned but pseudo code can really help to get your aproach to real code right in your head.
Pseudo code is code you make up that simply outlines the process of the real code, and example might be
Variable a is 50
variable b is 20
if variable b is greater than a then jump to the motordrive code
otherwise end the program here
one of the great advantages of basic is that it isn't a kick in the nuts away from pseudo in itself.
The very act of writing this babble can get your course of action straight in your head and save confusion as to what you were actually trying to achieve once you deep in code and data sheets. Flowcode is the same if you find it more comfortable.
DON'T ASK UNTIL YOUR STUCK
Everyone here is happy to help our legitimate brethren.
BUT try to work a problem out yourself , search the data sheets , read the manual , search the forum (as many things have already been covered), do a google , read a book.
It's easy to just jump on the forum and ask , but you will learn far more if you try to figure out a problem yourself and it's far more satisfying and will serve you better in the long run, if the answer is handed to you on a plate ,, you may not understand HOW the answer works. If your stumped after that then by all means ask ,as one of the guys here will have been there , done that and bought the T-Shirt.
FRUSTRATION IS THE ENEMY
Try not to get wound up when things don't work as you thought they would ,, see it instead as a challenge , a frustration clouded mind often just makes things a lot worse as it saps your ability to think logically.
Try to stay calm and collected even when smoke pours forth from your circuit
try to think "oh well I made a mistake , i'll figure it out and learn from it"
It might seem silly to mention this as a tip , but trust me frustration leads to huge errors of judgement and not only is it stressfull but can really put the mockers on a project.
Hi, its great to see you visiting our forum. Why not try Proton Compiler for FREE?
Download the FREE version of Proton Compiler, Its called Amicus18 and its available from HERE
Already using proton Compiler??? Get rid of these pesky messages... get LICENSED USER STATUS
GOOGLE IS A MAN'S BEST FRIEND
All hail the mighty google.
If your looking to achieve an end ,, google it ,, you can find masses of information to help you understand how to get to that end, even if the results don't relate to pics directly the underlying physics are always the same.
DON'T SCREAM BUG
Bugs are very rare in PDS and the chances are that if something doesn't work as you expect it too ,, your doing it wrong. Screaming BUG at the first obstacle will just get poor Les (the writer of PDS) upset and get on everyone's nerves. Thats not to say that the very rare occasional bug may crop up , but statistically the chances are it's a fault on your part not the compiler. Investigate and deliberate before you shout bug, if it is a bug you have found , write it up in detail and it will be fixed.
HAVE FUN
Most important is to have fun while your coding and designing ,, feel free to chuff out your chest and give yourself a huge pat on the back every time you figure out a new thing. Take pride in flashing a few Led's , revel in your successes and brush off any failures (and pretend then just didn't happen).
Anyway they are some of Mav's top tips , that rate high along with "never drink yellow snow at Christmas" and "Conduct a life of celibacy and emotional solitude without joining a monastery by simply living with my wife. It's more comfortable and you'll be able to watch TV and use the internet." and "Half a cocktail stick with a blob of nail varnish on the end makes an ideal "safety match" that your children can play with without the risk of setting fire to anything."


but it can be handy when you do progress to something a little more complex , to break it down into blocks, figure out each block (for example interfacing to a memory) and once you have it cracked move to the next (say interfacing to a h-bridge) once you understand all these individual bits , it's a lot easier to pull them all together into a complex project.
Reply With Quote




and Mav wants to do good practicing ( I fully agree of course) 
