PIC 16FA is a microcontroller manufactured by Microchip Inc. You can see its specifications and download the datasheet here. PIC16F87XA 28/40/Pin Enhanced Flash Microcontrollers Devices Included in this Data Sheet: • PIC16FA • PIC16FA • PIC16FA • PIC16FA. Learn about PIC16FA PIC series microcontroller with its a detailed overview of PIC16FA features with its PDF datasheet to download.
|Published (Last):||10 August 2005|
|PDF File Size:||12.5 Mb|
|ePub File Size:||11.46 Mb|
|Price:||Free* [*Free Regsitration Required]|
The IDE used in this article has been phased out by Microchip. However, dwtasheet techniques and architecture described herein holds good. The first instance of this article originated at my google site page. It was further migrated to wordpress and then this page. A micro-controller, in simple words, is a miniature computer with a central processing unit and some peripherals integrated into a single integrated circuit package. The central processing unit can can execute some instructions resulting in some datasheey.
This instructions define the architecture of the controllers central processor in a macro scale. This gives rise to the a major classifications in processor architecture as.
Datasheeg learn about controllers, processors and architectures in a general and abstract manner is tedious, time consuming and at-times dry. So here 168f77a are considering a simple microcontroller — the PIC 16Fa as an example to begin with. PIC 16Fa is a mid range microcontroller from microchip inc.
When studying any electronic device or part, the bible is its datasheet. The data sheet describes in detail the architecture, capabilities and requirements of the part. Download it and keep it for further reference throughout the tutorial.
A printout of section 15 of the datashret only 6 pages will be a great help during the programming exercises. As said in the introduction, PIC micro controller, like any other micro controller executes the instructions one at a time in a sequential order as stored in its program memory and it is the skill of the developer to use these instructions 35 in this case to fatasheet magics like dattasheet intelligent robot.
The programs written using these basic instructions are called assembly language programs and is the most primitive not exactly, but close [: D] and optimized form of programming. The second form is easier to understand and manipulate from a programmers point of view.
But to learn the architecture and functionality of the micro controller, we have to deal with the assembly language programming. Since it gives a clear cut idea as to what is happening inside the device — i.
A software that can simulate the internal working of the PIC micro controller and the datasheet of the device. The latest version can be downloaded for free datasehet. We will be using this software to simulate instruction flow within the PIC microcontroller and there by understand its architecture. The data sheet is the document in which the device vendor release with 16f87a7 product. It will have all the device details and specifications for end users. Once we are familiar with the basic concepts of microcontrollers, we can explore the data sheet on our own and discover newer tricks.
The datasheet of PIC 16fa can be downloaded from here. Shown above is a simplified processor architecture.
But, I want to keep the picture simple so that explanation will be easier. The firmware program resides in the program memory. Once the processor is reset and ready to go, the program 16f87a, which is simply a counter that acts as a pointer to the program instructions points to the initial location of the program memory. The execution unit fetches the program instruction in this first location.
This will be one of the 35 instructions that the PIC can handle in our case. These instructions are stored in the program memory in an encoded datasheft. It will be a binary number that has encoded information relevant to the instruction.
PIC16FA: Introduction, Pin Diagram, Pin Description, Features & Datasheet
datasgeet For example, the instruction movlw 0xff will be encoded as 11 when stored in the PIC 16fa program memory. Fatasheet 14 bit encoded binary contains the instruction, the scratch pad memory location to be used and the literal value 0xff.
A complete list of instructions and their encoding is given in page of the datasheet. The task of the execution unit, in simple words, is to fetch the instructions pointed to by the program counter PCunderstand it Decode catasheet execute it.
Execution of a command can include a wide variety of tasks like moving some data from one RAM location to another, or storing it in a non-volatile EEPROM location, or communicating with an external device like a PC. These tasks vary from micro controller to micro controller. A user side view of these tasks can be obtained by analyzing the instruction set of the specific device we are planning to use. RAM is the volatile memory integrated within the controller package.
It provides working space for the data manipulation during the command execution. The amount of RAM available is an important metric as the datashete of operation and instruction set for a micro controller. Scratch pad memory registers are high speed memory registers which are integral to the processing center architecture. The concept is from processor architecture, since the external memory access which will be much slower can be a bottleneck to the high speed operations within the processor.
Microcontrollers usually have one or two such registers only. Our point of interest here is that the Von Neumann architecture has a common bus for program memory and data memory RAMwhere as the Havard architecture maintains separate buses.
PIC 16Fa has the havard architecture, as it can be noticed from the architecture diagram above. We will analyze the architecture in light of the general introduction in the previous section. The blocks are identified below. The instructions are encoded and stored in the non-volatile Flash Program memory. Upon reset, the program counter points to memory location 0x This point is the reset vector and contains the first instruction of the steps that are to be done once the controller is reset.
Details of the actual reset mechanism and other details will be dealt with later on. Under regular circumstances, the program counter increments by one every execution cycle explained later, as of now, consider it as each datashwet. This datashedt location is used by the execution unit to fetch the next instruction. When the execution unit receive jump or loop instructions, it stores the current program counter value to the stack and loads the new program location to go to into the Adtasheet.
Thus these instructions take two execution cycles to complete. A complete listing of the execution times can be found in page of the data sheet. The stack has 8 levels. A detailed explanation if the instruction set will follow later on in the tutorial, but for easy understanding of many of the concepts, it is advised to thoroughly go through the instruction set summary given in section 15 of the datasheet 6pages before proceeding further.
In the above code snippet, the PC increments by one until the execution unit receives the call instruction at Thusat the next execution cycle, the instruction fetched is the movlw at Then the regular operation take place with the PC increment from At 07another call instruction is encountered. Again, the immediate next PC 08 is pushed into the stack. So, now the PC points to Normal execution continues till 10 where the return instruction pops 03 from the stack. Here we utilized two levels of the stack.
This will corrupt the firmware. In those cases, we have to develop routines for stacking. Operations resulting from the execution of instructions can all be considered as manipulation of data in different parts of the micro controller. It may be data in the RAM or in other special registers with designated purpose.
The RAM block bytes in size is not one single continuous block of memory, but is rather divided into four banks of bytes each. Data cannot directly be written into or transferred from one RAM register to another using any of the 35 available instructions.
Before the transfer the appropriate bank is also to be selected. The table of selection values is given below. The working register, 16t877a referred to as the W reg, is the only scratchpad memory register accessible to the user in the PIC 16Fa. It resides outside the RAM register block. Every data transfer in or out of the RAM register has to go through the W reg. The code for the same will look like this.
Once this is done, the value remains in the location until either it is changed by another instruction or the micro controller is reset or powered off. A microcontroller is a synchronous digital device. The PIC 16fa can generate its satasheet clock from a piezo crystal connected to its specific pins.
This is the most popular method of clock generation for its accuracy. Other methods are also available, which will be discussed later. This crystal can be up to a maximum speed of 20Mhz.
The clocking signal derived from the crystal is internally divided by four. This is to provide synchronization timing and clock signals to all parts of the micro controller.
However, the division of master clock is primarily to establish an instruction pipeline. Thus, if we generate a 20Mhz master clock, the execution speed will be a maximum of 5Mhz. The single cycle instructions execute at this speed. Consider a laundry with one washing and one drying machine.
If operations are carried out one after another, the entire task to complete two dattasheet of laundry takes 2 hours. This is like fetching, decoding and executing instructions only once the previous instruction is completely finished. But, while the first set is being dried, if the second set is put to wash, the operations are carried out parallel, thereby saving net time.