Author Topic: Pic mcu alternatives???  (Read 41668 times)

0 Members and 1 Guest are viewing this topic.

Offline kgavionicsTopic starter

  • Regular Contributor
  • *
  • Posts: 195
  • Country: ca
Pic mcu alternatives???
« on: June 18, 2017, 09:59:38 pm »
Hi guys
A few years ago i started using micro-controller ( microchip 16F and 18f family).i was using only assembly language to program them.I haven't had any problem.I wanted to start using C, because as you may know assembly is a lot of time consuming.I started searching for the descent compiler and it turned out that i have to spend a lot of money to get one like the xc8, of course they offer a shitty free version which inserts a useless code just to make your code bigger.No sorry, i hate that idea specially for a guy how's coming from assembly language.
I think that my love story with microchip mcu is about to end,because of the lack of a descent C free compiler.
my question which is the best microcontroller ( it doesn't matter if it's 8bit or 32 bit) that can offer a descent free C compiler to build some project?
Note:I don't like to use arduino family,because i want to understand and have control of the registers.
thanks in advance
« Last Edit: June 18, 2017, 10:01:13 pm by kgavionics »
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3147
  • Country: ca
Re: Pic mcu alternatives???
« Reply #1 on: June 18, 2017, 10:22:12 pm »
Free XC8 is Ok. They used to put in a lot of bloat, but now they don't.

Most MCUs will have some sort of free C compiler, so you can choose practically anything. However, you will have to change your attitude - C will not be as efficient as assembler, so you will have to learn to live with that and not worry about the disassembly too much.
 
The following users thanked this post: kgavionics

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11269
  • Country: us
    • Personal site
Re: Pic mcu alternatives???
« Reply #2 on: June 18, 2017, 10:39:46 pm »
Any ARM chip you like. Seriously, there is no more supported architecture than ARM (excluding X86, of course).

Alex
 
The following users thanked this post: kgavionics, jnz

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3147
  • Country: ca
Re: Pic mcu alternatives???
« Reply #3 on: June 19, 2017, 12:04:06 am »
You can hack XC8. It's itself GPL based, and Microchip is essentially selling you a paid GPL software.
You can checkout its source code and strip out licensing parts and recompile it.
It might be hard, hard enough that I gave up. But if you are familiar with the GCC building from scratch process, you can do this.

I don't think XC8 is open source. It is based on old Hi-Tech C. XC16 and XC32 are based on GCC, so the source is open.
 
The following users thanked this post: blueskull

Offline hamdi.tn

  • Frequent Contributor
  • **
  • Posts: 623
  • Country: tn
Re: Pic mcu alternatives???
« Reply #4 on: June 19, 2017, 12:14:43 am »
STM32, i stopped using microchip in my projects 4 years ago.
« Last Edit: June 19, 2017, 01:02:37 am by hamdi.tn »
 
The following users thanked this post: kgavionics

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Pic mcu alternatives???
« Reply #5 on: June 19, 2017, 12:34:53 am »
Hi guys
A few years ago i started using micro-controller ( microchip 16F and 18f family).i was using only assembly language to program them.I haven't had any problem.I wanted to start using C, because as you may know assembly is a lot of time consuming.I started searching for the descent compiler and it turned out that i have to spend a lot of money to get one like the xc8, of course they offer a shitty free version which inserts a useless code just to make your code bigger.No sorry, i hate that idea specially for a guy how's coming from assembly language.
I think that my love story with microchip mcu is about to end,because of the lack of a descent C free compiler.
my question which is the best microcontroller ( it doesn't matter if it's 8bit or 32 bit) that can offer a descent free C compiler to build some project?
Note:I don't like to use arduino family,because i want to understand and have control of the registers.
thanks in advance

GCC and LLVM/clang are the two best free (both as in beer and as in speech) compilers out there. For 8-bit processors there is also the SDCC.

You can use AVR without the Arduino libraries. You will still be using the AVR-GCC toolchain though. There is an experimental fork of LLVM that emits AVR code.

The ARM architecture is supported by both GCC and LLVM/clang (yes that includes the copy of Apple clang that comes with Xcode.)

From Microchip both xc16 and xc32 for PIC24/dsPIC (xc16) and PIC32 (xc32) are actually paid versions of GCC. You can find the corresponding source code (released under GPL,) patch out the license checking code, and for xc16 patch in C++ support (if you need it.) Normal MIPS32 GCC may also work for PIC32.

There is this Intel Quark D2000 that runs x86 and thus supported by GCC and LLVM/clang.

For SDCC, its strength is the 8051 and Z80 architectures. It do have experimental support for 8-bit
 

Offline kgavionicsTopic starter

  • Regular Contributor
  • *
  • Posts: 195
  • Country: ca
Re: Pic mcu alternatives???
« Reply #6 on: June 19, 2017, 03:22:24 am »
thank you guys for your help.sorry, i was a little bit frustrated, after I've done a bit of research it seems that the xc8 free version is not as bad as i thought.
for now i'll keep using PIC, but i might be interested for something else in the near future.
 

Offline hans

  • Super Contributor
  • ***
  • Posts: 1641
  • Country: nl
Re: Pic mcu alternatives???
« Reply #7 on: June 19, 2017, 09:14:56 am »
You can hack XC8. It's itself GPL based, and Microchip is essentially selling you a paid GPL software.
You can checkout its source code and strip out licensing parts and recompile it.
It might be hard, hard enough that I gave up. But if you are familiar with the GCC building from scratch process, you can do this.

I don't think XC8 is open source. It is based on old Hi-Tech C. XC16 and XC32 are based on GCC, so the source is open.

Okay, got it. I was looking at XC16 since I was interested in dsPIC33 series, until I got drawn in thousands of pages of scattered reference manuals and moved to PSoC 5LP.

Still though, you're right. You don't have to look far to get XC8 'refactored'.
Does it make a big difference? No not really. Don't expect wonders. The most I usually got was 10% code size reduction. The best code size optimisations were put into free editions years ago, because before that it was appalling beyond belief.

Nevertheless I don't touch XC8 anymore because of lack of C99 (and C++) support. The compiler technology really starts to show it's age, so do the chips.
But if someone is keen to using these PICs, power to them. It are still fun chips that can run code, have easy to program peripherals, etc. I would recommended XC8 over programming assembly. Maybe assembly can be a few % more efficient here and there.. but the cost of programming it, error prone, debug factor etc. all don't make sense.

As a side note: I'm impressed with the assembler outputs of e.g. the GCCs compiler puts out, even for heavily templated code with inheritance (but no virtual functions!) and composition structures in C++.
 
The following users thanked this post: kgavionics

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Pic mcu alternatives???
« Reply #8 on: June 19, 2017, 09:16:58 am »
There are also a number of other commercial C compilers for PIC that are more reasonably priced than XC8.
 
The following users thanked this post: kgavionics

Offline hamdi.tn

  • Frequent Contributor
  • **
  • Posts: 623
  • Country: tn
Re: Pic mcu alternatives???
« Reply #9 on: June 19, 2017, 09:26:07 am »
thank you guys for your help.sorry, i was a little bit frustrated, after I've done a bit of research it seems that the xc8 free version is not as bad as i thought.
for now i'll keep using PIC, but i might be interested for something else in the near future.

i can't remember if it was free XC8 or free H-TECH Compiler that add more unnecessary code to the compiled file just so they can say buy PRO version to optimize your code size. One more reason to give up Microchip.
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7392
  • Country: nl
  • Current job: ATEX product design
Re: Pic mcu alternatives???
« Reply #10 on: June 19, 2017, 09:28:57 am »
I'm just waiting for someone to ctrl+c ctrl+v here their Holy Wall Of Text of the PSOC, how it is superior to everything. BTW it's not.
 
The following users thanked this post: hans, kony, Frank, jaromir, technix, stj

Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: Pic mcu alternatives???
« Reply #11 on: June 19, 2017, 10:49:39 am »
thank you guys for your help.sorry, i was a little bit frustrated, after I've done a bit of research it seems that the xc8 free version is not as bad as i thought.
for now i'll keep using PIC, but i might be interested for something else in the near future.
The really obvious next step is Arduino.  Uno or Mini clones on the slow boat from China (I personally like NHduino) cost almost nothing.  Or a 2560 clone if you want more pins and hardware.  You can then use the Arduino IDE and program C to your hearts content.  (ASM is also possible)
An advantage of sticking with MPLABX and XC8 is the potential to hardware debug which may or not be useful.
 

Offline spudboy488

  • Regular Contributor
  • *
  • Posts: 136
Re: Pic mcu alternatives???
« Reply #12 on: June 19, 2017, 11:25:32 am »
i can't remember if it was free XC8 or free H-TECH Compiler that add more unnecessary code to the compiled file just so they can say buy PRO version to optimize your code size. One more reason to give up Microchip.

I don't think it actually added code, it just didn't run some of the optimization passes to remove unnecessary code. I believe the free and pro compilers will produce the same code if you turn off some of the optimization in the pro version. There were no optimization option in the free version.
 

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1954
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Pic mcu alternatives???
« Reply #13 on: June 19, 2017, 11:40:54 am »
thank you guys for your help.sorry, i was a little bit frustrated, after I've done a bit of research it seems that the xc8 free version is not as bad as i thought.
for now i'll keep using PIC, but i might be interested for something else in the near future.
The really obvious next step is Arduino.  Uno or Mini clones on the slow boat from China (I personally like NHduino) cost almost nothing.  Or a 2560 clone if you want more pins and hardware.  You can then use the Arduino IDE and program C to your hearts content.  (ASM is also possible)
An advantage of sticking with MPLABX and XC8 is the potential to hardware debug which may or not be useful.

I differ with you. Arduino should be the very first step in learning mcus, then you dig into PIC and other vendors. For our post, Arduino is worse than PIC since it adds yet another layer which will make code less efficient.

My own opinion is that XC8 is just great, greater than many other free stuff. It is usable, official and supported. Code efficiency is not a fundamental issue in my opinion because it is because of wrong MCU choice most of the times. If you have a big project, get a big enough MCU. Don't get a tiny 8-bit PIC then claim your awesome robot project failed because compiler is bad (This is in general, not personal to the OP)... right? I remember an EEVBlog post talking about this.

Microchip PIC is one of the best, I don't think you should use another vendor unless you want to use ARM MCUs. ARM 32-bit MCU are obviously better and more powerful.


Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: Pic mcu alternatives???
« Reply #14 on: June 19, 2017, 03:38:38 pm »
Arduino is worse than PIC since it adds yet another layer which will make code less efficient.
It's true that Wiring gets in the way but you can avoid it very easily and get straight to bare metal.  Put your code, in a while(true) inside the loop function, redefine or disable timer0 and you are good to go with bit twiddling the registers.

Depends on what you actually want to achieve.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Pic mcu alternatives???
« Reply #15 on: June 19, 2017, 03:47:39 pm »
Arduino is worse than PIC since it adds yet another layer which will make code less efficient.
It's true that Wiring gets in the way but you can avoid it very easily and get straight to bare metal.  Put your code, in a while(true) inside the loop function, redefine or disable timer0 and you are good to go with bit twiddling the registers.

Depends on what you actually want to achieve.
You can install Arduino software just to use it as an installer for AVR-GCC and AVR-libc. Then you can safely skip the Arduino IDE itself and use the copy of toolchain it packed for your own project.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3147
  • Country: ca
Re: Pic mcu alternatives???
« Reply #16 on: June 19, 2017, 04:05:10 pm »
You can install Arduino software just to use it as an installer for AVR-GCC and AVR-libc. Then you can safely skip the Arduino IDE itself and use the copy of toolchain it packed for your own project.

"But I was thinking of a plan
 To dye one's whiskers green,
 And always use so large a fan
 That they could not be seen".

                Lewis Carroll. Through the Looking-Glass.
 
The following users thanked this post: newbrain

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Pic mcu alternatives???
« Reply #17 on: June 19, 2017, 04:11:21 pm »
You can install Arduino software just to use it as an installer for AVR-GCC and AVR-libc. Then you can safely skip the Arduino IDE itself and use the copy of toolchain it packed for your own project.

"But I was thinking of a plan
 To dye one's whiskers green,
 And always use so large a fan
 That they could not be seen".

                Lewis Carroll. Through the Looking-Glass.
There are some tricky-to-get-right toolchains that Arduino folks support, like the ones for Intel Quark line. Using the copy installed by Arduino is often more reliable than installing it yourself.
 

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2365
  • Country: de
    • Frank Buss
Re: Pic mcu alternatives???
« Reply #18 on: June 19, 2017, 04:17:00 pm »
I would recommend that you start with an Arduino. There are Arduino Nano clones for less than $2, free shipping on eBay, with USB serial port integrated and they are faster than the usual PIC16/18, even when programmed in C. But if you want, you can actually use the underlying registers with it, no need to use the Arduino API. I use it frequently when I test things like new displays, sensors etc., or even for bigger projects, like this "bateye" hardware which I wrote for someone on Hackaday:

https://github.com/DebarghaG/Project_Basics/blob/master/bateye-stereo.ino

It uses two ultrasonic distance sensors and creates two audio signals, depending on the distance, logarithmically scaled (bigger frequency steps with higher frequencies, because the ear perceives this as linear then). I had to configure the Atmel registers myself for the interrupt, because this is not possible with the standard API (but there is a timer1 module for it, as I just found out), but the rest is really easy with it.

When I need more power, currently I use one of the STM32 microcontrollers. The CubeMX GUI makes it very easy to configure all peripherals, you really don't want to do this by hand. The code looks horribly bloated, but it has big enough flash memory, so I don't care, and they improve it all the time, it has fewer and fewer bugs with every version :) I use it in combination with the Keil uVision IDE (free for up to 32 kB).

Some bigger STM32 chips run with 168 MHz (costs like $10), the smaller ones with 48 MHz (for like $5). But it is still simple enough with one supply voltage and internal oscillator, so you can use a breakout board and start playing with it (with a ST-Link programmer, which is again cheap on eBay). I used this to test a new 3-color e-paper display:

https://hackaday.io/project/20466-wifi-epaper/log/61762-stm32l433-and-new-display-test

Later I created a proper board, which is currently manufactured:

https://hackaday.io/project/20466-wifi-epaper/log/61807-test-board-for-bluetooth
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Pic mcu alternatives???
« Reply #19 on: June 19, 2017, 08:32:06 pm »
Quote
it seems that the xc8 free version is not as bad as i thought.

By all means, try it out.  Especially since you know the assembly language, you're in a good position to evaluate the code produced by the compiler.

When Microchip acquired HiTech and released an 8-bit PIC compiler "free version with no optimization", it was pretty awful.  People were expecting the equivalent of what gcc produces with "-O0", unaware of just how much optimization goes on in a compiler in between the sort of "parsed source naively translated to machine code" and "no fancy optimizations."  They got the former.  It was particularly bad on the PIC architecture, since that's pretty distant from the PDP/11 that C "naturally" maps to.

Since that time, they have reportedly fiddled with the settings, and it's gotten better.
 
The following users thanked this post: kgavionics

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Pic mcu alternatives???
« Reply #20 on: June 19, 2017, 11:37:20 pm »
Some questions -

1) Type of designs you are doing ? What is processor doing in the designs ?

2) You dealing with analog, filters, ADC ?

3) Type of outputs you are driving, simple digital, PWM, DAC, motors, other digital....

4) Displays/interface to UP being used in finished product ?


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 
The following users thanked this post: kgavionics

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2328
  • Country: 00
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Pic mcu alternatives???
« Reply #22 on: June 20, 2017, 03:09:07 pm »
I'm just waiting for someone to ctrl+c ctrl+v here their Holy Wall Of Text of the PSOC, how it is superior to everything. BTW it's not.
I think it have arrived. Well a shorter version arrived, with a link to a MUCH longer one.
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2328
  • Country: 00
Re: Pic mcu alternatives???
« Reply #23 on: June 20, 2017, 04:01:57 pm »
Psoc is for sure,  It's unique, If you don't believe is because you didn't play with psoc r

It's a mix of FPGA, arm and even a "kind of analog" litle FPGA

Only as a little information Check this video and tell me, what another arm processor ( or any other one ) make so easy to add small functions based on Verilog

http://youtu.be/XpgmKk-COkA

Also, check this 2nd video and tell me do you know any other processor that you can make small analog circuits on the fly?



Psoc is the most flexible system family available nothing like that, and if you evaluate the full family, you will agree.,

 The problem with Psoc is that is something that is a new and Innovative, you will need some effort to learn and understand because breaks your previous experience with microprocessor, PSOC is a System on Chip not a microprocessor
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Pic mcu alternatives???
« Reply #24 on: June 20, 2017, 04:23:53 pm »
Psoc is for sure,  It's unique, If you don't believe is because you didn't play with psoc r

It's a mix of FPGA, arm and even a "kind of analog" litle FPGA

Only as a little information Check this video and tell me, what another arm processor ( or any other one ) make so easy to add small functions based on Verilog

http://youtu.be/XpgmKk-COkA

Also, check this 2nd video and tell me do you know any other processor that you can make small analog circuits on the fly?



Psoc is the most flexible system family available nothing like that, and if you evaluate the full family, you will agree.,

 The problem with Psoc is that is something that is a new and Innovative, you will need some effort to learn and understand because breaks your previous experience with microprocessor, PSOC is a System on Chip not a microprocessor
No thanks. If the microcontroller don't have tools for Linux or macOS it is literally dead end for me.

Do not persuade me to install Windows somewhere. I don't even own Windows. All my computers runs either Ubuntu Linux or macOS. And none of my surviving computers are bought with Windows licenses included - either I built it up myself from parts, or I bought a Mac.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf