Introduction to PIC12F683
- PIC12F683 is an 8-bit PIC microcontroller that comes with 8-pin interface. It falls under the category of CMOS controllers and comes with nanoWatt technology.
- The architecture is based on Flash but controller lacks some functions like USART, SPI, and I2C module, however, features like In-Circuit Serial Programming, Watchdog timer, and Oscillator start-up timer make this device an ideal choice for some real-time applications.
- Memory space is less than other 40-pin controllers in the PIC community but is enough to configure automatic functions in the electronic projects.
- Program memory comes with 3.5KB memory space, and RAM and EEPROM memories are 128bytes and 256 bytes respectively.
- Though this module lacks some major functions, we can't wipe off its value in terms of converting analog signals to digitals ones. This device comes with 10-bit ADC converter that is a remarkable addition in a tiny device like this and is very helpful for sensor interfacing.
- Power-up timer, Master Clear Reset, and Sleep Mode are some useful features that work both ways i.e. taking the device out of the infinite loop by restarting it and saving power where power management is a major concern.
- With that being said, if your project requires more functions to be carried out on a single chip with more pins and memory interface, it is preferred to use PIC18F4520.
PIC12F683 FeaturesFeatures of any device are very important to get the main idea about the device before installing it in the relevant project. Following table shows the complete features of PIC12F683.
|No. of Pins||8|
|CPU||RISC 8-Bit PIC|
|Operating Voltage||2 to 5.5 V|
|Program Memory Type||Flash|
|ADC Number of ADC Channels||10-Bit 4|
|In-circuit serial programming||Yes|
|Oscillator||up to 20 MHz|
|Timer (3)||16-Bit Timer (1) 8-Bit Timer (2)|
|Oscillator Start-up Timer||Yes|
|Power Up Timer||Yes|
|Brown out Reset (BOR)||Yes|
|Master Clear Reset||Yes|
|Minimum Operating Temperature||-40 C|
|Maximum Operating Temperature||125 C|
PIC12F683 Pinout and DescriptionYou have got a complete overview of the features of this module. In this section, we cover pinout and pin description of the chip.
PinoutThe following figure shows the pinout of PIC12F683.
- This PIC module comes in three packages named PDIP, DFN and DFN-S and all three packages contain 8-pin on each module.
Pin DescriptionFollowing table shows the pin description of each pin that highlights the major functions associated with each pin.
|Pin#||Pin Name||Pin Description|
|7||GP0 AN0 CIN+ ICSPDAT||I/O Bidirectional pin Analog pin channel 0 Comparator In-Circuit Serial Programming|
|6||GP1 AN1 CIN- VREF ICSPCLK||I/O Bidirectional pin Analog pin channel 1 Comparator External Voltage Reference In-Circuit Serial Programming Clock|
|5||GP2 AN2 T0CKI INT COUT||I/O Bidirectional pin Analog pin channel 2 Timer Interrupt Comparator|
|4||GP3 MCLR VPP||I/O Bidirectional pin Master Clear Reset Programming Voltage Input|
|3||GP4 AN3 T1G OSC2 CLKOUT||I/O Bidirectional pin Analog pin channel 3 Timer Oscillator Output Comparator|
|2||GP5 T1CKI OSC1 CLKIN||I/O Bidirectional pin Timer Oscillator Input RC oscillator connection|
|1||VDD||Voltage Supply Pin|
3. PIC12F683 Main FunctionsAs I already mentioned, this PIC module is not like some other fancy modules in the market, but some common functions make this device suitable for electronic projects. Let's discuss some major functions of this device.
TimersThere are three timers incorporated in the device where two are 8-bit and one is 16-bit timer. All these timers work both ways i.e. timer as well as the counter. Timer mode is used to create a delay in the execution of relevant functions and increments the instruction cycle. While the counter mode is used to count the number of intervals in the specific functions and increments the rising and falling edge of the pin. There are some other timers that are separated from mentioned timers and work in the same way to create a delay in the running function of the controller. These timers include
- Oscillator Start-up Timer
- Power-up Timer
Watchdog TimerThe watchdog timer is a remarkable addition in the device that resets the device and puts it in a stable condition if running program hangs up or gets stuck in an infinite loop. When you are playing with the electronic device, it is very difficult to handle and reset the device manually, this is where watchdog timer comes handy and prevents the device from any malfunctioning.
Sleep ModePower saving sleep mode is very helpful for saving power that generates a low current power down mode. The sleep mode can be removed using an interrupt, external reset or watchdog timer.
In-Circuit Serial ProgrammingIn-Circuit Serial Programming is another valuable feature added to the device that gives the option to program the controller after its installation in the relevant project, setting you free from separately testing the compiled program every time.
ADC ConverterWhat this module lacks in terms of USART, SPI, and I2C communications, it covers up for incorporating remarkable ADC converter into the device which makes it an ideal choice for sensor interfacing and for the applications that require analog to digital conversion. The ADC module is 10-bit and comes with 4-analog channels which are quite less than channels available in other controllers that normally contain 7 or 12 analog channels.
Master Clear Reset (MCLR)The MCLR pin calls the external reset for the chip that is triggered by keeping this pin LOW. The noise filter is incorporated in the MCLR running process that detects and removes the small pulses. The MCLRE configuration bit is normally used to disable MCLR input.
4. PIC Compiler and Burner
- Both, PIC compiler and burner are different things. Former is used to write the required program for the controller while later is used to transfer and burn the written program to the controller.
- MPLAB C18 Compiler is a standard compiler for PIC controllers that is introduced by Microchip. This compiler is readily available on the Microchip site.
- Third-party software can also be used for compiling the program and you must check this list of Top 3 PIC C Compilers where you can pick any compiler based on your technical requirements, however, MikroC Pro For PIC is a major replacement for standard PIC compiler.
- It is important to note that the code we write on the compiler generates the hex which is then moved to the controller for carrying out required operation.
- PICKit3 is a standard burner used for PIC controllers. There are other burners available in the market but PICKit3 is mostly used and preferred over other burners in terms of performance and efficiency.
PIC12F683 Memory Layout and WorkingMemory, as the word defines, is used to store a number of instructions in the form of code. Memory is mainly divided into two major types Program Memory Data Memory The former is used to store the instructions permanently and, more often than not, is known as ROM or Non-Volatile memory. This memory is not dependent on the power supply and comes with an ability to store the information in the absence of power supply.
- Program memory comes with a memory space around 3.5K and contains 13-bit program counter that can address 8k x 14 memory space where reset vector lies at 0000h and interrupt vector stays at 0004h.
- Registers are the data holding places in the controller and can hold storage address, instruction and any kind of data ranging bit sequence or individual characters.
- General Purpose Registers reserve 20h-7Fh in Bank 0 and A0h-BFh in Bank 1 and are implemented as static RAM while remaining RAM remains unimplemented and returns zero when read.
6. PIC12F683 Block DiagramUntil now, you have got a clear idea about main features, pinout, pin description, and compiler used for this PIC module. In this section, we will discuss the block diagram of this tiny chip. Following figure shows the block diagram of PIC12F683. There is no PORT marked on this module, instead, pins are labeled as GP0 to GP5 where VDD and VSS are voltage supply and ground pins respectively. This PIC version falls under the category of Microchip's Low Pin Count Patent.
7. PIC12F683 Projects and Applications
- Used in Industrial automation
- Embedded and control systems
- Sensor interfacing and motor control
- Widely used in student projects for driving automation