PDA

View Full Version : Newbie migrating from Basic Stamp to PIC



gertlind
- 2nd October 2013, 09:53
Hi Forum

Im thinking of migrating from Parallax Basic Stamp to PIC.
Probably going to buy PBP3 Silver but there is one thing that i havent figured out if it works.

Is it possible to step through the program and do like "debug print" to see values on variables and so?

---
Gert

HenrikOlsson
- 2nd October 2013, 11:32
Hello Gert,
Welcome to the forum!

Yes, it's possible in a couple of different ways.

If you use the MicroCodeStudio IDE it comes with a "soft" In Circuit Debugger with which you can set breakpoints, watch variables etc. For this to work the PIC has to have an on board USART and you need a level shifter (MAX232 etc) between the PIC and the PC. For more information look at this page. (http://www.mecanique.co.uk/shop/index.php?route=product/category&path=20_62) Note that there are two versions of MicroCodeStudio, a free one and a, well, not free one. The free one comes with a smaller amount of ICD models. The drawback of this approach is that when the program is compiled on "debug mode" it occupies more space in the PIC as it otherwise would and it doesn't run as fast because the code that handles the ICD uses up a bit of the processing power. It's a very handy way though.

The next option is to do it manually, ie write the program so that it outputs your variables etc at specific time. Not that flexible but sometimes it's all that's needed.

The most powerful option is to used a hardware in circuit debugger like the PICKit3 or Microchip ICD3. This provides all the features of the "soft ICD" without the added overhead and need for a level shifter. It's more complicated thogh and requires that the compiler is integrated as a tool in MBPLAB, which is Microchips IDE (available at no cost).

/Henrik.

gertlind
- 2nd October 2013, 13:29
Thanks Henrik

Would a PICKit2 work in your last option? I got one of those.

towlerg
- 2nd October 2013, 13:45
Or you could use simulation, Proteus, Oshonsoft etc. You draw your circuit diagram in the application and this creates a model in which the simulator allows you do do all your single stepping, variable monitoring, breakpointing etc. etc. The downside is cost and whatever imperfections are in the simulator, the upside is pretty good and will over a period recover some or all of that cost. A short list of the positives - no development system to buy, freedom to move between microcontroller families, almost instant circuit changes, cost savings on components (you only buy the bits you need). Simulation is built into Microchip's IDE, but its not visual and realy not intended for ... well now I come to think of it, anybody (IMO Microchip make good components and terrible PC software). BTW the new Java based ide, MPLABX is even worse. Personally I use Proteus, it can do mad things like breakpoint on a voltage level. Most simulators will also allow you to produce a PCB. Hope that helps George

HenrikOlsson
- 2nd October 2013, 14:13
Gert,
Yes, PICKIt2 works but I think they (Microchip) doesn't add any device files for it anymore so new(ish) PIC devices won't program or debug from within MPLAB. I do think the standalone application allows you tp program newer devices though. I don't use MPLAB myself so I haven't really kept up - and I've got a PICKit3 so....

I really wish MELABS/Mecanique would add (if at all possible, I don't know) support for hardware level debugging to MicroCode Studio, or produce a detailed how-to-guide on how to set it up within MPLABX. I've never been able to figure it out..... Don't let that put you off though - it IS possible to do!

gertlind
- 2nd October 2013, 15:13
So if i buy the PBP3 Silver I can go on from there?
I saw that the Microcode Studio + wasn't that expensive so I probably go for that at the same time.

Maybe im a bit spoiled with the Basic Stamp and being able seeing what goes on in a very simple way.

HenrikOlsson
- 2nd October 2013, 16:50
Hi Gert,

So if i buy the PBP3 Silver I can go on from there?
Yes, absolutely....
But is there a specific chip you want to program that the silver edition supports? Note that the silver edition doesn't support 18F series or the newer 16F1xxx series. The student edition supports an even less number of microcontrollers but it DOES support a couple from each family (except the 10 series), which might be handy, and it's even cheaper. If I were you, and there isn't a specific chip you're targeting for which you NEED the silver edition, I'd consider the Student Edition as a start but also making sure it's possible to upgrade to Silver or Gold if/when the need arises.


I saw that the Microcode Studio + wasn't that expensive so I probably go for that at the same time
While looking around I saw that Mecanique (the authors of MCS) give you MicroCodeStudio PLUS for free when you buy PBP3 from them - worth considering!


Maybe im a bit spoiled with the Basic Stamp and being able seeing what goes on in a very simple way.
I'm not sure how in circuit debugging works on the Stamps these days, feel free to enlighten me though.
What I can tell you is that I started playing with a BS1 ~20 years ago, quckly moved on to a BS2, then got PBC and later PBP after which I've never looked back. Once you get up to speed with PBP I honestly don't think you'll miss the Stamp. But you need to keep in mind that with the power and flexibility of PBP (but mostly all the devices it supports) comes a little bit of complexity compared to the Stamps. Lots of people here to help if/when needed though!

/Henrik.

gertlind
- 2nd October 2013, 19:46
Ok, got the Silver and the IDE+.

However, after some hours fiddling around and Googling I managed to get PBP3 to work with MPLABX IDE :-)
Compiled and run a small test program on the Pickit2, and guess it worked.

Could have save a few buck not getting the IDE+ and gone for the Gold instead.

Time start reading some PIC datasheets and actually understand what im doing. This is going to be fun, be prepared for a lot of stupid questions.

First project will be a snow depth meter (I hope).