maybe getting into PIC

Discussion in 'Embedded Systems and Microcontrollers' started by strantor, Sep 16, 2011.

  1. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    Ok, so I have been using Arduino for all my μC needs until now. Now I need high speed PWM which Arduino lacks. I have been steered toward PIC but I am not looking forward to another steep learning curve. I have seen some "starter kits" out there but I don't know which way to turn. Seems the world of PIC has more options. What would be the easiet & cheapest route for someone with a little (little) bit of programming experience? It would be nice if whatever "starter kit" was capable of 20khz PWM.
     
  2. nickelflipper

    Active Member

    Jun 2, 2010
    280
    35
    I can't let this go by without commenting, but I would be stunned that the Arduino couldn't 20 kHz PWM. The underlying AVR mega168, or 328, has a 16 bit timer with two seperate registers, meaning two different PWM's of the same frequency.

    I'm all for PIC's, but why spend the cash and time learning a new system, if the current platform is perfectly capable?
     
  3. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    DOH! I love you.
    I found this initially:
    http://www.arduino.cc/en/Reference/AnalogWrite
    So I thought I was limited to ~500Hz PWM.

    You prompted me to search further and I found this:
    http://www.arduino.cc/playground/Code/PwmFrequency
    So looks like I'm back to "I'll learn PIC some day"
    Thanks a bunch!
     
  4. nickelflipper

    Active Member

    Jun 2, 2010
    280
    35
    There you go:). They must be using Timer interrupts for adding the additional PWM's.

    If curiosity gets the cat, then a PICkit 3 programmer with a companion starter/debug board would be a good way to get acquainted with PIC's. I'm still with the PICkit 2, and it handles nearly everything but the most recent devices. Also, very few of the PIC32 devices are supported by the PICkit 2.
     
  5. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    I'd still suggest learning PICs, you already have the concept of ports down, in addition to general code concpets.

    You can put that to great use using an 8 pin PIC for a small project where an Arduino would be severe overkill and a waste of money.

    Total investment to get started (PICKit, 44 pin Demo Board, BoostC or Boost BASIC): About $60 with shipping.
     
  6. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    Is boostC similar to the arduino language?
    My programming experience came from using MS visual Basic back in 1997-99 time frame. then I never programmed again until I picked up the arduino last year and I picked it up pretty quick. They say arduino is close to C, and I've read that the basic used to program PICs is nothing like visual basic. I would be looking for whatever is closest to Visual Basic or arduino
     
  7. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Most of the language elements are the same, such as code layout, functions, etc.

    The big difference between compilers is the "Standard Library" of functions that come with the compiler, such as A-D and PWM routines to run on uCs that do not have hardware PWM.

    I use BoostC for hobby stuff since it is cheap to free and easy to learn. Their version of Basic is more like Visual Basic (object oriented) than BASIC Stamp BASIC. For smaller projects, you can use both for free, and for $5, mid sized projects won't be an issue. It gives a great "bang for buck", IMO.

    Also take a look at code for CCS and Hi-Tech C, those have shipped with Microchip in the past (lots of Hi-Tech), so there is a ton of code out there to use snippets of.

    I love PICs, but have recently gotten an Arduino as well as a PIC Axe board too, once you learn the "new name for similar function" in each, the major difference is price. The more user friendly the programming is, the more it costs. This is true with straight PICs as well, but the compiler is a one time hit, and not something you need to buy for every single project.
     
    strantor likes this.
  8. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
  9. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    I think it started out as a build on the Atmel processors. from the site you linked, it looks like they took the arduino idea, swapped out the Atmel with a pic and are marketing it as such.
     
  10. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Then you are still back to putting a large amount of money into a board for a project that only requires 2 inputs and 2 outputs. A standalone 8 pin PIC on perfboard would be under $5 and do the same task.

    They are all good development platforms, and I think everybody should sample them.

    I look at the Arduino and PICAxe boards as "tinker boards", something to re-use between ideas, rather than a solution for a project.

    When it comes to an actual project or product, it's often easier to only include circuitry that is pertinent to the function of the project. When designing a product, even pennies matter to keep the price down when building 10,000 units.
     
  11. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    Ok, now back to this PIC thing; For my motor controller and I have been recommended to use the dsPIC30F3010 as the microcontroller. I have never used a PIC device before so I am looking for a kit with all the essential stuff to get me started.

    programmer cost 900$ (what is this? why is it so expensive?)

    will the pickit perform the function of the 900$ programmer?
    will the pickit support the dsPIC30F3010? - things I've read say yes, but I want to make sure.
    Dave jones said in this review that the pickit3 does not support external programmers, only MPLAB (189$). is he referring to things like boostC and boostBasic? What is mplab?
    All the other things I find when I google such terms as "dsPIC30 kit" are evaluation boards and prototype boards.
    I don't want a pre-made board. All I want is a kit with all the necessary bits to build a circuit on a breadboard and get the thing online and start programming it & interface with the rest of my circuit.
    any recommendations? I know there has to be somebody out there throwing marked-up kits together.
     
  12. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    For motor control, you only need the 8 bit PIC, the 16F or 18F line of PICs.

    You are looking at the 16/32 bit line of Microchip processors. The development for those costs quite a bit.

    The 16 bit dsPIC can be programmed with the PICKit 2, so the startup cost is $100 instead of $50 for the PicKit 2 + 18F45k20 44 pin demo board. The compilers mentioned will also cost more for the dsPIC family, they are meant to run very speedy for digital signal processing.

    If you are getting into it at a hobby level, it will be a long time before an 8 bit controller is unable to do what you'd like it to. Arduino/AVR uCs are also 8 bit.

    --ETA: dsPICs are more like a microprocessor in some aspects than a microcontroller. dsPICs have dozens of interrupts, 16 registers, a deep stack, Floating point math, hardware matrix multiply, etc built in. So a new compiler is needed for these, and they are generally spendy, as the people using these work for companies that buy the user the compiler and all tools.
     
    Last edited: Oct 29, 2011
  13. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    The microcontroller skills I posess are hobby-level (or slighly below, limited to arduino actually) but the controller I'm building is 100V 600A, slighly above what most would consider hobby-level.
    I will quote the recommendation in question (from another forum) and point out the why. first, my comments:
    and his recommendation:
    So that's all I'm basing this "need for dsPIC30F3010" on. All I need out of the PIC (or any uC) is to be very fast at detecting overcurrent. either that, or eliminate the microcontroller from the current control loop entirely, which was my original plan before this recommendation. is there a similar pic that can instantly kill the PWM output with no processing delay?
     
  14. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    What!!!! 900$....:eek: That sales person is dodgy as used car salesman. Do not ever listen to that person ever again. MPLAB is a free programming enviroment for PICs. You can do all your coding,debugging, and chip programming from that enviroment. As you are a beginner with PICs I would perhaps recommend this one http://www.microchipdirect.com/ProductSearch.aspx?Keywords=DV164131 about 70$ It comes with demo board and some lessons. Then your are done toying with the demo board. You can move to your own design. The PICkit 3 can now also reprogram any flash based PIC microcontroller. I think all PICs have flash based variant nowadays . You use the ICSP interface. That is no more than 5 pins. No problem doing your own design on bread board if that is what you want.
     
  15. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    ah thanks; I didn't know mplab was free. I am downloading it now and play around with it to see what I can see. Note however that the 900$ device I linked to is not software; looks like some kind of desktop thingamajig that does something. I was unsure if that's needed hardware or maybe it's for mass production/programming of thousands of chips?

    so if I get the pickit3 you linked to,play around with it, then move to my own board design, I will need to make sure I get a pic chip that is flash-based? or else I won't be able to program it with pickit3?

    the pickit3 sales page says:
    and the page for MPLAB download says:
    does that mean I could use the pickit3 to program the dsPIC30F3010? or would I still need to buy something else?
     
  16. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    With a tiny amount of external hardware yes, though you might call it cheating. Many PIC processors have a built-in analog comparator, just comparing the levels of two voltages and driving an external pin (the processor has access to this output also, and can be interrupted by it). So you could use the comparator to say "Overcurrent shutdown" and override the PWM output. Of course it's doing exactly what an external comparator could do, but if you want a "pic that can instantly kill the PWM output", that would do it.
     
  17. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    A lot of PICs have the Enhanced CCP module which has automatic shutdown based on a comparator, logic input or by the program.
    Have a look at the PIC16F887 datasheet, section 11.6.4 as an example.
     
  18. strantor

    Thread Starter AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    Ok, I'm getting myself more confused as I read this stuff. I though MPLAB was all I needed to program the PIC. now I'm reading that it doesn't include a "compiler" so I searched the microchip website and the C compiler is 495$!. So I guess this is where your BoostC/BoostBasic reccommendation comes into play? Are the boostbasic/boostc programs "compilers" that I need to use in conjunction with MPLAB in order to program; or are they standalone programs? how does this work if Dave Jones said that the PicKit3 only works with MPLAB?
     
  19. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    That's neat, I hadn't noticed that feature. So yes, the processor can shut down the PWM output on the basis of a comparator output.

    The MLAB program isn't a compiler. It's sad but true that one advantage of the AVR chips over the PIC ones is that you can get a pretty good free compiler for the AVRs. The Hi-Tech C compiler has a free version, but I don't know what it includes or leaves out.
     
  20. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en534868
    Take a look here. All the listed compilers have a LITE mode. That is free. The Lite compilers are freeware compilers provided as a low-cost tool for all purposes. These compilers have no time or memory limitations, however most code optimizations will be restricted. You will also get a 30 or 60 days trail period with full optimizations
    By the way MPLAB will allow assembler programming for all PICS with no C compiler installed
     
    strantor likes this.
Loading...