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.
I was messing around with a parallel LCD earlier, and I could not figure out how to display variables to it. I was becoming agitated when an idea came to mind. When I programmed clocks, I remember breaking the time down into four segments. The same thing applies here. Bingo. Below is my test code in C++ to emulate C. The only difference is the integers on a computer are 4 BYTES in length. In the test code for a negative numbers in a microcontroller, there will need to be an overloaded function to send signed integers to since an unsigned integer might be misinterpreted as signed. There will be more challenges ahead. There will need to be other approaches for floating numbers.
There is no error checking in the code below. Be sure that you do not exceed the length of the character array. They will always need one more place to account for the null character.
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.
Sept. 22, 2009 - Waiting on parts to come in can be boring so I went on a dig through my parts bin and found this LED still in its original packaging. While the packaging leaves a lot to be desired, I actually found the datasheet on RS’ website. I played with this LED and some 1k resistors on a breadboard, and now I’m going to make a night light that changes colors. The original program that I wrote lasts about 15 minutes, and it cycles through all of the colors [edit – at least I thought it would). It uses a rough PWM method that I wrote to fade in and out.
After a little math work I decided on using 20mA for all of my colors. They are rated for 30 to 50 mA depending on the color, but with this I can use the output pins on my PIC12F675. This saves a lot of transistors for another project.