Classification of PIC microcontroller
How many types of PIC microcontroller are available in market? The first PIC microcontroller was introduced in 1989. It was an 8 bit controller with very limited features at that time. But in very few years it became so famous that it was available in 14 pins to 80 pins package with extra features introduced. It is quite amazing that a company which started a controller with 8-bits, became one of the biggest suppliers in less than a decade. At this time microchip is on top in supplying an 8-bit microcontroller.
PIC microcontrollers families include 10xxx,12xxx,14xxx,16xxx,17xxxx and 18xxxx. One problem that exists in these families are they are not upward compatible. For example PIC12/PIC16 have 12 and 14 bits wide instructions while PIC18 has 16 bit wide instructions. So if you have written program for PIC12 or PIC14 you can not directly use it for PIC18 until you make little changes in it.
ROM in a microcontroller is used for storing the program. Based on different ROM types we can classify the PIC microcontrollers into different types.
PIC microcontroller with UV-EPROM
Some PIC microcontrollers come with on-chip ROM. These microcontrollers need a separate burner and eraser for writing and erasing/deleting the program from the controller. The burner has its specific software for importing code/program to the microcontroller. There is a window on UV-EPROM chip which allows the light to erase its contents. The main problem with these microcontrollers was that it was taking almost 20 minutes for erasing its contents before it is reprogrammed. This led the microchip to introduce the new controllers with flash memory.
PIC microcontroller with flash memory
As discussed above, controllers with UV-EPROM were taking much time for erasing their contents so microchip introduced the new versions with flash memory. These microcontrollers have letter F in their number. For example PIC18F4550. These microcontrollers are good for product development perspective as erase operation can be performed in seconds. This feature eliminated the extra time that PIC with UV-EPROM was taking and hence increased the speed of product development. Here a burner is needed for using PIC for product development. There is no need of extra eraser to delete the contents as flash memory is EEPROM
which is erased electrically. It is necessary to erase all contents of ROM if you want to program it again. The erasing operation is performed by ROM programmer itself. These microcontrollers can be programmed by PICkit that can be connected via USB to your computer.
OTP version of PIC microcontroller
OTP mean one time programmable microcontroller. Such types of microcontrollers are used for launching your finalized product. Obviously as their name indicate that they can not be reprogrammed again so they are cheap. Their package number has letter C indicating OTP ROM for example PIC16C432 etc.
This types is used for product development. Once you have finalized the product then for mass production the price per unit is quite low.
Masked version of PIC microcontroller
This is the last version of PIC with masked memory. You can provide your program to microchip and they will burn it while designing your chip during the fabrication process. Such microcontrollers are named as masked PIC based on one of the steps of fabrication process known as masking. They are the cheapest among all other types.
what is the program data memory of PIC microcontroller?
The program data memory of PIC microcontroller is actually used for strong data or scratch pads. It can vary in size in different families. Generally the size of program data memory is from 32 bytes to 4096 bytes. This memory has been divided into 16 banks each of which is of 256 bytes. Hence there are total 16 banks named as bank0 to bank15. Bank 0 is common in all microcontrollers. This bank is also known as access bank. Generally program data memory is divided into two categories: General Purpose Registers (GPRs) and Special Function Registers (SFRs). SFRs are found in almost all controllers and their size is fixed (128 bytes). Rest of the memory (4096-128) is used for GPRs.
Since there are maximum of 4096 bytes available so starting from 0 we will have 0 to 4095 byte sized slot available. If you convert 4095 into HEX it is equal to FFFh. Thats why the last slot has address of FFFh. Similarly, 3968 bytes are available for GPRs so from 0 to 3967 (F7Fh) is mentioned for GPRs and SFRs start from F80 which is 3968 in decimals.
PIC microcontroller instructions
Here I will discuss some of the most widely used instructions that are:
MOVLW K: This instruction copies the literal value K into WREG (Working register) K.
ADDLW 5h: This instruction adds the literal value 5h into the WREG register.
MOVWF FileReg: This instruction copies the contents of WREG register into file register. This file register can be a memory location or any SFRs (PORTs of PIC).
ADDWF fileReg, d: This instruction add the contents of file register into wreg register and the resultant is stored depending upon the value of d bit. If d=0, destination is WREG register if d=1 then destination is file register. If nothing is written then by default it is the file register which stores the result.
COMF fileReg: This instruction complements the contents of file register. If the contents of a file register are 55h then after taking the complement they will be AAh.
DEC fileReg: This instruction subtracts 1 from the contents of file register.
MOVF: This instruction copies the contents of file register into the WREG register. This command is usually used for taking input from the external environment.
MOVFF: This instruction copies the contents of one file register into another file register. For example
MOVFF PORTA,PORTB: This instruction will copy the contents f PORTA into PORTB.
Also read here