Hi-Tech C vas Mikro C

Microcontroller Topics
Post Reply
User avatar
Rksk
Major
Major
Posts: 730
Joined: Thu Jan 07, 2010 4:19 pm
Location: Rathnapura, Sri Lanka

Hi-Tech C vas Mikro C

Post by Rksk » Wed Aug 31, 2011 9:55 pm

What is the best? Let's compare...

I searched for some tutorials and most of results are wrote in Mikro C. Is it mean that, mikro C is popular than Hi-tech?


Thank you.

[ Post made via Mobile Device ] Image
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Hi-Tech C vas Mikro C

Post by Neo » Thu Sep 01, 2011 12:06 am

Performance of the compiler comes last. The way you write the code matters the most. When you write the most optimised code with less lines, less variables (register), you can expect the compiler to do the best for you. So settle down with what you have and learn programming ;) So for you, the first thing is to learn how to code better.

As per the question you asked, HiTECH C is used by a wider community due it is ability to optimise the code better. I have written some programmes for the PIC and I have never met any incapability in HiTECH C. Note that HiTECH C is expensive. They only provide a free version with some restriction on the code size (according to my memory). I'm very happy with HiTECH C so I didn't want to switch to anything else. Even if you have a Volkswagen which feels like a Mercedes, then that's it :lol:

In the other hand Mikro C is also becoming popular. Unlike HiTECH C, you can use the same compiler for all the PIC platforms. (With HiTECH C, you will have to use different compilers for PIC18, PIC24 and dsPIC. However the coding pattern is the same). Also, these guys were well famous for their Mikro BASIC compiler. There is a community who writes programs in BASIC for PIC and I don't think it is a good idea. One advantage with Mikro C (or Mikro BASIC) is they provide their own IDE with in-built compiler, debugger and programmer. HiTECH C uses the MPLab IDE (however Microchip recommends HiTECH C as a good compiler for PIC. So the IDE has built-in support for that. I doubt Mikro C has such support in MPLab). Another thing about these people. They also manufacture nice development boards. Have a look PIC Development Tools. Looks very high quality.

MPLAB C30 C compiler is also another very known and famous one which supports dsPICs as well.

Have a look at Hi-Tech C vs mikroC Pro. This user states, the HiTECH C version is more compact.
User avatar
Rksk
Major
Major
Posts: 730
Joined: Thu Jan 07, 2010 4:19 pm
Location: Rathnapura, Sri Lanka

Re: Hi-Tech C vas Mikro C

Post by Rksk » Thu Sep 01, 2011 12:34 am

Thank you Neo.
I had wanted to know the difference and you have told it clearly.

Also one thing, why there are only few examples/tutorials with HiTech?

[ Post made via Mobile Device ] Image
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Hi-Tech C vas Mikro C

Post by Neo » Thu Sep 01, 2011 1:35 am

When it says C, it's C. Whatever C example in the world will work with it. The speciality in a embedded compiler other than a general purpose C compiler is the set of in-built libraries for hardware calls (for particular set of chips). So those must be covered by the embedded compiler. If you take the examples folder in HiTECH C compiler, it covered almost every important aspect in the hardware (As shown in the following figure). That's all we expect form an embedded compiler.
HiTECH-C.PNG
HiTECH-C.PNG (10.43 KiB) Viewed 6326 times
You can do as follows.
  1. Design your program with a piece of paper and pen (You can use flow charts or DFDs)
  2. Set up the project to your target hardware
  3. Code it up with C language
  4. Add the compiler supported libraries and implement the hardware calls
This is the line we say that we are going to work with a PIC chip.

Code: Select all

#include <pic.h>
These are support to hardware provided by HiTECH C through its in-build libraries. These are not available in a general C compiler (made for PC such as gcc).

Code: Select all

TRISB = 0; // Set all pins of PORT B to be inputs
PORTB = 0; // Off all pins of PORT B
Post Reply

Return to “Microcontrollers”