Is Picbasic good enough??


Closed Thread
Results 1 to 13 of 13
  1. #1
    rastan's Avatar
    rastan Guest

    Exclamation Is Picbasic good enough??

    Ive been debating this for a while now, and recently ive been trying out a c compiler for pic. I have come to this conclusion: PICBASIC IS EASY!!!!!!

    after many hours of struggling to come to terms with a C compiler and after hundreds of errors in programs, i realised that i had just managed to use the serial port. At this point i thought, "picbasic i loads easier than this". you could bang something out on picbasic that works first or second time in a matter of minuites, yet debugging C is a nightmare!

    but the question is:

    has anyone ever found that picbasic is not good enough for what they are doing?? if so, in what cases?

    because people that dont use basic say that its very simple and cannot handle complicated code, hence basic, but in my eyes, it is soooooo much easier.

    comments appreciated.

    cheers,

    phil

  2. #2
    toalan's Avatar
    toalan Guest


    Did you find this post helpful? Yes | No

    Default

    I agree Picbasic is easy, because it has support for most of the features, ADCIN,HPWM,Hserout etccc. With C you basically have to configure the registers yourself to access the hardare features. If you are not accessing the special hardware on the pic and just want to use the pic to crunch numbers then C is great.

    I have problems with basic being too slow for my application, so I had to change my approach to get reasonable results. It has kind of been a blessing in disguise because now my approach is much much cleaner and requires less extra circuits. It is kind of tough to get used to picbasic being pretty slow, because in normal programming on the PC, I am so used to the hardware being so much faster than required. But sometimes an extra challenge is good and makes you think outside the box, I do not even recal the last time I needed to optimize my code to run faster on a PC.

  3. #3
    Join Date
    Oct 2004
    Location
    Porto - Portugal
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    I have to agree with TOALAN!
    Most of the time we get in troubles just because we forget to think in terms of hardware/software relation.
    Probably we forget sometimes that each designs may need a different aproach.
    YES, PBP looks easy, it has good features built in, the support is very good, comparing with similar software I will give it an 8 (in a 0 to 10 scale - giving it a 10, probably Melabs would stop improvements)
    nomada

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Everything is in the coding style... using internal registers or few lines of code instead of some statements like pre-made ADCIN,BUTTON, HPWM and many other helps really... just be friends with Datasheets... everything is in.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    toalan's Avatar
    toalan Guest


    Did you find this post helpful? Yes | No

    Default

    there is a big problem with mixing assembly with PBP, many times when we use PBP we have no idea which registers PBP changes so when you do assembly that uses those registers things go wacky. For example if you use HPWM and want to use TMR2 for a counter driven interrupt things can screw up.

  6. #6
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    If you read the DATASHEET you will discover that the PIC requires use of TMR2 for timing PWM functions. If you used Assembler with Hardware PWM you would still need to use TMR2 - there's no escaping it. There are no secrets regarding what PBP does or doesn't do to registers behind the scenes - it's all in the DATASHEET if only people bothered to look at them for anything more than the pinout diagram.

  7. #7
    rastan's Avatar
    rastan Guest


    Did you find this post helpful? Yes | No

    Default

    ok, were not having a dig here, i just wanted to find out whether it was worth with sticking with learning C for pic or just stick with the nice and simple picbasic.

    cheers everyone

    phil

  8. #8
    Twasnow's Avatar
    Twasnow Guest


    Did you find this post helpful? Yes | No

    Default Ha, Mel is funny

    I agree though, people should understand the processor they are using at a level deeper than the basic programming langauge, we aren't programming away on glorified 3 million man hour operating systems that we can take comfert in knowing it will stop us from doing things too stupid. But that is just lazyness and doesn't really answer the question "is picbasic good enough", in a word or so the answer is forty-two. The important thing here is the question. No not 7 times 6, "is picbasic good enough for what?". You decide, depends on your programming ability, and your task. as a defence for C, in my opinion it is just as easy to write in as Basic, and I have yet to meet a C compiler that doesn't have a slew of I/O functions. or a useable debugger, but that said I wouldn't want to plop someone infront of a C compiler that doesnt' know A) anything about the chip and B) C language. where as basic, I could get my unborn nefew to write me up a simple program, (well in a few years, when he learns a little bit of english.)

    - my only suggestion, would be to include a little more code optimization at complie time (I am not even sure if there is any)

    Twasnow

  9. #9
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Like riding a bike your first time - it's only hard or intimidating until you learn it. C is similar to BASIC in many ways, but it does have a much longer learning curve.

    I recommend you learn assembly at some point also since you can drop-in .asm routines that will speed things up where canned functions aren't an option.

    C is a lot of fun, and a good C compiler offers a lot of built-in goodies you just won't find in any BASIC compiler, but the BASIC language is hands-down the easiest to start with & see immediate results.

    The BASIC Stamp is a good indicator. Lots of folks get started with the Stamp then migrate to more powerful (and much less expensive) alternatives like the PIC & BASIC compilers.

    Part of my job is evaluating compilers. PBP & Proton+ are the best (IMO) at present. CCS & Hi-Tech in the C category - with CCS being the best for beginners. Tons of examples with CCS to get you started.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  10. #10
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    The Parallax Inc."Basic Stamp" is a wonderful product for beginners.
    The Parallax Stamps in Class™ Education materials is great.
    The large majority of the new Micro Engineering Labs customers are
    also Parallax Inc. customers. The success of the PicBasic compiler is
    directly related to the success of the Basic Stamp module.
    If one day a Basic Stamp user will not feel at home immediately with
    the PicBasic compiler, then that day will be the end of the easy
    customers acquisition for Micro Engineering Labs. The PicBasic
    compiler will never lose its ties with the Parallax PBasic language.

    The PicBasic compiler is a great tool for the hobbyist, experimenter
    and professional. This compiler greatly reduces the software
    development time and the learning curve.

    Yes, Picbasic is good enough!

    Luciano

  11. #11
    Twasnow's Avatar
    Twasnow Guest


    Did you find this post helpful? Yes | No

    Default example

    Here is an example where you wouldn't want to use picbasic. at least I wouldn't.
    1) I am currently controlling DC 2 motors via an H-Bridge, each motor requires 3 outputs from the pic, Enable and two direction (both directions are needed for quick stop) I have to output two PWM's each are dynamic in pulse-width, depending on a speed selection for each motor, and an encoder feedback to ensure they go at the required speed, or to compare the two motors to ensure they rotate the same amount. The encoders are each pulsing up to an average of 2 KHz. The PWM pulses are output at a frequency of approx 4Khz. Every 200 pulses I recieve from the encoders (100 ms), I update the PWM. I get the commands (speed/direction for each motor) from another PIC via a 4bit bus that is also read every 100ms, I also output a status pulse when a task is complete.

    now maybe you could do this with basic, but I wasn't even going to try, I wrote this in ASM, but hey if I am wrong plesae correct me.

  12. #12
    toalan's Avatar
    toalan Guest


    Did you find this post helpful? Yes | No

    Default

    Okay here is an example that something that happened to me in Picbasic.

    For some reason Tmr2 was triggering an interrupt, even when disable the intterupt apparently some of the picbasic code was enabling it. I had no idea what part of the code was doing that, so I copied and pasted line by line into a new program and for some reason that stopped the tmr2 intterupt from being triggered.

    My point is that, I read the datasheet, but I do not know how exactly picbasic handles many of the registers.Honeslty previously i never read the datasheet and just plugged code into Picbasic, but now I read the datasheet I know exactly which registers I need to set, but sometimes Picbasic just overwrites my settings. I guess I could dump the Compiled program into ASM, but debuggin ASM based on someone else's interpretation on how to do things in ASM is just too much of a headache.

    Neccessity is the mother of all invention, I guess Picbasic in some of its shortcoming has forced me to learn much more about the MCU than I wanted to, which is a good thing in the long run but a pain in the short run.

    The PicBasic guys need to beef up their manual to show more advanced users what it is doing in ASM.

  13. #13
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hummm.

    PBP has been ok for me. It is powerful, yet somewhat easy to use. I am a professional programmer, using C/C++ with Borland Compilers. About the only complaint I have with PBP, is syntax of the functions. But I also realize that this is a difference between the compilers too!
    I prefer the following:

    for(c=0;c<10;c++)
    {
    if(c==5) then printf("Number is equal to %2d", C);
    }

    Opposed to something like this:
    For c=0 to 10
    if(c=5) then print("Number is equal to ",c);
    next c

    Then the added "endif" and "wend". when a finishing bracket in C takes care of it all.

    I have also noticed that some statements will show errors if they are on the same line. But if you put the exact statement on a second line..presto!

    in reality, it is not a "limitation" of PBP, but more of a Syntax difference. A difference that is harder for me to get used to, after programming 25 years in another language. Thus, it is not a fault of PBP, but a fault of the user (meaning me).

    I will say that pbp has done a wonderful job, and i clap my hands to the programmer.

    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

Similar Threads

  1. Need help deciding = BASCOM 0r PICBASIC
    By Chris DeHut in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 26th January 2006, 16:38
  2. Picbasic VS C Compiler
    By koossa in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th October 2005, 21:44
  3. Replies: 22
    Last Post: - 12th July 2005, 17:39
  4. PicBasic Fundamentals
    By Billyc in forum General
    Replies: 9
    Last Post: - 4th May 2004, 10:04
  5. PicBasic Pro & PicBasic syntax different
    By Billyc in forum General
    Replies: 5
    Last Post: - 16th April 2004, 21:19

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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