Connect with us

GNU C compiler PIC MCU's?

Discussion in 'Hobby Electronics' started by NK, Oct 18, 2004.

Scroll to continue with content
  1. NK

    NK Guest

    Ummmm I think the topic explains my question well :) I was really
    happy with the AVR GCC compiler but can't seem to find something for
    the PIC Micro's. Any leads would be greatly appreciated :)

    Cheers!
     
  2. Jeff

    Jeff Guest

    Then stick with the AVRs! AFAIK the PIC has never been targetted by
    the GNU compilers.

    Regards
    Jeff
     
  3. Dingo

    Dingo Guest

    see this thread
    http://dingoaus.proboards34.com/index.cgi?board=genelectronics&action=displa
    y&num=1092878126

    AFAIK The only thing that comes close is SDCC.
    Unfortunately the PIC's 35 intstructions means C is not able to be ANSI
    compliant. AVRs have over a 100 instructions don't they? AVRs were built
    from the ground up to be C compatible. PICs were not.

    Given that PIC only has 35 instructions though, it isn't like tackling intel
    assembler.

    Grab a book like "Easy PIC'n" if you want to learn the PIC assembler
    language from the very start
     
  4. Al Borowski

    Al Borowski Guest

    FYI, the Pic18 series were designed with C in mind. The PIC18's have ~75
    instructions, a user-accessible stack, more addressing modes, no real
    banking/paging problems, 3 file select registers, and lots of other stuff.

    Being PICs though, C still isn't a great fit.

    cheers,

    Al
     
  5. There are a few excellent ANSI C compliant compilers for all the PIC
    series, as good as or better than the AVR compilers, and they have been
    around for many years.
    The urban myth that C or ANSI C doesn't work on PICs seems to linger on
    for some idiotic reason.
    Tens of thousands of developers use ANSI C on PICs from the 12 series
    through to the 18 series every day.

    Dave :)
     
  6. Dingo

    Dingo Guest

    Yep the 12's and the 18's
    BUT unfortunately the 16's (which most amteurs / hobbyists usually use - or
    at least start with) certainly cannot handle ANSI C well

    Couple this with the fact that the original poster was coming from GNU C
    compilers for AVRs I assume he is not working for a company or that he wants
    to shell out $$$ for a compiler. Means PICs (and I mean 16s) won't suit
    his/her needs
     
  7. Rubbish.
    The 16 series handle ANSI C just fine. HiTech make an excellent 16
    series fully ANSI C PIC compiler.
    Having an architecture "optimised" for C is a different matter
    entirely.
    But even so the HiTech PIC-C 16 series compiler does an excellent and
    very efficient job on the 16 series. In some cases better and more
    efficient than C compilers on other chips that are more "optimised" for
    C.
    The cost of development tools is not the issue. They are available.
    Even so, the Hitech PIC-C compiler is available in a completely free
    version that suits several common 16 series devices.

    Dave :)
     
  8. Dingo

    Dingo Guest

    Pity HiTech wnat big $$$ for it - the free version is crippled beyond
    belief, certain specific chips not families of chips, and a limit on the
    amount of memory you can store.

    If you aren't prepared to shell out hundereds of dollars then there is
    nothing for you if you want PIC and C.

    I also read somewhere there is no way a port of gcc can be done to PIC
    without re-writing the compiler completely.

    As for your statement "The cost of development tools is not the issue" then
    why do you think the author of this thread titled it "GNU C Compiler PIC
    MCU's?" and the first post starts "Ummmm I think the topic explains my
    question well :) ". I don't think one has to have ESP to work out the author
    is looking for a free compiler because cost is an issue!

    If you want to start a separate topic called "PIC can do C too - just get
    your wallets ready" then be my guest!
     
  9. NK

    NK Guest

    Thanks for the responses all :) I've actually picked up a copy of easy
    pic'n and thoroughly enjoy assembly. The thing is, C is a lot quicker
    and sometimes I just need to quickly get something up and running
    without potential optimisation of assembly.

    Just wondering what those 16 series GNU C compilers that people said
    existed were?

    Cheers :)
     
  10. Yes, but it is free, and if the chip you want to use is supported and
    the memory requirement is enough then it will work just fine and dandy.
    True. There is no GNU C compiler for the PIC, and the good ones are
    quite expensive. I never said they were cheap.
    I was only refering to your comment that the PIC 16 series can't handle
    ANSI C well. That is simply wrong. The 16 series can and do have
    excellent ANSI C compilers.
    There is no argument there, that's stating the obvious.

    Regards
    Dave :)
     
  11. There are no GNU C compilers for the 16 series PICs (or any other
    series PIC).
    There are however many commercial PIC C compilers. HiTech, Microchip,
    and IAR are your expensive high end professional compiler, and ones
    from CCS and FED cater for the lower priced market.
    There is one called C2C that used to be free, don't know what state
    it's in now though.

    Regards
    Dave :)
     
  12. Alex Gibson

    Alex Gibson Guest

    There is an open source compiler but not a gnu one
    sdcc http://sdcc.sourceforge.net/
    pic is beta support at best

    Alex
     
  13. Alex Gibson

    Alex Gibson Guest

    wrong. see below

    picant / c2c /sourceboost(name changes over last few years)
    is fairly cheap compared to other pic c compilers US$69
    + other $20 for the simulator/ide addins(well worth it)
    http://www.picant.com/c2c/c.html
    Note it doesn't claim to be ansi compliant!

    There are ways to get a free legal license.
    Its simulator is better than mplab or other pic c compilers.


    The best free compiler for pics I've come across and used
    is jal which has a syntax a bit like pascal or ada.
    Easy to learn. http://sourceforge.net/projects/jal/
    Good and active user group at http://groups.yahoo.com/group/jallist/


    If anyone is looking for micros with gnu support
    then

    8 bit - avr , 16 bit - msp430 and 32 bit - arm7 chips are among the
    options.

    arm7
    Philips lpc2100 series
    http://www.semiconductors.philips.com/catalog/219/282/45988/45993/index.html#45993
    http://groups.yahoo.com/group/lpc2000

    Can purchase small quantities from www.adalam.com in Sydney and Melbourne
    around $15 each for small quantities.


    lpc2104 128 KB Flash, 16 KB RAM, 48 pins
    lpc2106 128 KB Flash, 32 KB RAM, 48 pins
    lpc2106 128 KB Flash, 64 KB RAM, 48 pins
    lpc2114 128 KB Flash, 16 KB RAM, 10-bit ADC, 64 pins
    lpc2119 128 KB Flash, 16 KB RAM, 10-bit ADC, 2x CAN, 64 pins
    lpc2124 256 KB Flash, 16 KB RAM, 10-bit ADC, 2x CAN, 64 pins
    lpc2129 256 KB Flash, 16 KB RAM, 10-bit ADC, 4x CAN and -40 to +105C, 64
    pins

    The lpc22xx series have external bus connections for external memory , etc

    Surface mount only unless you buy modules like
    http://www.dontronics.com/pasat.html which aren't cheap.

    Cheap dev boards
    http://www.olimex.com/dev/
    http://www.olimex.com/dev/arm_left.htm
    http://www.olimex.com/dev/pricelist.html

    tools
    http://www.gnuarm.org/

    Other arm7 chips
    atmel www.atmel.com/products/at91 look for sam7 devices

    analog devices
    http://www.analog.com/IST/SelectionTable/?selection_table_id=212

    st http://www.st.com/stonline/products/support/micro/arm/str7.htm

    sharp http://www.sharpsma.com/sma/products/MCUSoC.htm

    oki http://www2.okisemi.com/us/docs/MCUTables-9.html

    and lots of others


    Alex
     
  14. NK

    NK Guest

    Thanks all... Well after all the responses I think I'll use the basic
    compiler that came with the oshonsoft simulator. I've been playing it so
    far and it works great. For C, sounds like AVR is the way to go :)

    Thanks Again,
    NK
     
  15. Alex Gibson

    Alex Gibson Guest

    If you don't want to have to spend dollars on compilers.

    For pic there is the picclite compiler from
    http://www.htsoft.com/products/PICClite.php
    http://www.htsoft.com/downloads/demos.php
    16F877, 16F877A, 12F675, 12F629, 16F627, 16F627A, 16F684, 16C84, 16F84 and
    16F84A devices. Limits the memory you can use but
    for a lot of uses(most) it won't affect you.
    I've only once run up against the limit.

    Plugs into mplab and uses mplab as the ide.

    The Mike Predko book
    Programming Robot Controllers
    comes with an older version of picclite.

    Have a look at the picaxe for basic for the pic
    http://www.rev-ed.co.uk/picaxe/

    Alex
     
  16. NK

    NK Guest

    Cheers Alex, I'm aware of the PICClite compiler but I have a big bunch
    of 16f628A's lying around which i dont want to waste :) As for picaxe,
    that's what actually got me started on all of this. Great stuff but it's
    cheaper for me to continue using the basic compiler I already have and
    therefore use my existing 16f628a's :)

    On another note, which I should probably start a new topic for but my
    mouse hand is being lazy, does anyone know of how I can get a psi
    (0-30psi)reading converted to a voltage reading which I can then use in
    the AD inputs of an MCU?

    Thanks :)
    NK
     
  17. NK

    NK Guest

    ermm okay just worked out it was a pressure transducer I need :) Anyone
    know where I can get one of these or sell these for air 0-30psi with a
    0-5v output?
     
  18. NK

    NK Guest

    Actually I have a fairly decent grasp on assembly but sometimes I just
    want to get something done ultra quick - that's when I find a BASIC or C
    compiler rocks :)

    Thanks :)
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-