Self Internet Notes
Self Internet Notes
known as a host) to imitate the functions of another computer system (known as the guest). It
enables the host system to run software, tools, peripheral devices and other components which
are designed for the guest system.
It is named after the mathematician and early computer scientist John Von Neumann.
The computer has single storage system(memory) for storing data as well as program to
be executed.
Processor needs two clock cycles to complete an instruction.Pipelining the instructions is
not possible with this architecture.
In the first clock cycle the processor gets the instruction from memory and decodes it. In
the next clock cycle the required data is taken from memory. For each instruction this cycle
repeats and hence needs two cycles to complete an instruction.
This is a relatively older architecture and was replaced by Harvard architecture.
Harvard Architecture:
The name is originated from "Harvard Mark I" a relay based old computer.
The computer has two separate memories for storing data and program.
Processor can complete an instruction in one cycle if appropriate pipelining strategies are
implemented.
In the first stage of pipeline the instruction to be executed can be taken from program
memory.In the second stage of pipeline data is taken from the data memory using the decoded
instruction or address.
Most of the modern computing architectures are based on Harvard architecture.But the
number of stages in the pipeline varies from system to system.
Cache Memory
Definition - What does Cache Memory mean?
Cache memory is a small-sized type of volatile computer memory that provides high-
speed data access to a processor and stores frequently used computer programs,
applications and data. It is the fastest memory in a computer, and is typically integrated
onto the motherboard and directly embedded in the processor or main random access
memory (RAM).
Basic Clock System provides the required clocks to the MSP430x2xxx devices.Most
MSP430 microcontrollers have 4 clock sources to produce fast and slow clocks.The
main clock sources (oscillators) of MSP430x2x family are
LFXT1CLK - It is a crystal powered low/high frequency oscillator that can work with
either a 32KHz standard watch crystal,standard crystals that operate in the MHz range
or external clock sources (400KHz -16MHz range).Please note that,not all clock
features are supported on all msp430x2xxx devices.For eg: LFXT1CLK of
MSP430G2553 supports only the low frequency mode.You can only connect a 32KHz
watch crystal to the oscillator inputs,higher frequency crystals are not supported.
XT2CLK -This is an optional high frequency oscillator that can be used with standard
crystals,resonator or external clock sources in the 400KHz to 16MHz range.Please note
that XT2 is absent in MSP430Gxxx series like MSP430G2553.
DCOCLK - DCO is an integrated Digitally Controlled Oscillator which do not use any
external crystals.The DCO can generate a wide variety of frequencies ranging from few
100 kilo hertz to 10's of MHz.The oscillator has a first startup time and is the default
clock of the MSP430 after reset.One problem with DCO is that clock frequency is
temperature dependent.
VLOCCLK - this is a very low power/low frequency internal oscillator than can produce
a frequency of12 KHz.
MSP430 produces 3 different clock signals using a combination of the above mentioned
oscillators.These clock signals can be routed to various peripherals
like CPU,Timers,ADC etc depending upon the requirements.The 3 clock signals are
MCLK - Known as Main Clock.It is a fast,high frequency clock usually used by the
CPU or other fast components like ADC10,ADC12,Watch Dog Timer (WDT).MCLK can
be sourced either from LFT1CLK,DCO,VLO or XT2 oscillator (if it is present).You can
divide the clock signal by 1/2/4/8 using the internal divider.
SMCLK - Known as Sub Main clock.It can be sourced either from LFT1CLK,DCO,VLO
or XT2 oscillator (if it is present).You can divide the clock signal by 1/2/4/8 using
the internal divider.
ACLK - Known as Auxiliary Clock is a slow, low frequency clock(12 KHz or 32KHz).It
can only be sourced from LFT1CLK or VLO.You can divide the clock signal by 1/2/4/8
using the internal divider. ACLK is active in all Low power modes except LPM4.
Low Power Modes of MSP430
To conserve power, MSP430 spends most of its time in sleep and periodically wakes up
to perform some operation and again goes back to sleep.MSP430 has 5 low power
modes named as LPM0 to LPM4 .The table below shows which clocks are active and
which are disabled in various low power modes.
LPM0 - Both CPU and MCLK are disabled.SMCLK and ACLK remain active.Peripherals
which use SMCLK and ACLK also remain active.
LPM4 - All the clocks including ACLK are disabled in this mode.The controller
can only be waken from this mode by an external interrupt.This mode consumes
the least power compared to all other modes.
Fig 2-10 Operating Modes
PxREN register, Pull up/down resistors
Now, after we direct a pin towards INPUT, and when there is no actual input given,
what value of input does the MCU take? The input value is neither HIGH not LOW, it is
FLOATING. To eliminate this problem =, we use a pull up/ pull down resistor.
Pull up resistor: A pull up resistor pulls the input to HIGH when it is floating. That
means, the input value will be initially HIGH. Here, forget the concept that input is
HIGH only when a button is pressed. When a pull up resistor is enabled for a button, the
input value will be HIGH when the button is NOT PRESSED. When the button is
PRESSED, the input value becomes LOW. So, we have to alter the conditions we give in
the code so that the corresponding code is executed when the button is
PRESSED. It should not be generalised that HIGH = BUTTON PRESSED or vice
versa.
A pull up resistor. When the switch is not pressed, we can see that the input is taken as
Vcc (HIGH). When the switch is pressed, the input gets to LOW. Note that the other
end of the switch is connected to GROUND not Vcc, and the resistor’s end is
connected to Vcc.
Pull down resistor: A pull down resistor works the opposite way of the pull up
resistor. When no external input is provided, the input value is pulled down to LOW,
and when the actual input is provided (say, button is pressed), the input value becomes
HIGH.
A pull down resistor. When the switch is not pressed, the input is taken as LOW, and
when the switch is pressed the input is taken as HIGH. Note that the other end of
the switch is connected to Vcc, and the resistor is connected to ground.
PxREN register:
To enable/disable the pull up/down resistor, we use the PxREN register.
By default, the pin 1.3 (connected to the in built button on the MCU), the pull up
resistor is enabled when P1REN is 1 for that corresponding pin.
What if you want to use a pull down resistor instead of the default pull up resistor?
You can choose the resistor to pull up/down using the PxOUT register. Note that we are
using pull up/down resistors for pins that are configured towards input. So using the
PxOUT register here doesn’t provide an output but configures the pull up/down resistor.