Unit-1
PIC Microcontroller Architecture
1.1.1 Microcontroller:
A typical microcontroller includes a processor, memory and input/output (I/O) peripherals on a single chip.”
- “A microcontroller is a computer present in a single integrated circuit which is dedicated to perform one task and execute one specific application.”
- It accepts the command and gives output. For example, a TV remote contains a microcontroller chip that takes input of the buttons we press like changing channels and gives the output by changing the channel.
- It contains memory, programmable input/output peripherals as well a processor. Microcontrollers are mostly designed for embedded applications and are heavily used in automatically controlled electronic devices such as cellphones, cameras, microwave ovens, washing machines, etc.
- For example, Intel 8031 and 8051 are 8 bits microcontroller. 16-bit microcontroller − This type of microcontroller is used to perform arithmetic and logical operations where higher accuracy and performance is required.
- Types of Microcontroller
- 8 bit Microcontroller
- 16 bit Microcontroller
- 32 bit Microcontroller
- Embedded Microcontroller
- External memory Microcontroller
- Features of microcontroller
- Processor reset
- Program and Variable Memory (RAM) I/O pins
- Device clocking central processor
- Instruction cycle timers
1.1.2 History:
- The microcontroller is an embedded computer chip that controls most of the electronic gadgets and appliances people use on a daily basis, right from washing machines to anti-lock brakes in cars.
- It was during 1970 and 1971 , Gary Boone designed a single integrated circuit chip that could hold nearly all the essential circuits to form a calculator; only the display and the keypad were not incorporated.
- One of the first applications of microcontrollers was in gas pumps.
- The Microprocessors ability to control other electronic equipment like Photocopiers is realized.
- The emphasis here is not on the computational power of the Microprocessor but rather on a control mechanism with less complex hardware and increased reliability.
- Business at the Texas Instruments at MOS department was mostly a custom business wherein companies like a desktop calculator manufacturers came to TI with a set of specific requirements.
- TI converted those specifications to a chip set normally four, five or six chips to execute or implement the specification for popular companies like canon, Olympia and Olivetti.
- For these companies, it was really amazing that TI provided this ultimate service of compressing so many units on to just four or five or six chips because the previously used technology called the TTL would use hundred to two hundred chips.
- No wonder the business was doing great.
- A common rule at Texas was “one riot, one ranger” which means “one chip, one engineer.”
- So, Texas Instruments that had about twenty MOS design engineers deployed three or four of these at one project at a time. And, it took about six months to complete one project.
- Therefore, business capacity was the number of engineers divided by the number of chips, once in every six months.
- Though the requirements of these projects differed in terms of detail, the major principle and the overall function was quite identical. So, the engineers were really tired of doing these monotonous projects.
- Boone and the other engineers ended up thinking of a matrix of customer needs one way and chunks of circuitry or functional blocks the other way.
- Boone could find out the commonality and he, along with the others considered simulating the thought, “Okay, now if I had these many bytes of data storage, and I had this many bytes of program storage, and I had these many bits of keyboard scan interface, then that would cover all of the specification I know about, maybe”.
- As a result of this excellent thought, came the first TMS 100 microcontroller chip.
- TI offered this microcontroller for sale to the electronics industry in 1974. It was made available in different configurations of RAM and ROM sizes.
- By 1983, nearly 100 million TMS 1000 had already been sold.
1.1.3 Microprocessor and Microcontroller:
Microcontroller:
- Microcontroller is the heart of an embedded system.
- Microcontroller has a processor along with internal memory and input output components.
- Memory and input output are already present and internal circuit is small.
- You can use it in compact systems. Cost of the entire system is low.
- As external components are low, total power consumption is less. So, it can be used with devices running on stored power like batteries.
- Most of the microcontrollers offer power-saving mode.
- It is used mainly in a washing machine, MP3 players, and embedded systems.
- Microcontroller has more register. Hence the programs are easier to write.
- Micro controllers arc based on Harvard architecture.
- It is a by-product of the development of microprocessors with a CPU along with other peripherals.
- It has a CPU along with RAM, ROM, and other peripherals embedded on a single chip.
- It uses an internal controlling bus. Microcontroller based systems run up to 200MHz or more depending on the architecture.
- It's used for application-specific systems. It's simple and inexpensive with less number of instructions to process.
- A microcontroller is a small, low-cost, and self-contained computer-on-a-chip that can be used as an embedded system.
- Microcontrollers usually must have low-power requirements since many devices they control are battery-operated.
- A microcontroller is a chip optimized to control electronic devices. It is stored in a single integrated circuit which is dedicated to performing a particular task and execute one specific application.
- It is specially designed circuits for embedded applications and is widely used in automatically controlled electronic devices. It contains memory, processor, and programmable I/O.
Microprocessor:
- A microprocessor is a controlling unit of a micro-computer wrapped inside a small chip.
- It performs Arithmetic Logical Unit (ALU) operations and communicates with the other devices connected with it. It is a single Integrated Circuit in which several functions are combined.
- Microprocessor is the heart of Computer system.
- It is only a processor, so memory and I/O components need to be connected externally.
- Memory and I/O has to be connected externally, so the circuit becomes large.
- You can't use it in compact systems. Cost of the entire system is high.
- Due to external components, the total power consumption is high. Therefore, it is not ideal for the devices running on stored power like batteries.
- Most of the microprocessors do not have power saving features.
- It is mainly used in personal computers.
- Microprocessor has a smaller number of registers, so more operations are memory-based.
- Microprocessors are based on Von Neumann model. It is a central processing unit on a single silicon-based integrated chip.
- It has no RAM, ROM, Input-Output units, timers, and other peripherals on the chip.
- It uses an external bus to interface to RAM, ROM, and other peripherals.
- Microprocessor-based systems can run at a very high speed because of the technology involved.
- It's used for general purpose applications that allow you to handle loads of data.
- It's complex and expensive, with a large number of instructions to process.
Key Difference microprocessor and microcontroller:
- Microprocessor consists of only a Central Processing Unit, whereas Micro Controller contains a CPU, Memory, I/O all integrated into one chip.
- Microprocessor is used in Personal Computers whereas Micro Controller is used in an embedded system.
- Microprocessor uses an external bus to interface to RAM, ROM, and other peripherals, on the other hand, Microcontroller uses an internal controlling bus.
- Microprocessors are based on Von Neumann model Micro controllers are based on Harvard architecture.
- Microprocessor is complicated and expensive, with a large number of instructions to process but Microcontroller is inexpensive and straightforward with fewer instructions to process.
1.1.4 Criteria for selection of microcontrollers:
- A microcontroller has many uses: in consumer electronics like toys and appliances, in communication devices like cell phones and computers, and in medical instruments like ECG machines and monitors.
- Also, in industrial settings, it can be used to control temperature or pressure, count time, measure speed, or activate the braking system.
- Because microcontrollers are suitable for specific tasks, it is essential to choose a microcontroller that is most appropriate for a project.
- There are many factors to consider.
1.Power efficiency.
i) There is a trade-off between processing performance and power consumption: a device with higher processing power will consume more energy.
ii)Therefore, if your microcontroller is wireless and running on a rechargeable battery, you need to weigh sacrificing power efficiency against getting more processing power, or vice versa.
2.Temperature tolerance.
i)Depending on the environment in which your microcontrollers operate, you may want devices that withstand extreme temperature.
ii)There will be a trade-off between temperature tolerance and cost.
3.Security.
i)Hacking which targets IoT devices is rising, a threat that is especially relevant to microcontrollers used in automobiles.
ii) In response, microcontroller makers are implementing layers of security such as cryptography and physical security.
iii) Now, users can purchase microcontrollers that have been certified to the latest security standards or use MCUs with on-chip secure hardware.
4.Memory.
i)The amount of memory (RAM and ROM) you need will depend on the programs you will be running. More programs need more random access memory (RAM).
ii)In addition, a GPU will require not only more RAM but faster read/write time as well.
Key Takeaways
- A microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system. A typical microcontroller includes a processor, memory and input/output (I/O) peripherals on a single chip
- The microcontroller is an embedded computer chip that controls most of the electronic gadgets and appliances people use on a daily basis, right from washing machines to anti-lock brakes in cars.
- Gary Boone designed a single integrated circuit chip.
- A microprocessor is a controlling unit of a micro-computer wrapped inside a small chip.
- Microcontroller is the heart of an embedded system.
1.2.1 Features and architecture
- PIC is a family of microcontrollers made by Microchip Technology, derived from the PIC1650.
- High-Performance, Enhanced Flash Microcontroller with CAN, in 40-pin PDIP
- High-Performance RISC CPU
- Lead-free; RoHS-compliant
- Operating speed: 40 MHz, Up to 10 MIPS
- Operating voltage: 4.2-5.5V
- Industrial temperature range (-40° to +85°C)
- Linear program memory addressing up to 2 Mbytes
- Linear data memory addressing up to 4 Kbytes
- 4-10 MHz oscillator/clock input with PLL active
- 16-bit wide instructions, 8-bit wide data path
- Interrupt capability (21 Interrupt Sources) with Priority levels
- 8 × 8 Single-Cycle Hardware Multiplier
- 75 instructions
- Flash Memory: 32 Kbytes (16,384 words)
- Data SRAM: 1536 bytes.
- Data EEPROM: 256 bytes
Fig.1. PIC18Fxxx Architecture
- PIC Microcontroller architecture is based on Harvard architecture and supports RISC architecture (Reduced Instruction Set Computer).
- PIC microcontroller architecture consists of memory organization (ram, rom, stack), CPU, timers, counter, ADC, DAC, serial communication, CCP module and I/O ports. PIC microcontroller also supports the protocols like CAN, SPI, UART for interfacing with other peripherals.
- The CPU is at the centre of the diagram and consists of an 8-bit ALU, an 8-bit working accumulator register (WREG), and an 8 8 hardware multiplier.
- The higher byte and the lower byte of a multiplication are stored in two 8-bit registers called PRODH and PRODL respectively.
- The program counter and program memory are shown in the upper left portion of the diagram.
- Program memory addresses consist of 21 bits, capable of accessing 2Mbytes of program memory locations.
- The PIC18F452 has only 32Kbytes of program memory, which requires only 15 bits. The remaining 6 address bits are redundant and not used.
- A table pointer provides access to tables and to the data stored in program memory.
- The program memory contains a 31-level stack which is normally used to store the interrupt and subroutine return addresses.
1.2.2 Comparison of PIC 18 series microcontroller:
PIC Family | No. of pins | Flash ROM | RAM | Timers | I/O pins | ADC input channel | Additional Features |
PIC10CXX | 6 | 896 Bytes | 64 Byte | 2 | 4 | 2 Channels(8 -bit Digital Result) | PWM module |
PIC12CXX | 8 | 3.5 KB | 128-256 Bytes | 2 | 6 | 3 Channels(8 -bit Digital Result) | USART,PWM module |
PIC16FXX | 14-40 | 7-28 KB | 512 Bytes-2 KB | 4 | 12 | 4 Channels(10 -bit Digital Result) | WDT,Data E,USART, I2C, SPI-EEPROM,PWM module |
PIC18FXX | 40-100 | 2MB | 32 to 128 KB | 4 | 33-72 | 12 Channels(10 -bit Digital Result) | USB,12-bit ADC,CAN,I2C,SPI Bus, USART,PWM module |
Selection
- Speed
- Amount of RAM/ ROM
- Number of I/O pins, Timers
- Power consumption
- Availability of tools
- Added features like ADC/ DAC/ CCP, Bus support like CAN, SPI, I2C, USB.
- Watchdog timer, Timer modes, Data EEPROM etc.
Advantages
- Small instruction set to learn
- RISC architecture
- Built-in oscillator with selectable speeds
- Easy entry level, in-circuit programming plus in-circuit debugging PICkit units available for less than $50
- Inexpensive microcontrollers
- Wide range of interfaces including I²C, SPI, USB, USART, A/D, programmable comparators, PWM, LIN, CAN, PSP, and Ethernet[26].
- Availability of processors in DIL package make them easy to handle for hobby use.
Limitations
- One accumulator
- Register-bank switching is required to access the entire RAM of many devices
- Operations and registers are not orthogonal; some instructions can address RAM and/or immediate constants, while others can use the accumulator only.
1.2.3 PIC18F458/452 Pin out connection
- PIC18F452 is an 8-bit with 10 MIPS, CMPS, FLASH-based microcontroller that has 34 I/O pins out of 40 Pin packages.
- It is a powerful microcontroller with one 8-bit and three 16-bit timers, 8-Channels 10-bit Analog-digital converter, and I2C, SPI, USART peripheral.
- It is a Low power microcontroller unit that consumes about less than 0.2 uA standby current and 1.6mA normal current during 5V and 4 Mhz operations.
- PIC18F452 also has the feature of Programming code protection, Power-on Reset (POR), Power-up Timer (PWRT), Oscillator Start-up timer with power saving sleep mode.
- The watchdog timer features its own On-Chip RC Oscillator for reliable operations. 2V to 5.5V operating voltage makes the 18F452 suitable for 3.3V and 5.0V logic level operations.
Fig.2. PIC18F442
- PIC18F452 is an 8-bit with 10 MIPS, CMPS, FLASH-based microcontroller that has 34 I/O pins out of 40 Pin packages.
- It is a powerful microcontroller with one 8-bit and three 16-bit timers, 8-Channels 10-bit Analog-digital converter, and I2C, SPI, USART peripheral.
- It is a Low power microcontroller unit that consumes about less than 0.2 uA standby current and 1.6mA normal current during 5V and 4 Mhz operations.
- Alternative products for PIC18F452 microcontroller are listed below-
1. PIC12F629
2. PIC12F683
3. PIC16F505
4. PIC12F508
5. PIC16F676
6 .PIC16F72
7 .PIC16F873A
8. PIC16F876A
9. PIC16F886
10. PIC16F252
1.2.4 Registers of PIC18F:
- Most devices in the PIC18F family are source compatible with each other. Table 2.1 gives the characteristics of some of the popular devices in this family.
- The architectures of most of the other microcontrollers in the PIC18F family are similar.
- The reader may be familiar with the programming and applications of the PIC16F series.
- Before going into the details of the PIC18F series, it is worthwhile to compare the features of the PIC18F series with those of the PIC16F series.
- The following are similarities between PIC16F and PIC18F:
- Similar packages and pinouts
- Similar special function register (SFR) names and functions
- Similar peripheral devices.
Key Takeaway
- PIC Microcontroller architecture is based on Harvard architecture.
- PIC18F452 is an 8-bit with 10 MIPS, CMPS, FLASH-based microcontroller that has 34 I/O pins out of 40 Pin packages.
- PIC18F452 is an 8-bit with 10 MIPS, CMPS, FLASH-based microcontroller.
- It is a powerful microcontroller with one 8-bit and three 16-bit timers.
1.3.1 Program Memory(ROM):
- Program memory is a non-volatile memory.
- All modern PIC processors use a Flash memory technology that allows the program memory to be reprogrammed using a simple hardware interface.
- It is common to include some kind of programming connector on even a production product to allow for firmware updates if needed.
Fig.3. Program Memory
- The original 8051 Microcontroller by Intel has 4KB of internal ROM.
- Some variants of 8051 like the 8031 and 8032 series doesn’t have any internal ROM (Program Memory) and must be interfaced with external Program Memory with instructions loaded in it .
- Almost all modern 8051 Microcontrollers, like 8052 Series, have 8KB of Internal Program Memory (ROM) in the form of Flash Memory (ROM) and provide the option of reprogramming the memory.
- ROM is used for permanent saving program being executed, and it is divided into two sections, Boot Program section and the Application Program section.
- These two sections can have different level of protection since they have different sets of Lock bits.
- It is normally possible to store constants - i.e. initialized variables that you do not change - in the program memory.
- data memory is a place used to store your variables and use them later for setting or getting the values.
- it is non-volatile, but can be reprogrammed.
- All the PIC chips have a configuration bit that can be used to read-protect the program memory so the device programmer can no longer read the memory.
- When coding in a language like c or c++ you can interact with your memory in a more low level way.
- One of the most common problem is accessing a memory that has already been free.
- This is a memory that you’ve either released with free , or memory that your program has automatically released, for example from the stack.
- Memory is divided in a multiple segments- stack and heap.
- Stack- Stack memory has a set of ways and operation for its work.
- Heap- The heap is often used to allocate big amounts of memory that are supposed to exist as a long as the developer wants.
1.3.2 Data Memory(RAM):
- The Data Memory or RAM of the 8051 Microcontroller stores temporary data and intermediate results that are generated and used during the normal operation of the microcontroller.
- Almost all modern variants of 8051 Microcontroller have 256B of RAM.
- In this 256B, the first 128B i.e. memory addresses from 00H to 7FH is divided in to Working Registers (organized as Register Banks), Bit – Addressable Area and General Purpose RAM (also known as Scratchpad area).
- In the first 128B of RAM (from 00H to 7FH), the first 32B i.e. memory from addresses 00H to 1FH consists of 32 Working Registers that are organized as four banks with 8 Registers in each Bank.
- The data space that is used for temporarily storing constant and variable values that are used by the microcontroller during normal program execution.
- Data memory serves for storing and keeping data required for the proper operation of the program depending on the programming progress ,it can, but does not have to , be split into two sections for DSP2 instruction set to data memory is a considered to consist of two sections.
- The two data spaces are accessed by using two address generation unit and separate data paths , i.e. two data can read or writt3en simultaneously.
- Structure of the data memory of the dsPCIC30F4013 and dsPIC30F6014A device.
- Then size of the data memory similarly to the program memory depends on the model on dsPIC device for dsPIC30F4013 device data memory has 64k.
- The addresses are 16bit i.e.no more4 than 64k addresses can be generated all data memory addresses are even.
- An attempt to access an odd address will result device reset. The first 2k locations are reserved for the SFR an general purposes.
- These register contain the control and status bits of the device.
- This division is essential only for DSP instruction.
- This access to the memory speed up cosiderly the execution of DSP instruction which have been optimised for signal processing ,which most of the time requires calculation of the sum of products.
- This requires fast reading of both operands to be multiple and the result added to the previous value.
- The size of the data memory similarly to the program memory depends on the model of dsPIC device.
Key Takeaway
- The 8051 microcontroller's memory is divided into Program Memory and Data Memory.
- Program memory is a non-volatile memory.
- The original 8051 Microcontroller by Intel has 4KB of internal ROM.
- Memory is divided in a multiple segments- stack and heap.
- The Data Memory or RAM of the 8051 Microcontroller stores temporary data and intermediate results that are generated and used during the normal operation of the microcontroller.
1.4.1 Addressing modes with instruction:
- The term addressing modes refers to the way in which the operand of an instruction is specified.
- The addressing mode specifies a rule for interpreting or modifying the address field of the instruction before the operand is actually executed.
- Categories:
1. Addressing modes for data
2. Addressing modes for branch.
- The 8086 memory addressing modes provide flexible access to memory, allowing you to easily access variables, arrays, records, pointers, and other complex data types.
- The key to good assembly language programming is the proper use of memory addressing modes.
Types of addressing modes:
- Register mode – In this type of addressing mode both the operands are registers.
Example:
MOV AX, BX
XOR AX, DX
ADD AL, BL
2. Immediate mode – In this type of addressing mode the source operand is a 8 bit or 16 bit data. Destination operand can never be immediate data.
Example:
- MOV AX, 2000
- MOV CL, 0A
- ADD AL, 45
AND AX, 0000
3. Displacement or direct mode – In this type of addressing mode the effective address is directly given in the instruction as displacement.
Example:
MOV AX, [DISP]
MOV AX, [0500]
4. Register indirect mode – In this addressing mode the effective address is in SI, DI or BX.
Example:
MOV AX, [DI]
ADD AL, [BX]
MOV AX, [SI]
5. Based indexed mode – In this the effective address is sum of base register and index register.
Base register: BX, BP
Index register: SI, DI
6. Indexed mode – In this type of addressing mode the effective address is sum of index register and displacement.
Example:
MOV AX, [SI+2000]
MOV AL, [DI+3000]
7.Based mode – In this the effective address is the sum of base register and displacement.
Example:
MOV AL, [BP+ 0100]
8.Based indexed displacement mode – In this type of addressing mode the effective address is the sum of index register, base register and displacement.
Example:
MOV AL, [SI+BP+2000]
9.String mode – This addressing mode is related to string instructions. In this the value of SI and DI are auto incremented and decremented depending upon the value of directional flag.
Example:
MOVS B
MOVS W
10.Input/Output mode – This addressing mode is related with input output operations.
Example:
IN A, 45
OUT A, 50
11.Relative mode –
In this the effective address is calculated with reference to instruction pointer.
Example:
JNZ 8 bit address
IP=IP+8 bit address
1.4.2. Oscillator configurations:
- In a pic microcontroller MID-RANGE MCU FAMILY an internal circuit is used, that is called oscillator for generating the device clock, which is required for executing the instruction and peripherals of the function.
- For generating the one internal instruction four clock (TCY)periods are used.
- There are 4 common oscillator modes that are available on most PICmicro devices.
- These modes support crystals, canned oscillator modules, some resonators or the use of an external resistor and capacitor as a clock source. When using a crystal or resonator, other components such as capacitors may be needed. We will look at this later.
- When an oscillator is designed, it should be qualified.
- The purpose of qualifying and requalifying an oscillator is to ensure it will work under all the conditions where it is expected and specified to perform.
- Oscillator designs should be tested just like your software and other hardware.
- When qualifying an oscillator, it is a necessary to test it at least to the limits of its
- intended purpose. However, it is much better to test it beyond its intended use to help ensure that it will function correctly in your design.
- If using a crystal or resonator, make sure that your capacitor and drive level selection are correct. You should observe OSC2 with an oscilloscope.
- You should see a sine wave with an amplitude as large as possible without clipping.
- Remember, since the probe has some capacitance, measuring the signal will affect it.
- You should use the highest power probe you can, such as a x100 or FET
- amplified probe, for testing oscillator circuits. x10 probes can be used, but they will
- load down the circuit considerably and the results may be inaccurate.
- If you migrate your design from one PICmicro device to another, it is recommended
- that you requalify your oscillator design. Common examples of migration are a:
- PIC16C74 to a PIC16F877, or a PIC12C508 to a PIC12C508A, or a PIC16C54 to a PIC16C54C
1.4.3 Reset Operation
- The loop repeats endlessly, unless the reset is operated.
- The reset operation is not represented in the flowchart, because it is an interrupt, and therefore may occur at any time within the loop.
- The self-reset operation is discussed in section 9.6. Here, we will have a look at reporting information about the fault.
- The SYSRESETREQ feature might also be used by the debugger after a debug connection is established, after flash programming is carried out and when user specified a target reset operation.
- Clean and fast power-up and down slope are provided to the microcontroller to guarantee reliable Power on Reset operation. If necessary, add an external voltage supervisor.
- The NWK layer first resets the MAC layer.
- The reset request comes from the APL layer in the form of NLMERESET.request.
- A device performs the NWK layer reset after the initial powerup, before attempting to join, and after leaving a network.
- A device performs the NWK layer reset after the initial powerup, before attempting to join, and after leaving a network.
- 16-bit MCUs and DSCs have a Reset Control register (RCON). When a reset occurs, RCON is updated to indicate the source of the reset.
- In addition to reporting reset conditions, RCON also contains information on the WDT and some power-saving modes.
- RCON can be examined by an application's start-up code to see why a device entered reset.
1.4.4 Brownout Reset
- A brownout reset is a circuit that causes a computer processor to reset (or reboot) in the event of a brownout, which is a significant drop in the power supply output voltage.
- Without a brownout reset circuit or an uninterruptible power supply (UPS) that maintains the full normal operating voltage for the processor when a brownout occurs, a processor can malfunction or lock up.
- In some cases, if a processor receives an abnormally low voltage and continues to operate anyway, it will produce nonsensical output.
- Brownouts can occur for brief intervals or over extended periods. They commonly occur on utility lines at times of exceptional power demand, such as during heat waves or after natural disasters.
- In a computer, a brownout can also occur as a result of a problem with the internal power supply that converts the AC utility power to the DC used by a computer's internal electronic components.
1.4.5 Watchdog Timer:
- A watchdog timer (WDT) is a hardware timer that automatically generates a system reset if the main program neglects to periodically service it.
- It is often used to automatically reset an embedded device that hangs because of a software or hardware fault.
- PIC18F2420/2520/4420/4520 devices offer a total of seven operating modes for more efficient power management.
- These modes provide a variety of options for selective power conservation in applications where resources may be limited (i.e., battery-powered devices).
- There are three categories of power-managed modes:
- Run modes
- Idle modes
- Sleep mode
- These categories define which portions of the device are clocked and sometimes, what speed.
- The Run and Idle modes may use any of the three available clock sources (primary, secondary or internal oscillator block); the Sleep mode does not use a clock source.
- The power-managed modes include several power saving features offered on previous PIC devices.
- One is the clock switching feature, offered in other PIC18 devices, allowing the controller to use the Timer1 oscillator in place of the primary oscillator.
- Also included is the Sleep mode, offered by all PIC devices, where all device clocks are stopped.
1.4.6 Power Down Modes and Configuration
- Switching from one power-managed mode to another begins by loading the OSCCON register.
- The SCS<1:0> bits select the clock source and determine which Run or Idle mode is to be used.
- Changing these bits causes an immediate switch to the new clock source, assuming that it is running.
- The switch may also be subject to clock transition delays.
- These are discussed in “Clock Transitions and Status Indicators” and subsequent sections.
- Entry to the power-managed Idle or Sleep modes is triggered by the execution of a SLEEP instruction.
- The actual mode that results depends on the status of the IDLEN bit.
- Depending on the current mode and the mode being switched to, a change to a power-managed mode does not always require setting all of these bits.
- Many transitions may be done by changing the oscillator select bits, or changing the IDLEN bit, prior to issuing a SLEEP instruction.
- If the IDLEN bit is already configured correctly, it may only be necessary to perform a SLEEP instruction to switch to the desired mode.
Key Takeaway
- The addressing mode specifies a rule for interpreting or modifying the address field of the instruction before the operand is actually executed.
- When an oscillator is designed, it should be qualified.
- A watchdog timer (WDT) is a hardware timer that automatically generates a system reset if the main program neglects to periodically service it.
- Switching from one power-managed mode to another begins by loading the OSCCON register.
- A watchdog timer (WDT) is a hardware timer that automatically generates a system reset if the main program neglects to periodically service it.
- A brownout reset is a circuit that causes a computer processor to reset (or reboot) in the event of a brownout, which is a significant drop in the power supply output voltage.
Reference:
1.Peatman, John B, “Design with PIC Microcontroller”, Pearson Education PTE
2.Ramesh Gaonkar, “Fundamentals of Microcontrollers and Applications In Embedded Systems(with the PIC18 Microcontroller Family)”Thomson/Delmar Learning; 1 edition (January 8, 2007), ISBN:978-1401879143
3.Microchip’s PIC18FXXX Data Sheet
4.Muhammad Ali Mazidi, SarmadNaimi,“ARM Assembly Language Programming & Architecture”