Friday, July 13, 2007

The 12F675 - A PIC Microcontroller project guide.

The 12F675 is one of the smallest PIC Microcontrollers -
it's a tiny device with 8 pins but it's packed with
peripherals and it even has a built in 10bit ADC which can
read analogue inputs from 4 pins.
It has the following internal peripherals:
1. Two timers.
2. An analogue comparator.
3. 10 bit ADC.
It also has an internal oscillator and internal reset
circuit. This means the device uses minimal external
components to make it work (other devices require an
external crystal oscillator). Of course it also has the
usual internal programming memory, EEPROM and RAM needed
for programming.
Ideas for projects:
1. 4 channel volt meter.
2. Multi channel Servo controller.
3. Temperature controller.
4. Inductance meter.
5. Touch lamp.
6. Courtesy light time delay.
Note: To get data out of the device you can implement a
serial RS232 transmit interface to your PC.
Why use it?
One reason is that because of its size its easy to put
into restricted spaces e.g. for a model aircraft or model
trains and it's cheaper than the larger devices.
Note: The 12F629 is the same device without the ADC - so
it's even more cost effective.
So it's useful in designs that you would not normally
think of using a microcontroller for instance you could
make a touch lamp dimmer - Note using the microcontroller
means you can make far better functionality than using
discrete hardware (and even change its programming later
on).
With a lamp dimmer you could have an auto off delay
function e.g. if no activity for an hour then turn off.
State machines
You could also implement a state machine for more complex
control of the functionality e.g. pressing once moves to
the next dimming level in the current direction while
press and hold changes the dimming direction.
Using a state machine while not trivial lets you control
complex operation which you could not achieve (without a
great deal of effort) using discrete hardware - and the
advantage of using the microcontroller is that if you get
it wrong you just re code your software and test it again.
Note: The 12F675 and 12F629 use Flash programming memory i
.e. they are re-programmable - you can change their
functionality instantaneously with NO re-wiring.
The only problems are
1. You need to program the device.
2. You need a programming language.
Programming the Device
Surprisingly you can program the device using the standard
4 pin PIC serial interface - ICSP (In Circuit Serial
Programming) and with careful design you can even connect
your programmer to the same pins that your circuit uses.
Programming language
The programming language normally recommended is assembler
and there are good reasons for using assembler - e.g.
very fast code and smaller final code size but I would
recommend using a high level language such as Basic or C.
This is because for assembler you need to work at such a
low level that you spend a lot of effort to do trivial
tasks and this is better left to the high level language.
For the example mentioned setting up and maintaining a
state machine would be extremely difficult in assembler
but much easier in C.
You can find some of these 12F675 pic projects here
http://www.best-microcontroller-projects.com/12F675.htm
Copyright © John Main 2007
Free to distribute if the article is kept complete.

John Main's website http://www.best-microcontroller-projects.com provides microcontroller resources and free projects which are fully documented including schematics and source code.

Article Source: http://www.articlepros.com

No comments: