basic vs c vs assembly


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2007
    Location
    Philippines
    Posts
    9

    Default basic vs c vs assembly

    im just wondering what are the advantages programming microcontrollers with BASIC vs doing it with C or assembly..
    Does one of them make it easier to deal with the peripherals such as usb, spi, I2c, etc?
    Does one of them make the learning curve between programming PIC12, PIC16, PIC18, PIC32, etc easier?
    I know that supposed to be the size of the program written in assembly is the smallest while the one written in basic is the largest, but is this really a big deal?
    and what are the other benefits of each?

    I actually knew a little bit on how to program PIC16xx in basic 8 years ago when I joined this forum, but ever since then I stopped. Then I learned a bit how to program in c and in assembly but i have completely forgotten how to do it using PICBASIC so im wondering if i should try to learn it again. I have forgotten everything that I used to know.

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: basic vs c vs assembly

    I can't comment about C, never could wrap my head around it.

    Started with BASIC back in '78, worked in COBOL since I graduated. Starting with PIC BASIC a few years ago was a breeze.

    You'll find just about anything you need for PIC BASIC here and on MeLab forum. I don't know if there's as much material for C.

    If you plan on using PIC 32s, then I think you might as well stick with C. As for 10-18F PICs, BASIC or C should be the same.

    Robert

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: basic vs c vs assembly

    As for Assembler, both BASIC and C get converted to Assembler and then machine code by the compiler. So Assembler gives you access to functionality not covered by BASIC or C. Do you need that "power"?

    There's not a lot of examples on google in Assembler. If I had started programming PICs when I graduated in '83, I would have used Assembler (was 2nd in class).

    But today, for "semi-pro hobbyist" use, PIC BASIC has all the features I need. As far as I know, PBP can access all features on a PIC one way or another.

    Robert

  4. #4
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    966


    Did you find this post helpful? Yes | No

    Default Re: basic vs c vs assembly

    Assuming you are equally new to each of the languages, this is what you would encounter.

    Assembly is the lowest level code and is the hardest to master. The time taken to deliver a project maybe the longest if you use assembly language. However, it is akin to driving a Top Notch racing car and you can get the best output if you know how to use it.

    Basic is a (HLL)higher level language. It bundles a group of assembly language instructions into a single HLL command. Time taken to deliver a project is many times faster compared with assembly. There may be limitations on the math you could possibly do with basic. You need to check the specific dialect of basic you use to see if it allows you to handle integer, floating point math. Most low cost basics are simply integer basic. No support for floating point math. Many dialects including PicBasicPro have commands to handle various peripherals.

    C is a more universal HLL. Similar to basic, it bundles a group of assembly language instructions into a single HLL command. Time to deliver is comparable with what you could achieve with Basic or any HLL. Most C dialects would support floating point math which may be needed for that once-in-a-while project. The biggest advantage you get with C - most code snippets online across microcontrollers would very often be in C. So, you are in a crowd and will get example code easily. You need to choose a dialect that has commands to handle the peripherals you use.

    Whichever language you choose, be sure your compiler supports inline assembly so that you can tweak code when you really need to. If you code for a living, any HLL is better than assembler since you can code that much faster. The compiler takes care of the data sizes and most times you do not have to remember if you are adding 2 bytes or a byte and an integer etc.

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: basic vs c vs assembly

    N-bit math thanks to DT:
    http://www.picbasic.co.uk/forum/showthread.php?t=12433

    (Links in chat for 32 bit multiply & division by DT)

    Robert

  6. #6
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: basic vs c vs assembly

    Completely agree. If you've used either before, choose that one as the learning curve won't be so steep. "C" is taught in technical schools these days, so new grads are more comfortable with it. The same used to be true of BASIC. There are no technical advantages either way.

Similar Threads

  1. Moving from Basic Stamp and MIKROE basic to PicBasic PRO
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 40
    Last Post: - 6th March 2013, 05:27
  2. Mixing basic and assembly
    By ManInMotion in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd September 2008, 09:48
  3. from assembly to basic
    By shantanu in forum Off Topic
    Replies: 4
    Last Post: - 1st February 2007, 14:50
  4. How do you do this in Assembly
    By ice in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th May 2005, 06:47
  5. Assembly?
    By Dwayne in forum General
    Replies: 11
    Last Post: - 4th January 2004, 18:18

Members who have read this thread : 0

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