Recent Posts

Blogroll

                                          My PIC12F683 Development Board
Office Map Circuit diagram for each experiment may not be available separately because they are conducted with PIC12F683 development board that I made. So, the readers should first see the schematic of my development board.

Saturday, February 13, 2010

Experiment No. 1: 3-bit LED Up Counter

This is the first and the simplest project we are going to test on our PIC12F683 experiment board. We are going to make a 3-bit up counter that counts from 0 to 7. After 7, we are going to reset it to 0 and then start again, and so on. The 3-bit counter output will be displayed on 3-LEDs on the board. There will be a 1s delay between each up count.
Setup:
Connect GP0, GP1, and GP2 (pins 7, 6, and 5 of PIC12F683) to LEDs 3, 2, and 1 respectively.
 
Connect GPIO2, 1, 0 pins to LEDs 1, 2, 3 using jumper wires.

What else you need to start experimenting on this board?

After you finish constructing the development board, here are few more things to do before doing some real experiments with it.

  • Of course, you need a 9V DC adapter for power supply. I sometimes use the power supply from my PIC programmer which derives power from a USB port of my computer. But do this only if you are sure that the experiment you doing draws current which is within the safe limit of the USB port.
  • Next, you also need jumper wires to interconnect the various terminals while doing experiments.
  • It depends on you what kind of platform you want to choose for programming the PIC. If you want to use assembly language, you need to download MPLAB. It is free to download from the Microchip website. You can also find an installation guide for this, which might be helpful. However, I prefer high-level language like C for programming my PIC. I am going to use mikroC compiler from Mikroelektronika for all the experiments I am going to show here. You can download a demo version of this compiler for free. The demo version restricts the output HEX file size to 2K, but we don't care because PIC12683 doesn't have programming memory more than that. So, you decide. 

Friday, February 5, 2010

Make Your Own PIC12F683 Microcontroller Development Board

Our purpose here is to explore the potential of PIC12F683 microcontroller for which we need a development board. The good thing is we are going to make our own board. The schematic and the actual board that I have built are shown below. I soldered all the components on a 12 x 8 cm general purpose prototyping board. 

 
Completed Board

It has following features in it:
1. A Regulated +5V power supply.
2. 3 Output LEDs that can be connected to any GPIO pins using jumper wires.
3. ON/OFF power supply switch.
4. A Green LED as a power ON indicator.
5. An 8-pin IC socket for PIC12F683 microcontroller.
6. Two potentiometers: one for providing Vref, and other for simulating analog input to ADC.
7. An ICSP header connector.
8. Two tactile switches for input operation.
9. A TTL to RS232 level shifter using a transistor circuit.
10. A piezo buzzer.
11. A DC motor with driving circuit.

Thursday, February 4, 2010

PIC12F683: A brief Introduction

PIC12F683 is a 8-pin Flash based,  8bit RISC microcontroller from Microchip. This little PIC microcontroller offers up to 6 I/O pins (the remaining two are power supply pins). It needs no external oscillator, as it has an in-built oscillator with software selectable frequency from 8 MHz to 125 KHz. It also offers a feature that allows external signals to wake it upfrom the sleep state. Here are the various features as mentioned on the datasheet.


High-Performance RISC CPU:
• Only 35 instructions to learn: All single-cycle instructions except branches
• Operating speed:
 - DC – 20 MHz oscillator/clock input
 - DC – 200 ns instruction cycle

• Interrupt capability
• 8-level deep hardware stack
• Direct, Indirect and Relative Addressing modes

Special Microcontroller Features:
• Precision Internal Oscillator:
 - Factory calibrated to ±1%, typical
 - Software selectable frequency range of 8 MHz to 125 kHz
 - Software tunable
 - Two-Speed Start-up mode
 - Crystal fail detect for critical applications
 - Clock mode switching during operation for power savings

• Power-Saving Sleep mode
• Wide operating voltage range (2.0V-5.5V)
• Industrial and Extended temperature range
• Power-on Reset (POR)
• Power-up Timer (PWRT) and Oscillator Start-up Timer (OST)
• Brown-out Reset (BOR) with software control option
• Enhanced Low-Current Watchdog Timer (WDT) with on-chip oscillator (software selectable nominal 268 seconds with full prescaler) with software enable
• Multiplexed Master Clear with pull-up/input pin
• Programmable code protection
• High Endurance Flash/EEPROM cell:
 - 100,000 write Flash endurance
 - 1,000,000 write EEPROM endurance
 - Flash/Data EEPROM Retention: > 40 years


Peripheral Features:
• 6 I/O pins with individual direction control:
 - High current source/sink for direct LED drive
 - Interrupt-on-pin change
 - Individually programmable weak pull-ups
 - Ultra Low-Power Wake-up on GP0

• Analog Comparator module with:
 - One analog comparator
 - Programmable on-chip voltage reference (CVREF) module (% of VDD)
 - Comparator inputs and output externally accessible

• A/D Converter: 10-bit resolution and 4 channels
• Timer0: 8-bit timer/counter with 8-bit programmable prescaler
• Enhanced Timer1:
 - 16-bit timer/counter with prescaler
 - External Timer1 Gate (count enable)
 - Option to use OSC1 and OSC2 in LP mode as Timer1 oscillator if INTOSC mode selected
• Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler

• Capture, Compare, PWM module:
- 16-bit Capture, max resolution 12.5 ns
- Compare, max resolution 200 ns
- 10-bit PWM, max frequency 20 kHz
• In-Circuit Serial Programming™ (ICSP™) via two pins



The I/O port of PIC12F683 is called the GPIO (general purpose input/output file register), and the corresponding data direction register is TRISIO. It works mostly the same way as ports in other PIC microcontrollers. Setting a TRISIO bit (= 1) will make the corresponding GPIO pin an input, and clearing the TRISIO bit (= 0) will make it an output. One important thing to note is that GP3 is input only pin, and cannot be configured as an output.

PIC12F683 has a 13-bit program counter that can address up to 8K x 14 program memory, but only the first 2K x 14 (0000h-07FFh) is physically implemented. PIC12F683 also has 256 bytes of data EEPROM with an address range from 0h to FFh.
For details, read the datasheet.

Online Embedded Systems Lab

This online laboratory teaches you the fundamentals of microcontroller-based embedded system development through a series of laboratory exercises. Most of the time, students and hobbyists could not afford expensive development kits and software to learn these things. These tutorials are prepared such that you will be building microcontroller projects at a minimum cost. Check this out