Go to last post By: shantanu@india
Today 07:06
Forum: The Lounge
Starter: shantanu@india
Views: 13
Replies: 0
Yesterday 23:57
Forum: Proton Plus Compiler v3
Starter: pic-ignorant
Views: 55
Replies: 2
Yesterday 19:52
Forum: Proton 24
Starter: johngb
Views: 47
Replies: 3
Yesterday 17:57
Forum: Proton Plus Compiler v3
Starter: towlerg
Views: 49
Replies: 1
Yesterday 12:34
Forum: Proton Users File Server
Starter: Les
Views: 77
Replies: 0
Go to last post By: ricardourio
Yesterday 12:19
Forum: Projects discussion
Starter: ricardourio
Views: 316
Replies: 11
+ Reply to Thread
Page 1 of 6 123 ... LastLast
Results 1 to 10 of 55

Thread: Mavericks Top Tips for Newbies3284 days old

  1. #1
    Super Moderator Maverick's Avatar
    Join Date
    Sep 2002
    Posts
    2,338
    Thumbs Up
    Received: 18
    Given: 3
    Total Downloaded
    0

    4 Not allowed!

    Default Mavericks Top Tips for Newbies

    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 literally 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.

    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 so PICS 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.

    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."
    [SIGPIC][/SIGPIC]

  2. #2
    Member Daniel's Avatar
    Join Date
    Apr 2004
    Posts
    121
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    0

    0 Not allowed!

    Default My Top Tip's

    1. Read the manual...

    Now we are all guilty of not doing that, but it will save hours of frustration and wasting of time.

    2. Read the data sheets...

    There is no excuse for not doing this (for any device). The data sheets are so readily avilable on the net these days.

    3. Don't be afraid to ask questions...

    That's what the forum is for, there is a great deal of knoledge within these pages and we are all happy to help.

    5. Make templates for all the PIC's...

    I have made template programms for all the PIC types that I use. This is just the first bit of the code that configures the PC type, speed, registers, I/O's, ADC and comparators. This saves a lot of time.

    Whilst I am here... This is still the best compiler on the market...

    Daniel.

  3. #3
    Senior Member billyminor's Avatar
    Join Date
    May 2007
    Posts
    848
    Thumbs Up
    Received: 12
    Given: 5
    Total Downloaded
    0

    1 Not allowed!

    Default

    Nice list Maverick thank's
    Daniel would be nice if you posted those Templates as they would be handy and useful to see by a lot of people here because that's where a lot of people make their first mistake(myself included)
    Brian

  4. #4
    Prolific Poster cgriffin's Avatar
    Join Date
    Oct 2003
    Posts
    1,387
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    0

    1 Not allowed!

    Default

    One thing I've observed is that many newbies are intimidated by a 400 page datasheet, and do not know where to start. If somebody had the time to write up a Datasheet 101 tutorial, I'm sure that would help ease their anxiety.

    I especially like your "pseudo code" description. Many newbie questions are quite vague in their questions because they haven't really figured out a detailed description of what they want to do, and therefore have no clue as to how to start.

    I would add this, though...

    START WITH A DEVELOPMENT BOARD THAT INCLUDES SAMPLE CODE.
    Then modify the code a little at a time. This could probably eliminate a majority of the newbie issues.

  5. #5
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,800
    Thumbs Up
    Received: 46
    Given: 83
    Total Downloaded
    166.82 MB

    5 Not allowed!

    Default

    Just to add my 2 cents worth from my experience

    Coding

    1 Start simple and add to it bit by bit testing every step of the way.
    2 I'm sorry to say it but reading the manual is a must, but use the on line help and do searches its easier.
    3 Use the Free VSM's, its dead easy to test code in them. Just write include "protonxxx.xxx" at the top to include the right type freq of pic etc
    Don't think ISIS does not have my chip, think how can I test that bit of code in ISIS and adjust to suit. Its not longer a mystical little black chip with it.
    If you have an RS 232 on board use the free version of P-ICD you can always shift the vars you want to view around to keep them in the 25 you can see

    Getting help
    1 The only thing that beats getting your own experience is using some else's
    2 Remember that were all human, if you talk to some one with attitude you will get it back. If you say look I'm having a lot of trouble could you give me some guidance... will get people trying to be good guys and help you out.
    3 Include all the info you have eg the PIC, what's happening what's not etc.
    4 Some times we do not know so try asking another question we might be able to help with that and solve the first issue in the process, were not trying to blank you promise
    5 The forum is a massive repository of info but it can be impossible to find what you want even though its in there. So try asking if it has been brought up before and ask for pointers to threads about it. Some of us are real sad and can remember a lot of trivial info and can find just about anything
    Tim

  6. #6
    Senior Member dolci's Avatar
    Join Date
    Aug 2002
    Posts
    468
    Thumbs Up
    Received: 1
    Given: 0
    Total Downloaded
    77.35 MB

    0 Not allowed!

    Default

    I've read this somewhere and I want to share...

    Microcontroller Design Printed Circuit Board Design

    Placed each component as close as possible to each other as this will reduce the looping and tracks and hence the parasitic and capacitive inductance will be reduced. Each loop or track will radiate and absorb energy once it is exposed to a variation of current, voltage or electromagnetic flux.

    Place the crystal or ceramic oscillator as close possible to the microcontroller. The tracks used to connect the resonator to the clocks should be as short and close as possible.

    As far as possible, do not use any socket between the MCU and the PCB. Use of socket introduces parasitic inductance and capacitance to the circuit.

    Use a 0.1uF ceramic capacitor across the power supply(VCC-Ground) of each integrated circuit as a high frequency decoupling device. The capacitor should be placed as close as possible to the integrated circuit.

    IO ports of MCU that are not used should be tied to Ground or connected to VCC through a high impedance resistor (100-200 kohm). This is to reduce the effect of voltage spike to the unused port that may cause wrong logic to be read by the MCU.

    Separate the grounding of digital and analog tracks.

    It is good to put a large ground underneath the MCU to create a stable tank to divert the noise to the ground.

    In critical application, use a reset IC that will reset the circuit once the power supply drops below a certain level.

    The power supply to the system should be stable by using large filtering capacitors and bypass ceramic capacitors and ensuring that the ripple is minimal(less than 100mV).



    Microcontroller Design Software Consideration

    As far as possible, try to reconfigure the ports configuration, timer configuration and other registers regularly in the software loop. In a noisy environment, the setting of the registers may be flipped and changed from input to output and vice versa.

    Place a certain value in the RAM of the MCU and check for its integrity regularly. If the values changed, it means that the noise have altered the values and the integrity of the rest of the RAM is questionable. You may make a decision to reset the RAM to a predetermine value.

    Use a MCU with a hardware reset watchdog feature. A timer routine is placed in a certain part of the software where it will be refresh at a certain time. If this is not updated, it means that the program has runaway and a hardware reset should be triggered.

    Unused memory should be filled with "1111...." or "0000...."

    Unused program memory should be filled NOP(No operation) instruction codes. This is to ensure that if the program counter of the MCU is corrupted and jumped to these areas of the program memory, it will not end in endless loop.
    [SIGPIC][/SIGPIC]

  7. #7
    Fanatical Contributor pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    3,022
    Thumbs Up
    Received: 29
    Given: 26
    Total Downloaded
    757.59 MB

    0 Not allowed!

    Default

    Hi Dolci,
    That is some very useful information thank you.
    Re. IC sockets, I have had that problem with a 16F690 in a socket. My project would run for days, and then for no apparent reason, the PIC would get uncomfortably hot, and the circuit would stop working. I spent hours looking for a problem, and eventually decided to solder the PIC into the board. Touch wood, it has be fine since.
    With regards to grounding, I spent a long time reading about this, as I had some 24v components being controlled by a PIC, and wasn't sure if isolating, or commoning the logic and 24v grounds was best. At the moment, I've commoned them, without any problems (No analogue signals involved). I would be interested on the views of some of you more experienced guys, on this..

    Regards
    John

  8. #8
    Super Moderator Maverick's Avatar
    Join Date
    Sep 2002
    Posts
    2,338
    Thumbs Up
    Received: 18
    Given: 3
    Total Downloaded
    0

    1 Not allowed!

    Default

    Good advice well done that man

    Recently I have been helping a newbie out and have noticed another very important thing that new users miss.

    This shall be you mantra

    SLOWLY SLOWLY CATCHY MONKEY

    Don't RUSH a circuit or PCB even if you have deadlines ect.
    PCB work like programming is an art form and like any true art it takes time.

    If you are new to soldering and PCB's watch a few tutorials
    is quite a good one
    Also read a few tutorials, see the various methods , then practice makes perfect.
    Like sex ,to be good takes practice and technique if you rush it it will end in disaster.

    Remember than the tiniest short circuit , or an underetched track can render a PCB useless and cost you a boards worth of components !! Check , Check and when your certain its right ... CHECK IT AGAIN !!!!!!! only then should you apply power.

    I cannot over stress this tip enough ,, you MUST take your time , otherwise you will loose heart with failures that could be avoided if you GO SLOW

    99.99% of the time ,, taking your time will save you time in the long run.
    Better to take an entire day over a single board and have it work , than to spend a week making board after board because of avoidable errors due to rushing,, it cannot be rushed.

    As your confidence builds up and you get your technique down , the time spent will shrink over time.

    The same applies to coding as mentioned earlier ,, take a slow methodical approach ,, spend your time commenting code , this will save many hours later down the line.

    Read the examples provided with PDS ,, understand the language and how each command works. Start small and build up complexity NEVER start your foray into pics with a complex project, you will set yourself up for frustration and disappointment. Start simple work towards complex.
    [SIGPIC][/SIGPIC]

  9. #9
    Fanatical Contributor fanie's Avatar
    Join Date
    Oct 2005
    Posts
    8,447
    Thumbs Up
    Received: 13
    Given: 6
    Total Downloaded
    0

    0 Not allowed!

    Default

    He he... I always enjoy the comments... like Tim thinking everyone is human and Mav wants to do good practicing ( I fully agree of course)

    I would like to add another in my opinion important issue to keep in mind,

    Choose the right pic for the job.

    I see so many guys that does start slower and small with ie a 12F675 doing the flashing led thing and then he adds the four digit seven segment flicker free, usb to the PC, Rx & Tx dtmf from a pin and dimming and brighting some power lamps while plaing the wire loop game at the same time.

    Some pics can handle certain tasks, others just doesn't have the resources. A little planning save a bunch of time and costs.

    Some things are done easily and requires little code and even almost no programming knowledge to to, other seemingly innocent and seeming easy operations can be nightmarish to do. There is good reason why we wear glasses, and bald early and it's not because as Mav suggested that fast turning under the sheets

    He he... I think I scared everyone off that still had some hair left... sorreeeey
    [B]Fanie[/B]
    [B]FAZE[/B]
    73 de ZS6FAZ
    [URL="http://fanie.cambs.net/"][COLOR=#221f1f]http://fanie.cambs.net[/COLOR][/URL]
    Stick to pic [SIGPIC][/SIGPIC]

  10. #10
    Fanatical Contributor pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    3,022
    Thumbs Up
    Received: 29
    Given: 26
    Total Downloaded
    757.59 MB

    0 Not allowed!

    Default

    Just a thought, but would a FAQ section be a useful addition to the forum? I'm sure a lot of newcomers (Including myself) would benefit from this, and maybe a troubleshooting guide?
    I don't mind typing it up, if others will help with answering the initial questions
    Regards
    John

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. GPS Article for newbies
    By ADLIN SYSTEMS in forum GPS
    Replies: 14
    Last Post: 26th August 2012, 14:38
  2. More tips for newbies
    By ADLIN SYSTEMS in forum Absolute Beginners Section
    Replies: 7
    Last Post: 23rd November 2009, 16:53
  3. Lap top lcd inverters ? how are they controlled ?
    By Kapitan in forum The Lounge
    Replies: 11
    Last Post: 1st April 2009, 11:46

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts