Oops. I made a mistake. I have done my best to correct it. HI-TECH isn’t that bad of a free compiler. I’m going to do my best to showcase it by showing what you can do with it and how you can do it. The first source file is to turn on PORTC5 (Pin 5) of the PIC16F690.
In 2008 I started a project, and I never finished it for those who visit this site. I had a working project, but never did good documentation. I have finally pulled through with the final product! In this post you should be able to find: both schematics, both programs, and some pictures. What you won’t find is the circuit boards. I made them using the old fashioned way with Ferric Chloride and some Radidio* Shack press on etching strips. (*intentional misspelling)
Lately, I have had my eyes opened some in the microcontroller field. C compilers for Microchip: HI-TECH or CCS? Free or pay? The article pretty much blasts Hi-Tech for being expensive and for creating code that is less than optimal. I really had a “come to Jesus” moment recently when I realized that not everyone wants to pay $150 or $200 dollars for a compiler. This is especially true if the hobby is planned to be short lived.
I did a little research to find the compiler listing for Microchip. Both MPLAB C and HI-TECH have lite versions for programming Microchip’s microcontrollers. Microchip C Compilers…HI-TECH User Manual…There are several MPLAB C user Manuals depending on the chip structure.
The Pickit 3 programmer is less than $50 usd. You don’t even need special programmer hardware since you can build a header in your circuit to program any chip. The PDF user’s manual describes how to program the ICs. See page 24. Pickit3 User Guide
I have had to learn C for Freescale microcontrollers for school. I can’t say that using Freescale is easy, but I have enjoyed learning. I had to buy this book for school, and it has helped some. The downside is the price. The HCS12/ 9S12 by Han-Way Huang
Freescale has offered a great compiler for free. The other cool thing about Codewarrior is that it is supported in Linux (IDE!!!). Codewarrior…Codewarrior specs
I could not find a tutorial or user manual for Codewarrior, but I can tell you that programming Freescale is a labor intensive process that involves an intimate involvement with the register names. Example, in CCS, to make an output high you simply say ‘output_high(PIN_A1);’. This is not the case for Freescale. ‘DDRA=0×01; PORTA=0×01;’. DDRA sets the direction of port a, pin 0 as output. PORTA sets that pin high.
I hope that this information is helpful. 2.5 years ago when I wrote the original article about Hi-tech and CCS, I was looking for a “get rich quick” scheme to programming in C. I found the book and used the compiler from that book. Yes, I have gained much knowledge from it, but now I share with you that the same can be done with any of these products for less money. The code may not be optimised with the lite versions and there may be some tiny limitations, but for beginners that isn’t going to make a difference. Even for the more advanced users, these limitations are not that bad.
I have been working on an infrared remote for a couple of weeks, and I decided I wanted to write a program for a Microchip that would accomplish the task. I started writing a C program to do the heavy lifting and a thought came to mind. I will have no way of controlling the actual timing of the circuit using C. I might get close, but the code could be way off.
I continued to write some stuff in C, but it wound up being mostly Assembly. Then I just went and finished writing another copy completely in Assembly. I used MPLAB to configure the fuses. Configure…Configuration Bits…
I couldn’t take it any longer. I haven’t played in a long time so I decided to start from scratch and design another digital clock. I’m working on the board right now. I had one more display, RTC, and 32.768KHz xtal left.
I am building my own display driver this time though. The display driver will be an MCP23S17 multiplexer and a PIC16F690 microcontroller. The display driver that I used in the Picaxe clock was about $8. Not counting the amount of time I’ve spent writing the code my display driver should be about $2. Plus, I really don’t want to have to buy a driver and then spend the money on shipping when I have what it takes to make something work. We’ll see how it goes. In theory it seems like it will work.
I’ll explain more in a few weeks. I’m also tackling this project to create a C header file for the DS1305. It might help someone else out who is trying to work with it.