IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -2 1 UNIT 2

Size: px
Start display at page:

Download "IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -2 1 UNIT 2"

Transcription

1 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -2 1 UNIT 2 1. Block diagram of MSP430x5xx series micro-controller CPU architecture of MSP430x5xx Memory map/ Address space of MSP430x5xx I/O Ports / GPIO / Digital IO pins (a) LED interfacing (b) Switches Interfacing and Pull up/down resistor concepts Processing of Interrupts Clock system of MSP Low power modes of MSP Watchdog Timer

2 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT MSP430x5xx Microcontroller : The features of MSP430x5xx micro-controller are : Flash-based ultra-low-power MCUs 16-bit RISC architecture 25 MHz Clock, V operation Flexible power management system Power specification overview, as low as: 0.1 μa RAM retention 2.5 μa real-time clock mode 165 μa / MIPS active Wake-up from standby mode in less than 5 µs. Device parameters: Flash options: up to 512 KB RAM options: up to 66 KB ADC options: 10 & 12-bit SAR GPIO options: 29/31/47/48/63/67/74/87 pins Fig : Block diagram of MSP430 F5529/ F5528 / F5519

3 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -2 3 The block diagram of MSP430F5529 consists of the following modules : 1. Unified Clock System (UCS) : The UCS module provides the various clocks for a device. The UCS module supports low system cost and ultra-low power consumption. It provides 3- internal clock signals : MCLK, SMCLK and ACLK Using three internal clock signals, the user can select the best balance of performance and low power consumption. 2. Embedded Emulation Module (EEM) EEM is accessed and controlled through either 4-wire JTAG mode or Spy-Bi- Wire mode. The emulation, JTAG interface and Spy-Bi-Wire interface are used to communicate with a desktop computer when downloading a program and for debugging. 3. Flash memory : 128 KB 4. RAM : 8 KB + 2 KB if USB is disabled 5. Power Management Module (PMM): The PMM manages all functions related to the power supply and its supervision for the device. The PMM uses an integrated low-dropout voltage regulator (LDO) The Supply Voltage Supervisor (SVS) is used to monitor the supply voltage or an external voltage. The SVS can be configured to set a flag or generate a POR reset when the supply voltage or external voltage drops below a user selected threshold. The brownout reset circuit detects low supply voltages such as when a supply voltage is applied to (or) removed from the VCC terminal. The brownout reset circuit resets the device by triggering a POR (Power on Reset) signal when power is applied (or) removed. 6. Watchdog Timer : A watchdog timer is an electronic timer that is used to detect and recover from computer malfunctions. The Watchdog Timer (WDT) module restarts the system on occurrence of a software problem (or) if a selected time interval expires. During normal operation, the system regularly restarts the watchdog timer to prevent it from elapsing, or "timing out". If the system fails to restart the watchdog due to a hardware fault (or) program error, the timer will elapse and generate a timeout signal. The timeout signal is used to initiate corrective actions like placing the system in a safe state and restoring normal system operation. The WDT can also be used to generate timely interrupts for an application.

4 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT I/O PORTS : P1, P2, P3, P4, P5, P6, P7 & P8 MSP430F5529 has 8-digital I/O ports : P1 to P8. The I/O Ports P1 to P7 have 8- I/O pins and P8 has 3- I/O pins. Each I/O pin is individually configurable for input (or) output direction, and each I/O line can be individually read or written to. All ports have individually configurable pull-up (or) pull-down resistors, as well as, configurable drive strength. Ports P1 and P2 have interrupt capability. Each interrupt for the P1 and P2 I/O lines can be individually enabled and configured to provide an interrupt on a rising edge or falling edge of an input signal. Individual ports can be accessed as byte wide ports or can be combined into word wide ports and accessed via word formats. Port pairs P1/P2, P3/P4, P5/P6, P7/P8, etc. are associated with the names PA, PB, PC, PD, etc., respectively. 8. Full speed USB ( Universal Serial Bus) : Full-speed integrated USB transceiver (PHY)- Physical layerinterface Supports control, interrupt, and bulk transfers Supports USB suspend, resume, and remote wakeup Integrated 1.8 V and 3.3 V low drop-out (LDO) linear regulator Integrated programmable PLL Highly flexible clock frequencies 2 KB of dedicated USB buffer. If USB is disabled, 2 KB buffer space is mapped into RAM and USB pins can be used as GPIO pins Bit Hardware Multiplier (MPY32) The MPY32 is a peripheral and is not part of the CPU. This means its activities do not interfere with the CPU activities. It performs Signed and Unsigned multiplications 8-bit/16-bit/24-bit/32-bit operations 10. Timers Timers are essential to almost any embedded application. The timers are used to generate fixed-period events, periodic wakeup, count edges and replacing delay loops with timer calls allows CPU to sleep, consuming much less power. Timers can support multiple capture/compares, PWM outputs, interval timing and extensive interrupt capabilities. The MSP430F5529 has 4- timer modules 16-bit Timer TA0 : with 5 - CC registers 16-bit Timer TA1 : with 3 - CC registers 16-bit Timer TA2 : with 3 - CC registers 16-bit Timer TB0 : with 7 - CC registers

5 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Real Time Clock ( RTC_A ) Configurable for real-time clock with calendar function or general-purpose counter. Provides seconds, minutes, hours, day of week, day of month, month, and year in real-time clock with calendar function. Interrupt capability 12. Cyclic Redundancy Check (CRC) : The cyclic redundancy check (CRC) module provides a signature for a given data sequence. The signature is generated through a feedback path from data bits 0, 4, 11 & Universal Serial Communication Interface : Two channels : USCI-A & USCI-B Each channel consists of Two ports USCI-A0 & USCI-A1 supports UART, IrDA and SPI USCI-B0 & USCI-B1 supports I2C and SPI 14. ADC12_A The ADC12_A is a high-performance 12-bit analog-to-digital converter (ADC). The module implements a 12-bit SAR core, sample select control and a 16-word conversion-and-control buffer. 16-channel, 14- external & 2- internal 200 KSPS Internal Reference S/H and Auto scan feature 15. Reference Module (REF) The REF module is a general purpose reference system that is used to generate voltage references required for other peripheral modules such as digital-toanalog converters, analog-to digital,converters, or comparators. It generates reference voltages : 1.5 V, 2.0V, 2.5V selectable references 16. Comparator ( Comp_B ) Comp_B is an analog voltage comparator. Comp_B covers general comparator functionality for up to 16 channels. The Comp_B module supports precision slope analog-to-digital conversions, supply voltage supervision, and monitoring of external analog signals.

6 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Direct Memory Access (DMA) Controller Module The direct memory access (DMA) controller module transfers data from one address to another without CPU intervention. Devices that contain a DMA controller may have up to eight DMA channels available. ( The MSP430F5529 has 3-channels) It can also reduce system power consumption by allowing the CPU to remain in a low-power mode, without having to awaken to move data to or from a peripheral. 2. CPU Architecture & Registers of MSP430x5xx :

7 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Memory map/ Address space of MSP430x5xx : Peripherals BSL memory (Flash) Flash Information memory USB RAM RAM Code memory Flash Memory & Interrupt Vector Table 4 KB 2KB (512B * 4 segments) 512 B (128B * 4 segments) 2 KB 8 KB (2KB * 4 sectors) 128 KB (32 KB * 4 banks) 128 KB

8 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT I/O PORTS (GPIO pins) MSP430x5xx devices have up to 12 digital I/O ports : P1 to P11 and PJ. Most ports have eight I/O pins, however some ports may contain less. Each I/O pin is individually configurable for input (or) output direction, and each I/O line can be individually read or written to. All ports have individually configurable pull-up (or) pull-down resistors, as well as, configurable drive strength. Ports P1 and P2 always have interrupt capability. Each interrupt for the P1 and P2 I/O lines can be individually enabled and configured to provide an interrupt on a rising edge or falling edge of an input signal. Individual ports can be accessed as byte wide ports or can be combined into word wide ports and accessed via word formats. Port pairs P1/P2, P3/P4, P5/P6, P7/P8, etc. are associated with the names PA, PB, PC, PD, etc., respectively. When writing to port PA with word operations, all 16 bits are written to the port. Writing to the lower byte of the PA port using byte operations, the upper byte remains unchanged. Similarly, writing to the upper byte of the PA port using byte instructions leaves the lower byte unchanged. Each port is assigned several 8-bit registers that control the function of the pins and provides information on their current status. The following is a list of registers always available for ports: PxSEL (Port Selection) : selects either digital I/O (0) or an alternate function (1) PxDIR (Port Direction) : configures the corresponding pin for input mode(0) or output mode(1) PxIN (Port Input) : Reads the voltage levels on input pins, if they are configured as GPIO. This is read-only register, and reflects the current status of port pins. PxOUT (Port Input) : Sends the value to be driven to each pin, if it is configured as GPIO PxREN ( Port Resistor Enable) : Enables pull-up / pull-down resistors on input pins. 1 Enables pull-up / pull-down resistors 0 Disables pull-up / pull-down resistors If the pin is configured in input mode and PxREN is enabled then, the corresponding bit in PxOUT register selects whether the resistors are pull-up (1) or pull-down (0)

9 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -2 9 Some GPIOs in the MSP430 have the capability to generate an interrupt and inform the CPU when a transition has occurred. MSP430 devices typically have interrupt capability on Ports 1 and 2. The registers controlling these options are as follows: PxIE (Interrupt Enable) : Each bit enables (1) or disables (0) the interrupt for that particular pin PxIES ( Interrupt Edge Select) : Selects whether a pin will generate an interrupt on the rising-edge (0) or the falling-edge (1) PxIFG (Interrupt Flag) : Set whenever the interrupt is detectd on a particular pin Note : Procedure to set / clear any bit in the Port Registers PDIR To set Bit.3 of PDIR ( PDIR.3 = 1 ) To clear Bit.3 of PDIR ( PDIR.3 = 0 ) mov.b # b, &PDIR bis.b # , &PDIR PDIR = PDIR 0x08 PDIR = PDIR BIT3 mov.b # b, &PDIR bic.b # , &PDIR PDIR = PDIR & (~0x08) PDIR = PDIR & (~BIT3) Change all bits in PDIR Only PDIR.3 = 1 Set PDIR.3=1 Set PDIR.3=1 Change all bits in PDIR Only PDIR.3 = 0 Clear PDIR.3=0 Clear PDIR.3= Example (1) : Configure P2.3 as output & send Logic HIGH #include <msp430.h> // Specific device void main (void) { WDTCTL = WDTPW WDTHOLD; // Stop watchdog timer P2SEL = P2SEL & (~BIT3); // Select P2.3 as GPIO pin (P2SEL.3 =0) P2DIR = P2DIR BIT3 ; // Set P2.3 as output pin (P2DIR.3=1) P2OUT = P2OUT BIT3 ; // Send Logic HIGH at P2.3(P3OUT.3 =1) }

10 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT (a). LED Interfacing LEDs can be connected in two standard ways, shown in Figure. A series resistor (220 Ω to 1 KΩ) limits the current through LED. In the active high circuit, LED ON if the pin outputs Logic HIGH In the active low circuit, LED ON if the pin outputs Logic LOW A microcontroller is typically better at sinking current than sourcing it. Hence, the second method is employed for many applications. The complete program needs to carry out the following tasks: 1. Configure the microcontroller. 2. Set the relevant pins to be outputs by setting the appropriate bits of P2DIR. 3. Illuminate the LEDs by writing to P2OUT. 4. Keep the microcontroller busy in an infinite, empty loop. Example (2) : Program in C to light LEDs with a constant pattern. Let LED-1 is connected at P2.3 (active High circuit) & LED-2 at P2.4 (active Low circuit) as shown in Fig. #include <msp430.h> // Specific device void main (void) { WDTCTL = WDTPW WDTHOLD; // Stop watchdog timer P2SEL = P2SEL & ~(BIT3+BIT4); // Select P2.3 & P2.4 as GPIO pins P2DIR = P2DIR BIT3+BIT4 ; // Set P2.3 &P2.4 as output pins P2OUT = P2OUT BIT3 ; // Send Logic-1 at P2.3 (LED 1 ON) active High P2OUT = P2OUT & ~BIT4 ; // Send Logic-0 at P2.3 (LED 2 ON) active Low for ( ; ; ) // Loop forever { // doing nothing } }

11 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT (b). Switches Interfacing & Pull up/down Resistors Concepts Pull-up and pull-down resistors are often used when interfacing a switch or some other inputs with a microcontroller. Pull-up and Pull-down resistors are used in electronic logic circuits to ensure that inputs to the micro-controller settle at expected logic levels if external devices are disconnected or high-impedance. These resistors used in logic circuits to ensure a well-defined logical level at a pin under all conditions. This is because, when no external devices are connected to an input pin, it doesn't mean that it is a logical ZERO' Digital logic circuits have three logic states: high, low and floating (or high impedance). The high-impedance state occurs when the pin is not pulled to a high or low logic level, but is left floating instead. A good illustration of this is an unconnected input pin of a microcontroller. It is neither in a HIGH or LOW logic state, and a microcontroller might unpredictably interpret the input value as either a logical HIGH or logical LOW. Pull-up resistors are used to solve the dilemma for the microcontroller by pulling the value to a logical high state, as seen in the Fig.(a). If there weren t for the pull-up resistor, the MCU s input would be floating when the switch is open. Pull-down resistors work in the same manner as pull-up resistors, except that they pull the pin to a logical low value. They are connected between ground and the appropriate pin on a device. An example of a pull-down resistor in a digital circuit can be seen in the Fig.(b). A pushbutton switch is connected between the supply voltage and a microcontroller pin. In such a circuit, when the switch is closed, the micro-controller input is at a logical high value, but when the switch is open, the pull-down resistor pulls the input voltage down to ground (logical zero value), preventing an undefined state at the input.

12 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Reading Input from a Switch The standard way of connecting a simple push button is shown in Figure 4.4. When the switch is open, The voltage at the pin is basically V CC. The pull-up resistor R pull holds the input at logic 1 (voltage V CC) When the switch is closed The pin is connected to the Ground (Logic 0). The input is therefore active low, meaning that it goes low when the button is pressed. (button down input down) A wasted current flows through the pull-up resistors to ground when the button is pressed. This is reduced by making R pull large. Pull-up and pull-down resistors are often used when interfacing a switch or some other input with a microcontroller. Hence, most microcontrollers have internal pull up/down resistors to reduce the no. of external components. Pull-up or pull-down resistors can be activated by setting bits in the PxREN registers, provided that the pin is configured as an input. Application of Pull up/down Resistors: (1) Interfacing of switches / other input devices with microcontrollers (2) A/D converters to provide a controlled current flow into a resistive sensor. (3) I2C protocol bus, where pull-up resistors are used to enable a single pin to act as an input (or) output.

13 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Example (3) : Program to light LED when button B1 is pressed Let LED1 is connected at P2.3 (active Low circuit) and Push button is connected at P2.1 with internal Pull-up resistor enabled #include <msp430.h> // Specific device void main (void) { WDTCTL = WDTPW WDTHOLD; // Stop watchdog timer P2SEL = P2SEL & ~(BIT1+BIT3); P2DIR = P2DIR BIT3 ; // Select P2.1 & P2.3 as GPIO pins // Set P2.3 as output pin (LED1) P2DIR = P2DIR & ~BIT1 ; // Set P2.1 as input pin (Switch) P2REN = P2REN & ~BIT1 ; // Pull-up/down Resistor Enable for P2.1 P2OUT = P2OUT & ~BIT1 ; // Select Pull-up Resistors for P2.1 P2OUT = P2OUT BIT3 ; // Preload LED1 off (active Low ) for ( ; ; ) // Loop forever { if ((P2IN & BIT1) == 0) // Is button down? (active low) { // Yes: Turn LED1 on (active low!) P2OUT = P2OUT & ~BIT3 ; // Send Logic-0 at P2.1 (LED1 ON) } else { // No: Turn LED1 off (active low!) P2OUT = P2OUT BIT3; // Send Logic-1 at P2.1 (LED1 OFF) } } // end for loop }

14 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Processing of Interrupts in MSP430 : Interrupt : Interrupt is an event that causes the microcontroller to stop the normal program execution. Interrupts are usually generated by hardware and often indicate that an event has occurred that needs an urgent response. Reset is usually generated by hardware, either when power is applied (or) when some unfortunate things have happened and normal operation cannot continue. This can happen accidentally if the watchdog timer has not been disabled, which is easy to forget. A reset causes the device to (re)start from a well-defined state. Why Interrupts? Interrupts are commonly used for a range of applications: Urgent tasks that must be executed promptly at higher priority than the main code. Infrequent tasks, such as handling slow input from humans. This saves the overhead of regular polling. Waking the CPU from sleep. This is particularly important in the MSP430, which typically spends much of its time in a low-power mode and can be awakened only by an interrupt. Calls to an operating system. These are often processed through a trap or software interrupt instruction but the MSP430 does not have one. External & Internal interrupts Interrupts are generated by external devices connected to the microcontroller (or) Interrupts can be requested by most peripheral modules in the core of the MCU, such as the clock generator, Timer, ADC, Serial UART.. etc. Maskable & Non-maskable interrupts Most interrupts are maskable, which means that they are effective only if GIE =1 in the status register (SR). They are ignored if GIE is clear. Therefore both the enable bit in the module and GIE must be set for interrupts to be generated. However, the non-maskable interrupts cannot be suppressed by clearing GIE. There are 3- non maskable interrupts: Oscillator fault (OFIFG) Access violation to flash memory (ACCVIFG) An active edge on the external RST/NMI pin Interrupt Service Routine : The code to handle an interrupt is called an interrupt handler or Interrupt Service Routine (ISR). ISR is something like a subroutine called by hardware and Interrupts must be handled in such a way that the code that was interrupted can be resumed without error.

15 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Interrupt Vector : The CPU must be told where to fetch the next instruction following an interrupt or reset. The address of ISR is called as Interrupt vector The MSP430 uses vectored interrupts. Each ISR has its own vector, which is stored at a predefined address in a vector table at the end of the program memory (addresses 0xFFC0 0xFFFF). When the interrupt is enabled, the present PC value is stored at the stack top and loaded with the address of ISR which is available in Interrupt vector table. The vector table is at a fixed location, but the ISRs themselves can be located anywhere in memory. The vectors for the maskable interrupts depend on the peripherals in a particular device and are listed in a table of Interrupt Vector Addresses in the data sheet. Processing of Interrupts: The request for an interrupt is finally passed to the CPU if the GIE bit is set. Hardware then performs the following steps to launch the ISR: 1. The CPU completes the execution of current instruction. 2. The PC, which points to the next instruction, is pushed onto the stack. 3. The SR is pushed onto the stack. 4. The interrupt with the highest priority is selected if multiple interrupts are waiting for service. 5. The interrupt request flag is cleared automatically for vectors that have a single source. 6. The SR is cleared, which has two effects. First, further maskable interrupts are disabled because the GIE bit is cleared; non-maskable interrupts remain active. Second, it terminates any low-power mode. 7. The interrupt vector is loaded into the PC and the CPU starts to execute the interrupt service routine at that address. This sequence takes six clock cycles in the MSP430 before the ISR commences. The stack at this point is shown in above figure. The delay between an interrupt being requested and the start of the ISR is called the latency. If the CPU is already running, it takes more than 6- cycles to start the execution of ISR (cycles required to execute the current instruction + 6 cycles)

16 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT An interrupt service routine must always finish with the special instruction reti (return from interrupt), which has the following actions. This takes a further five cycles in the MSP430. The stack is restored to its state before the interrupt was accepted. 1. The SR pops from the stack. All previous settings of GIE and the mode control bits are now in effect, regardless of the settings used during the interrupt service routine. In particular, this re-enables maskable interrupts and restores the previous low-power mode of operation if there was one. 2. The PC pops from the stack and execution resumes at the point where it was interrupted. Alternatively, the CPU stops and the device reverts to its low-power mode before the interrupt. Example (4) : Program to configure P2.1 as an interrupt pin ( falling edge interrupt ) #include <msp430.h> // Specific device void main (void) { WDTCTL = WDTPW WDTHOLD; // Stop watchdog timer P2SEL = P2SEL BIT1; // Select P2.1 as Interrupt pin P2IE = P2IE BIT1 ; // Enable interrupt P2.1 P2IES = P2IES BIT1; // Falling edge (1 0) P2IFG = P2IFG & ~BIT1; // Clear interrupt flag for P2.1 while(1) { if ((P2IFG & BIT1) == 1) { // do something } } // end while } // Loop forever

17 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Clock System in MSP430 : All microcontrollers contain a clock module to drive the CPU and peripherals. The basic clock module supports low system cost and ultralow power consumption. Using three internal clock signals, the user can select the best balance of performance and low power consumption. The basic clock module can be configured to operate without any external components, with one external resistor, with one or two external crystals, or with resonators, under full software control. Three clock signals are available from the basic clock module: (1) MCLK : Master clock is used by CPU and system (2) SMCLK : Subsystem Master clock is distributed to peripherals (3) ACLK : Auxiliary clock is also distributed to peripherals. Most peripherals can choose either SMCLK (MHz range) or ACLK, which is typically much slower and usually 32 KHz. A few peripherals such as A/D converters can use MCLK and some peripherals such as timers, have their own clock inputs. Some peripherals have their own dividers for their clock sources, which gives yet more control. MCLK is software selectable as LFXT1CLK, VLOCLK, XT2CLK (if available onchip), or DCOCLK. MCLK is divided by 1, 2, 4, or 8. MCLK is used by the CPU and system. SMCLK is software selectable as LFXT1CLK, VLOCLK, XT2CLK (if available on-chip), or DCOCLK. SMCLK is divided by 1, 2, 4, or 8. SMCLK is software selectable for individual peripheral modules. The auxiliary clock ACLK can be derived only from LFXT1 in most devices so ACLK will not be available if there is no crystal. ACLK is software selectable for individual peripheral modules as LFXT1CLK or VLOCLK. ACLK is divided by 1, 2, 4, or 8.

18 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT The basic clock module includes three or four clock sources: (1) Low- or high-frequency crystal oscillator, LFXT1: Available in all devices. It is usually used with a low-frequency watch crystal (32 KHz) but can also run with a high-frequency crystal (typically a few MHz) in most devices. An external clock signal can be used instead of a crystal if it is important to synchronize the MSP430 with other devices in the system. The LFXT1 oscillator supports ultra-low current consumption using a 32 KHz watch crystal in LF mode. (2) High-frequency crystal oscillator, XT2: Some devices have a second crystal oscillator XT2. It is Similar to LFXT1 except that it is restricted to high frequencies. It can be used with standard crystals, resonators, or external clock sources in the 400-kHz to 16-MHz range. (3) Very low-power, low-frequency oscillator, VLO: The VLO is an internal RC oscillator that runs at around 12 KHz and can be used instead of LFXT1 in some newer devices. It saves the cost and space required for a crystal and reduces the current drawn. It is an alternative to LFXT1 when the accuracy of a crystal is not needed. Devices without LFXT1 (for example, the MSP430G22x0) should be configured to use the VLO as ACLK. (4) Digitally controlled oscillator, DCO: The DCO is an integrated digitally controlled oscillator and it is available in all devices. It is basically a highly controllable RC oscillator that starts in less than 1 sec in newer devices. The DCO frequency can be adjusted by software using the DCOx, MODx, and RSELx bits. Both MCLK and SMCLK are supplied by an internal digitally controlled oscillator (DCO), which is controlled by a frequency-locked loop (FLL). Software can disable DCOCLK by setting SCG0 when it is not used to source SMCLK or MCLK in active mode Control of the Clock Module through the Status Register : The clock module is controlled by 4 bits in the STATUS REGISTER as well as its own peripheral registers. All bits are clear in the full-power, active mode. SCG1 (System clock generator 1) : When set, turns off the SMCLK. SCG0 (System clock generator 0) : When set, turns off the DCO DC generator for DCO. if DCO-CLK is not used for MCLK or SMCLK. OSCOFF (Oscillator OFF ) : When set, turns off the VLO and LF XT1 crystal oscillator if LFXT1-CLK is not used for MCLK or SMCLK. CPUOFF : When set, turns off the MCLK, which stops the CPU.

19 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Low-power modes of MSP430 : Why low power? Portable & mobile devices are getting popular, which have limited power sources, e.g., battery Energy conservation for our planet Power generates heat Power optimization becomes a new dimension in system design, besides performance and cost Principles for Low-Power Applications MSP430 provides many features for low-power operations. Put the system in low-power modes/use low-power modules as much as possible Provide clocks of different frequencies frequency scaling Lower supplied voltage voltage scaling Turn off clocks when no work to do clock gating Use interrupts to wake up the CPU, return to sleep when done Peripherals should be switched on only when needed. Use low-power integrated peripheral modules in place of software, for ex.-timer For longer software routines, single-cycle CPU registers should be used. The MSP430 family is designed for ultralow-power applications and uses different operating modes. The operating modes take into account three different needs: Ultralow-power Speed and data throughput Minimization of individual peripheral current consumption Entering and Exiting Low-Power Modes An enabled interrupt event wakes the MSP430 from any of the low-power operating modes. The program flow is: Enter interrupt service routine: The PC and SR are stored on the stack CPUOFF, SCG1, & OSCOFF bits are automatically reset enters active mode MCLK must be started so CPU can handle interrupt Options for returning from the interrupt service routine: The original SR is popped from the stack, restoring the previous operating mode. The SR bits stored on the stack can be modified within the ISR to return to a different operating mode when the RETI instruction is executed.

20 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT The low-power modes 0 to 4 are configured with the CPUOFF, OSCOFF, SCG0, and SCG1 bits in the status register The advantage of including the CPUOFF, OSCOFF, SCG0, and SCG1 mode-control bits in the status register is that the present operating mode is saved onto the stack during an interrupt service routine. Program flow returns to the previous operating mode if the saved SR value is not altered during the interrupt service routine. Control of Low-Power Modes : The CPUOFF, OSCOFF, SCG0, and SCG1 bits control the mode of operation of the MSP430MCU. All systems are fully operational when all bits are clear. Setting combinations of these bits puts the device into one of its low-power modes. SCG1 (System clock generator 1) : When set, turns off the SMCLK. SCG0 (System clock generator 0) : When set, turns off the DCO DC generator for DCO. if DCO-CLK is not used for MCLK or SMCLK. OSCOFF (Oscillator OFF ) : When set, turns off the VLO and LF XT1 crystal oscillator if LFXT1-CLK is not used for MCLK or SMCLK. CPUOFF : When set, turns off the MCLK, which stops the CPU. Operating Modes For Basic Clock System SCG1 SCG0 OSCOFF CPUOFF Mode CPU and Clocks Status Active CPU is active, all enabled clocks are active LPM LPM LPM LPM3 CPU & MCLK are disabled. SMCLK & ACLK are active CPU & MCLK are disabled. ACLK is active. DCO and DC generator are disabled if it is not used for SMCLK CPU, MCLK, SMCLK are disabled. DC generator remains enabled. ACLK is active. CPU, MCLK, SMCLK, DCO & DC generators are disabled. ACLK is active LPM4 CPU and all clocks disabled

21 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Active mode: CPU, all clocks, and enabled modules are active, I 300µA The MSP430 starts up in this mode, which must be used when the CPU is required to run code. An interrupt automatically switches the device to active mode. The current can be reduced by running the MSP430 at the lowest supply voltage consistent with the frequency of MCLK. If V CC = 1.8V at f DCO = 1MHz, I 200µA LPM-0: CPU and MCLK are disabled, SMCLK and ACLK remain active, I 85 µa This is used when the CPU is not required but some modules require a fast clock from SMCLK and the DCO. LPM-3: CPU, MCLK, SMCLK, and DCO are disabled; only ACLK remains active; I 1 µa. This is the standard low-power mode when the device must wake itself at regular intervals and therefore needs a (slow) clock. It is also required if the MSP430 must maintain a real-time clock. The current can be reduced to about 0.5_A by using the VLO instead of an external crystal in a MSP430F2xx if f ACLK need not be accurate. LPM-4: CPU and all clocks are disabled, I 0.1 µa. The device can be wakened only by an external signal. This is also called RAM retention mode. The MSP430x5xx has LPM5, in which the voltage regulator of the Power Management Module (PMM) is disabled. All RAM and register contents are lost, as well as, I/O configuration. Wake-up is possible via a power sequence or an RST/NMI event. On some devices, wake-up from I/O is also possible. The MSP430 typical current consumption in various modes is shown in Figure.

22 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT The following function puts the device into LPM3. The MSP430 can be awakened only by an interrupt so these must be enabled by setting the GIE bit in SR if it has not been done already. low_power_mode_3 (); // enter LPM3 with interrupts enabled The only clock that runs in LPM3 is ACLK. This means that the DCO must be started to provide MCLK before the ISR can be executed. The following function is used to exit the low power mode low_ power_mode_off_on_exit() // Restore Active Mode on return

23 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Watchdog Timer : 1. A watchdog timer is an electronic timer that is used to detect and recover from computer malfunctions. 2. The Watchdog Timer (WDT) module restarts the system on occurrence of a software problem (or) if a selected time interval expires. 3. During normal operation, the system regularly restarts the watchdog timer to prevent it from elapsing, or "timing out". If the system fails to restart the watchdog due to a hardware fault (or) program error, the timer will elapse and generate a timeout signal. 4. The timeout signal is used to initiate corrective actions like placing the system in a safe state and restoring normal system operation. 5. Microcontrollers often include an integrated, on-chip watchdog. The watchdog and CPU may share a common clock signal, as shown in above figure, or they may have independent clock signals. 6. Time intervals: Watchdog timers may have either fixed or programmable time intervals. Some watchdog timers allow the time interval to be programmed by selecting from among a few selectable, discrete values. In others, the interval can be programmed to arbitrary values. Typically, watchdog time intervals range from ten milliseconds to a minute or more. 7. Corrective actions : A watchdog timer may initiate any of several types of corrective actions, including processor reset, non-maskable interrupt, power cycling, fail-safe state activation, or combinations of these, depending on its architecture. In embedded systems and control systems, watchdog timers are often used to activate fail-safe circuitry, which forces all control outputs to safe states (e.g., turns off motors, heaters, and high-voltages) to prevent injuries and equipment damage while the fault persists. 8. Remember that the watchdog is active by default and must either be disabled or regularly cleared before it rolls over. If the watchdog function is not needed in an application, the module can be configured as an interval timer and can generate interrupts at selected time intervals.

24 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Features of the watchdog timer module include: Four software-selectable time intervals Watchdog mode Interval mode Access to WDT control register is password protected Control of RST/NMI pin function Selectable clock source Can be stopped to conserve power Clock fail-safe feature Watchdog Timer Operation The main purpose of the watchdog timer is to protect the system against failure of the software, such as the program becoming trapped in an unintended, infinite loop. Left to itself, the watchdog counts up and resets the MSP430 when it reaches its limit. The code must therefore keep clearing the counter before the limit is reached to prevent a reset. The watchdog is always active after the MSP430 has been reset. By default the clock is SMCLK, which is in turn derived from the DCO at about 1 MHz. The default period of the watchdog is the maximum value of 32,768 counts, which is therefore around 32 ms. The WDT is clocked from either SMCLK (default) or ACLK, according to the WDTSSEL bit. The reset output can be selected from bits 6, 9, 13, or 15 of the counter. Thus the period is 2 6 = 64, 512, 8192, or 32,768 (default) times the period of the clock. This is controlled by the WDTISx bits in WDTCTL. The intervals are roughly 2, 16, 250, and 1000 ms if the watchdog runs from ACLK at 32 KHz. The operation of the watchdog is controlled by the 16-bit password-protected register WDTCTL. Any read or write access must use word instructions and write accesses must include the write password 0x5A in the upper byte. Any write to WDTCTL with any value other than 0x5A in the upper byte is a security key violation and triggers a Reset regardless of timer mode. Any read of WDTCTL reads 0x69 in the upper byte. The lower byte of WDTCTL contains the bits that control the operation of the watchdog timer, shown in Figure 8.1.

25 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Bits 15-8 WDTPW Watchdog timer Password Always read as 0x69. Must be written as 0x5A, or Reset is generated Bit 7 WDTHOLD Watchdog timer Hold 1 Stops the watchdog timer 0 Watchdog timer is not stopped Bit 6 WDTNMIES Watchdog timer NMI edge select Selects the interrupt edge for the NMI 1 NMI on falling edge 0 NMI on rising edge Bit 5 WDTNMI Watchdog timer NMI select 1 NMI function 0 Reset function Bit 4 WDTTMSEL Watchdog timer Mode select 1 Interval timer mode 0 Watchdog mode Bit 3 WDTCNTCL Watchdog timer Counter clear 1 clears the count value to 0000H 0 No action Bit 2 WDTSSEL Watchdog timer clock source select 1 ACLK 0 SMCLK Bit 1 & Bit 0 WDTIS 1 & WDTIS 0 Watchdog Timer Interval Select 00 Watchdog clock source /32, Watchdog clock source /8, Watchdog clock source / Watchdog clock source /64

26 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT Example (5) : Program to light LED when button B1 is pressed using interrupt and Low-power mode 4 Let LED is connected at P2.3 (active Low circuit) Let Push button is connected at P2.1 with internal Pull-up resistor enabled P2.1 is to be configured to receive the interrupt from switch #include <msp430.h> // Specific device void main (void) { WDTCTL = WDTPW WDTHOLD; // Stop watchdog timer P2SEL = P2SEL & (~BIT3); P2DIR = P2DIR BIT3 ; // Select P2.3 as GPIO pins // Set P2.3 as output pin (LED1) P2SEL = P2SEL BIT1; // Select P2.1 as Interrupt pin P2IE = P2IE & ~BIT1 ; // Enable Interrupt P2.1 P2IES = P2IES BIT1; // Interrupt Edge Select Falling edge (1) P2OUT = P2OUT BIT3 ; // Preload LED1 off (active Low ) } do { P2IFG = 0; // Clear interrupt flags for P2 } while (P2IFG!=0) for ( ; ; ) // loop forever { low_power_mode_4(); // enter into low power mode 4 } #pragma vector = PORT2_VECTOR interrupt void PORT2_ISR (void) { P2OUT = P2OUT ^ BIT3; // Toggle LED P2IES = P2IES ^ BIT3; // Toggle edge sensitivity do { P2IFG = 0; // Clear any pending interrupts... } while (P2IFG!= 0); //... until none remain }

Lab 4 Interrupts ReadMeFirst

Lab 4 Interrupts ReadMeFirst Lab 4 Interrupts ReadMeFirst Lab Folder Content 1) ReadMeFirst 2) Interrupt Vector Table 3) Pin out Summary Objectives Understand how interrupts work Learn to program Interrupt Service Routines in C Language

More information

5xx Active & Low Power Mode Operation

5xx Active & Low Power Mode Operation 5xx Active & Low Power Mode Operation 38 Lab 2: ULP Operation Lab Goals Learn ULP Best Practices Learn & understand how to configure two key modules of the 5xx to achieve ultra-low power operation. Power

More information

Lecture 5: MSP430 Interrupt

Lecture 5: MSP430 Interrupt ECE342 Intro. to Embedded Systems Lecture 5: MSP430 Interrupt Ying Tang Electrical and Computer Engineering Rowan University 1 How A Computer React to Inputs? Polling: the processor regularly looks at

More information

Lab 4: Interrupt. CS4101 Introduction to Embedded Systems. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan

Lab 4: Interrupt. CS4101 Introduction to Embedded Systems. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan CS4101 Introduction to Embedded Systems Lab 4: Interrupt Prof. Chung-Ta King Department of Computer Science, Taiwan Introduction In this lab, we will learn interrupts of MSP430 Handling interrupts in MSP430

More information

Team 3. By: Miriel Garcia. Microcontrollers/ TI MSP430F5438A. ECE 480 senior Design. Application Note 4/3/15

Team 3. By: Miriel Garcia. Microcontrollers/ TI MSP430F5438A. ECE 480 senior Design. Application Note 4/3/15 Microcontrollers/ TI MSP430F5438A ECE 480 senior Design Team 3 Application Note By: Miriel Garcia 4/3/15 Abstract Microcontrollers are key components on today s modern world. These devices have the ability

More information

Lab 1: I/O, timers, interrupts on the ez430-rf2500

Lab 1: I/O, timers, interrupts on the ez430-rf2500 Lab 1: I/O, timers, interrupts on the ez430-rf2500 UC Berkeley - EE 290Q Thomas Watteyne January 25, 2010 1 The ez430-rf2500 and its Components 1.1 Crash Course on the MSP430f2274 The heart of this platform

More information

ECE2049: Embedded Computing in Engineering Design C Term Spring 2019 Lecture #22: MSP430F5529 Operating Mode & the WDT

ECE2049: Embedded Computing in Engineering Design C Term Spring 2019 Lecture #22: MSP430F5529 Operating Mode & the WDT ECE2049: Embedded Computing in Engineering Design C Term Spring 2019 Lecture #22: MSP430F5529 Operating Mode & the WDT Reading for Today: User's Guide 1.4, Ch 16 Reading for Next Class: Review all since

More information

6. General purpose Input/Output

6. General purpose Input/Output Chapter 6 6. General purpose Input/Output This chapter starts with a description of one of the simplest integrated peripherals of the MSP430 the General Purpose 8-bit Input Output (GPIO). The Input/Output

More information

Interrupts, Low Power Modes

Interrupts, Low Power Modes Interrupts, Low Power Modes Registers Status Register Interrupts (Chapter 6 in text) A computer has 2 basic ways to react to inputs: 1) polling: The processor regularly looks at the input and reacts as

More information

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I. University of Texas at El Paso Electrical and Computer Engineering Department EE 3176 Laboratory for Microprocessors I Fall 2016 LAB 03 Low Power Mode and Port Interrupts Goals: Bonus: Pre Lab Questions:

More information

MSP430. More on MSP430

MSP430. More on MSP430 MSP430 More on MSP430 CodeComposer TI recently launched Code Composer Essentials v3. This IDE s latest version (version 3) supports all available MSP430 devices. The new features of CCE v3 include: - Free

More information

Timers and Clocks CS4101 嵌入式系統概論. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan

Timers and Clocks CS4101 嵌入式系統概論. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan CS4101 嵌入式系統概論 Timers and Clocks Prof. Chung-Ta King Department of Computer Science, Taiwan Materials from MSP430 Microcontroller Basics, John H. Davies, Newnes, 2008 Recall the Container Thermometer Container

More information

2006 Mixed Signal Products SLAU049F

2006 Mixed Signal Products SLAU049F User s Guide 2006 Mixed Signal Products SLAU049F Related Documentation From Texas Instruments Preface About This Manual This manual discusses modules and peripherals of the MSP430x1xx family of devices.

More information

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #11: More Clocks and Timers

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #11: More Clocks and Timers ECE2049: Embedded Computing in Engineering Design C Term Spring 2018 Lecture #11: More Clocks and Timers Reading for Today: Davie's Ch 8.3-8.4, 8.9-8.10, User's Guide Ch. 17 Reading for Next Class: User's

More information

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction.

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction. AVR XMEGA TM Product Introduction 32-bit AVR UC3 AVR Flash Microcontrollers The highest performance AVR in the world 8/16-bit AVR XMEGA Peripheral Performance 8-bit megaavr The world s most successful

More information

CPE 325: Embedded Systems Laboratory Laboratory #7 Tutorial MSP430 Timers, Watchdog Timer, Timers A and B

CPE 325: Embedded Systems Laboratory Laboratory #7 Tutorial MSP430 Timers, Watchdog Timer, Timers A and B CPE 325: Embedded Systems Laboratory Laboratory #7 Tutorial MSP430 Timers, Watchdog Timer, Timers A and B Aleksandar Milenković Email: milenka@uah.edu Web: http://www.ece.uah.edu/~milenka Objective This

More information

What is an Interrupt?

What is an Interrupt? MSP430 Interrupts What is an Interrupt? Reaction to something in I/O (human, comm link) Usually asynchronous to processor activities interrupt handler or interrupt service routine (ISR) invoked to take

More information

Hacettepe University

Hacettepe University MSP430 Teaching Materials Week 5 FUNDAMENTALS OF INTERFACING AND TIMERS for MSP430 Hacettepe University Elements in Basic MCU Interface Power Source Feeds CPU and peripherals Clock Oscillators System synchronization

More information

Hacettepe University

Hacettepe University MSP430 Teaching Materials Week 5 FUNDAMENTALS OF INTERFACING AND TIMERS for MSP430 Hacettepe University Elements in Basic MCU Interface Power Source Feeds CPU and peripherals Clock Oscillators System synchronization

More information

Interrupts CS4101 嵌入式系統概論. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan

Interrupts CS4101 嵌入式系統概論. Prof. Chung-Ta King. Department of Computer Science National Tsing Hua University, Taiwan CS4101 嵌入式系統概論 Interrupts Prof. Chung-Ta King Department of Computer Science, Taiwan Materials from MSP430 Microcontroller Basics, John H. Davies, Newnes, 2008 Inside MSP430 (MSP430G2551) 1 Introduction

More information

CPE/EE 421 Microcomputers

CPE/EE 421 Microcomputers CPE/EE 421 Microcomputers Instructor: Dr Aleksandar Milenkovic Lecture Note S13 *Material used is in part developed by Dr. D. Raskovic and Dr. E. Jovanov CPE/EE 421/521 Microcomputers 1 MSP430 Documentation

More information

Wireless Sensor Networks (WSN)

Wireless Sensor Networks (WSN) Wireless Sensor Networks (WSN) Operating Systems M. Schölzel Operating System Tasks Traditional OS Controlling and protecting access to resources (memory, I/O, computing resources) managing their allocation

More information

CPE 323 Introduction to Embedded Computer Systems: MSP430 System Architecture An Overview

CPE 323 Introduction to Embedded Computer Systems: MSP430 System Architecture An Overview CPE 323 Introduction to Embedded Computer Systems: MSP430 System Architecture An Overview Aleksandar Milenkovic Electrical and Computer Engineering The University of Alabama in Huntsville milenka@ece.uah.edu

More information

The digital I/O is configured with user software. The setup and operation of the digital I/O is discussed in the following sections.

The digital I/O is configured with user software. The setup and operation of the digital I/O is discussed in the following sections. Digital I/O Introduction www.ti.com 8. Digital I/O Introduction MSP43 devices have up to eight digital I/O ports implemented, P to P8. Each port has up to eight I/O pins. Every I/O pin is individually

More information

MSP430 Interrupts. Change value of internal variable (count) Read a data value (sensor, receive) Write a data value (actuator, send)

MSP430 Interrupts. Change value of internal variable (count) Read a data value (sensor, receive) Write a data value (actuator, send) MSP430 Interrupts What is an Interrupt? Reaction to something in I/O (human, comm link) Usually asynchronous to processor activities interrupt handler or interrupt service routine (ISR) invoked to take

More information

063[[[0LFURFRQWUROOHUV /RZ3RZHU0RGHV &3($GYDQFHG0LFURFRPSXWHU7HFKQLTXHV 'U(PLO-RYDQRY /RZ3RZHU. Power: A First-Class Architectural Design Constraint

063[[[0LFURFRQWUROOHUV /RZ3RZHU0RGHV &3($GYDQFHG0LFURFRPSXWHU7HFKQLTXHV 'U(PLO-RYDQRY /RZ3RZHU. Power: A First-Class Architectural Design Constraint 063[[[0LFURFRQWUROOHUV /RZ3RZHU0RGHV &3($GYDQFHG0LFURFRPSXWHU7HFKQLTXHV 'U(PLO-RYDQRY MSP430 low power concepts 1 /RZ3RZHU Power: A First-Class Architectural Design Constraint Trevor Mudge, IEEE Computer,

More information

Network Embedded Systems Sensor Networks Fall Hardware. Marcus Chang,

Network Embedded Systems Sensor Networks Fall Hardware. Marcus Chang, Network Embedded Systems Sensor Networks Fall 2013 Hardware Marcus Chang, mchang@cs.jhu.edu 1 Embedded Systems Designed to do one or a few dedicated and/or specific functions Embedded as part of a complete

More information

Understanding the new '5xx Integrated Power Management Module (PMM) Stefan Schauer

Understanding the new '5xx Integrated Power Management Module (PMM) Stefan Schauer Understanding the new '5xx Integrated Power Management Module (PMM) Stefan Schauer 6/5/2008 1 Agenda Introduction into the PMM System Technical Data, specified Values Software controlled PMM configuration

More information

2.996/6.971 Biomedical Devices Design Laboratory Lecture 6: Microprocessors II

2.996/6.971 Biomedical Devices Design Laboratory Lecture 6: Microprocessors II 2.996/6.971 Biomedical Devices Design Laboratory Lecture 6: Microprocessors II Instructor: Dr. Hong Ma Oct. 1, 2007 Structure of MSP430 Program 1. Declarations 2. main() 1. Watch-dog timer servicing 2.

More information

2006 Mixed Signal Products SLAU144B

2006 Mixed Signal Products SLAU144B User s Guide 2006 Mixed Signal Products SLAU144B IMPORTANT NOTICE Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements,

More information

Hello, and welcome to this presentation of the STM32L4 power controller. The STM32L4 s power management functions and all power modes will also be

Hello, and welcome to this presentation of the STM32L4 power controller. The STM32L4 s power management functions and all power modes will also be Hello, and welcome to this presentation of the STM32L4 power controller. The STM32L4 s power management functions and all power modes will also be covered in this presentation. 1 Please note that this

More information

2006 Mixed Signal Products SLAU049F

2006 Mixed Signal Products SLAU049F User s Guide 2006 Mixed Signal Products SLAU049F IMPORTANT NOTICE Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements,

More information

Alex Milenkovich 1. CPE/EE 421 Microcomputers. Course Administration. Review: Outline. Getting Started with EasyWeb2. Review: MSP bit RISC

Alex Milenkovich 1. CPE/EE 421 Microcomputers. Course Administration. Review: Outline. Getting Started with EasyWeb2. Review: MSP bit RISC CPE/EE 421 Microcomputers Instructor: Dr Aleksandar Milenkovic Lecture Note S12 Course Administration Instructor: URL: TA: Labs: Test I: Text: Review: Today: Aleksandar Milenkovic milenka@ece.uah.edu www.ece.uah.edu/~milenka

More information

Block diagram of processor (Harvard)

Block diagram of processor (Harvard) Block diagram of processor (Harvard) Register transfer view of Harvard architecture Separate busses for instruction memory and data memory Example: PIC 16 load path OP REG AC 16 16 store path rd wr data

More information

Lecture test next week

Lecture test next week Lecture test next week Write a short program in Assembler doing. You will be given the print outs of all the assembler programs from the manual You can bring any notes you want Today: Announcements General

More information

CPE 323: MSP430 Timers

CPE 323: MSP430 Timers CPE 323: MSP430 Timers Aleksandar Milenkovic Electrical and Computer Engineering The University of Alabama in Huntsville milenka@ece.uah.edu http://www.ece.uah.edu/~milenka Outline Watchdog Timer TimerA

More information

IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -1 1 UNIT 1

IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -1 1 UNIT 1 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -1 1 UNIT 1 1. Embedded Systems Introduction (Definition, Applications and Classification) - 1 2. Elements of Embedded systems ----------------------------------------------------------

More information

Interconnects, Memory, GPIO

Interconnects, Memory, GPIO Interconnects, Memory, GPIO Dr. Francesco Conti f.conti@unibo.it Slide contributions adapted from STMicroelectronics and from Dr. Michele Magno, others Processor vs. MCU Pipeline Harvard architecture Separate

More information

Embedded Technosolutions

Embedded Technosolutions MSP430 Tutorial Very Important Low Power Processor For Embedded Systems Applications Introduction Although there are many resources dedicated to teaching microcontrollers and the MSP430 in particular,

More information

MSP430xxxx Microcontrollers Low Power Modes

MSP430xxxx Microcontrollers Low Power Modes MSP430xxxx Microcontrollers Low Power Modes Modes à basse consommation 1 Power is a priority architectural design constraint Why worry about power? Battery life in portable and mobile platforms Power consumption

More information

Alex Milenkovich 1. CPE/EE 421 Microcomputers: The MSP430 Introduction. Outline

Alex Milenkovich 1. CPE/EE 421 Microcomputers: The MSP430 Introduction. Outline Outline CPE/EE 421 Microcomputers: The MSP430 Introduction Instructor: Dr Aleksandar Milenkovic Lecture Notes MSP430: An Introduction The MSP430 family Technology Roadmap Typical Applications The MSP430

More information

Designing for Ultra-Low Power with MSP430

Designing for Ultra-Low Power with MSP430 Designing for Ultra-Low Power with MSP430 Christian Hernitscheck MSP430 FAE Europe Texas Instruments 2006 Texas Instruments Inc, Slide 1 Agenda Introduction to Ultra-Low Power Looking for Ultra-Low Power

More information

CPE/EE 421 Microcomputers

CPE/EE 421 Microcomputers CPE/EE 421 Microcomputers Instructor: Dr Aleksandar Milenkovic Lecture Note S11 MSP430 Documentation MSP430 home page (TI) www.ti.com/msp430 User s manual http://www.ece.uah.edu/~milenka/cpe421-05s/manuals/slau049c.pdf

More information

AVR XMEGA TM. A New Reference for 8/16-bit Microcontrollers. Ingar Fredriksen AVR Product Marketing Director

AVR XMEGA TM. A New Reference for 8/16-bit Microcontrollers. Ingar Fredriksen AVR Product Marketing Director AVR XMEGA TM A New Reference for 8/16-bit Microcontrollers Ingar Fredriksen AVR Product Marketing Director Kristian Saether AVR Product Marketing Manager Atmel AVR Success Through Innovation First Flash

More information

Application Report. 1 Hardware Description. John Fahrenbruch... MSP430 Applications

Application Report. 1 Hardware Description. John Fahrenbruch... MSP430 Applications Application Report SLAA309 June 2006 Low-Power Tilt Sensor Using the MSP430F2012 John Fahrenbruch... MSP430 Applications ABSTRACT The MSP430 family of low-power microcontrollers are ideal for low-power

More information

The 16-bit timer/counter register, TAR, increments or decrements (depending on mode of operation) with each rising edge of the clock signal.

The 16-bit timer/counter register, TAR, increments or decrements (depending on mode of operation) with each rising edge of the clock signal. Timer & Real Time Clock (RTC), PWM control, timing generation and measurements. Analog interfacing and data acquisition: ADC and Comparator in MSP430, data transfer using DMA. Case Study: MSP430 based

More information

Intro. MEB/ Texas Instruments Inc, Slide 1

Intro. MEB/ Texas Instruments Inc, Slide 1 Intro MEB/0404 2004 Texas Instruments Inc, Slide 1 MSP430 Agenda Core Architecture Integrated Peripherals Device Roadmap Ideal Applications Development Tools MEB/0404 2004 Texas Instruments Inc, Slide

More information

MICROPROCESSOR BASED SYSTEM DESIGN

MICROPROCESSOR BASED SYSTEM DESIGN MICROPROCESSOR BASED SYSTEM DESIGN Lecture 5 Xmega 128 B1: Architecture MUHAMMAD AMIR YOUSAF VON NEUMAN ARCHITECTURE CPU Memory Execution unit ALU Registers Both data and instructions at the same system

More information

// Conditions for 9600/4=2400 Baud SW UART, SMCLK = 1MHz #define Bitime_5 0x05*4 // ~ 0.5 bit length + small adjustment #define Bitime 13*4//0x0D

// Conditions for 9600/4=2400 Baud SW UART, SMCLK = 1MHz #define Bitime_5 0x05*4 // ~ 0.5 bit length + small adjustment #define Bitime 13*4//0x0D /****************************************************************************** * * * 1. Device starts up in LPM3 + blinking LED to indicate device is alive * + Upon first button press, device transitions

More information

Timer Module Timer A. ReadMeFirst

Timer Module Timer A. ReadMeFirst Timer Module Timer A ReadMeFirst Lab Folder Content 1) ReadMeFirst 2) TimerModule Lecture material 3) PinOutSummary 4) InterruptsVectorTable 5) Source code for screencast Interrupt Review Overview A Timer

More information

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I. University of Texas at El Paso Electrical and Computer Engineering Department EE 3176 Laboratory for Microprocessors I Fall 2016 LAB 04 Timer Interrupts Goals: Learn about Timer Interrupts. Learn how to

More information

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices, Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices, CISC and RISC processors etc. Knows the architecture and

More information

Microprocessors & Interfacing

Microprocessors & Interfacing Lecture Overview Microprocessors & Interfacing Interrupts (I) Lecturer : Dr. Annie Guo Introduction to Interrupts Interrupt system specifications Multiple sources of interrupts Interrupt priorities Interrupts

More information

Module Introduction. PURPOSE: The intent of this module is to explain MCU processing of reset and interrupt exception events.

Module Introduction. PURPOSE: The intent of this module is to explain MCU processing of reset and interrupt exception events. Module Introduction PURPOSE: The intent of this module is to explain MCU processing of reset and interrupt exception events. OBJECTIVES: - Describe the difference between resets and interrupts. - Identify

More information

Hacettepe University

Hacettepe University www.msp430.ubi.pt MSP430 Teaching Materials Introductory Overview Week2 Hacettepe University Outline Microcontrollers Versus Microprocessors Central Processing Unit System Buses Memory Organization I/O

More information

Copyright 2015 by Stephen A. Zajac & Gregory M. Wierzba. All rights reserved..spring 2015.

Copyright 2015 by Stephen A. Zajac & Gregory M. Wierzba. All rights reserved..spring 2015. Copyright 2015 by Stephen A. Zajac & Gregory M. Wierzba. All rights reserved..spring 2015. Copyright 2015 by Stephen A. Zajac & Gregory M. Wierzba. All rights reserved..spring 2015. Copyright 2015 by Stephen

More information

Chapter 1 MSP430 Microcontroller Family

Chapter 1 MSP430 Microcontroller Family Chapter 1 1-1 Introduction 1.1 Introduction The MSP430 is a 16-bit microcontroller that has a number of special features not commonly available with other microcontrollers: Complete system on-a-chip includes

More information

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1 M68HC08 Microcontroller The MC68HC908GP32 Babak Kia Adjunct Professor Boston University College of Engineering Email: bkia -at- bu.edu ENG SC757 - Advanced Microprocessor Design General Description The

More information

Getting Started With the Stellaris EK-LM4F120XL LaunchPad Workshop. Version 1.05

Getting Started With the Stellaris EK-LM4F120XL LaunchPad Workshop. Version 1.05 Getting Started With the Stellaris EK-LM4F120XL LaunchPad Workshop Version 1.05 Agenda Introduction to ARM Cortex Cortex -M4F M4F and Peripherals Code Composer Studio Introduction to StellarisWare, I iti

More information

Embedded Systems. 3. Hardware Software Interface. Lothar Thiele. Computer Engineering and Networks Laboratory

Embedded Systems. 3. Hardware Software Interface. Lothar Thiele. Computer Engineering and Networks Laboratory Embedded Systems 3. Hardware Software Interface Lothar Thiele Computer Engineering and Networks Laboratory Do you Remember? 3 2 3 3 High Level Physical View 3 4 High Level Physical View 3 5 What you will

More information

Arduino Uno R3 INTRODUCTION

Arduino Uno R3 INTRODUCTION Arduino Uno R3 INTRODUCTION Arduino is used for building different types of electronic circuits easily using of both a physical programmable circuit board usually microcontroller and piece of code running

More information

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1 Interrupts (I) Lecturer: Sri Notes by Annie Guo Week8 1 Lecture overview Introduction to Interrupts Interrupt system specifications Multiple Sources of Interrupts Interrupt Priorities Interrupts in AVR

More information

2002 Mixed Signal Products SLAU056B

2002 Mixed Signal Products SLAU056B User s Guide 22 Mixed Signal Products SLAU56B IMPORTANT NOTICE Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements,

More information

Today's plan: Announcements General Strategy Microcontroller programming concepts/last bits of assembly Activity 2

Today's plan: Announcements General Strategy Microcontroller programming concepts/last bits of assembly Activity 2 Today's plan: Announcements General Strategy Microcontroller programming concepts/last bits of assembly Activity 2 Intro to programming in C time permitting Lab 1&2 Marking scheme: Announcements: Turn

More information

ECE2049 E17 Lecture 4 MSP430 Architecture & Intro to Digital I/O

ECE2049 E17 Lecture 4 MSP430 Architecture & Intro to Digital I/O ECE2049-E17 Lecture 4 1 ECE2049 E17 Lecture 4 MSP430 Architecture & Intro to Digital I/O Administrivia Homework 1: Due today by 7pm o Either place in box in ECE office or give to me o Office hours tonight!

More information

Introduction to ARM LPC2148 Microcontroller

Introduction to ARM LPC2148 Microcontroller Introduction to ARM LPC2148 Microcontroller Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College Features of LPC2148 in a Nut Shell CPU = ARM 7 Core Word Length = 32 Bit ROM = 512 KB RAM

More information

CPE/EE 323 Introduction to Embedded Computer Systems Homework V

CPE/EE 323 Introduction to Embedded Computer Systems Homework V CPE/EE 323 Introduction to Embedded Computer Systems Homework V 1(15) 2(15) 3(25) 4(25) 5(20) Total Problem #1 (15 points) Power, Low power systems A sensor platform features a microcontroller, a sensor,

More information

Basic System Memory Architecture View (Functional)

Basic System Memory Architecture View (Functional) Memory Organization Basic System Memory Architecture View (Functional) Notation: [FFFE]=27h FFFE: 27 Basic Characteristics (1/3) Memory cell registers are one byte wide Memory Word is the contents of the

More information

Clock and Fuses. Prof. Prabhat Ranjan Dhirubhai Ambani Institute of Information and Communication Technology, Gandhinagar

Clock and Fuses. Prof. Prabhat Ranjan Dhirubhai Ambani Institute of Information and Communication Technology, Gandhinagar Clock and Fuses Prof. Prabhat Ranjan Dhirubhai Ambani Institute of Information and Communication Technology, Gandhinagar Reference WHY YOU NEED A CLOCK SOURCE - COLIN O FLYNN avrfreaks.net http://en.wikibooks.org/wiki/atmel_avr

More information

Texas Instruments Mixed Signal Processor Tutorial Abstract

Texas Instruments Mixed Signal Processor Tutorial Abstract Texas Instruments Mixed Signal Processor Tutorial Abstract This tutorial goes through the process of writing a program that uses buttons to manipulate LEDs. One LED will be hard connected to the output

More information

ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives:

ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives: ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives: This lab will introduce basic embedded systems programming concepts by familiarizing the user with an embedded programming

More information

AM18X5. 1. Introduction. 2. System Power Control Applications. Application Note. AM18X5 Family System Power Management

AM18X5. 1. Introduction. 2. System Power Control Applications. Application Note. AM18X5 Family System Power Management Application Note Family System Power Management 1. Introduction In addition to fundamentally low power RTC operation, the Ambiq includes the capability to effectively manage the power of other devices

More information

Lecture (02) PIC16F84 (I)

Lecture (02) PIC16F84 (I) Lecture (02) PIC16F84 (I) By: Dr. Ahmed ElShafee ١ Review of Memory Technologies The PIC 16 Series PIC 16F84A The PIC 16F84A Memory The Oscillator Instruction Cycle Power up and Reset Parallel ports Technical

More information

Interfacing CMA3000-D01 to an MSP430 ultra low-power microcontroller

Interfacing CMA3000-D01 to an MSP430 ultra low-power microcontroller Interfacing CMA3000-D01 to an MSP430 ultra low-power microcontroller 1 INTRODUCTION The objective of this document is to show how to set up SPI/I2C communication between VTI Technologies CMA3000-D01 digital

More information

ARDUINO MEGA INTRODUCTION

ARDUINO MEGA INTRODUCTION ARDUINO MEGA INTRODUCTION The Arduino MEGA 2560 is designed for projects that require more I/O llines, more sketch memory and more RAM. With 54 digital I/O pins, 16 analog inputs so it is suitable for

More information

MSP430x43x1, MSP430x43x, MSP430x44x1, MSP430x44x MIXED SIGNAL MICROCONTROLLER

MSP430x43x1, MSP430x43x, MSP430x44x1, MSP430x44x MIXED SIGNAL MICROCONTROLLER Low Supply-Voltage Range,.8 V to 3.6 V Ultralow-Power Consumption: Active Mode: 28 µa at MHz, 2.2 V Standby Mode:. µa Off Mode (RAM Retention):. µa Five Power Saving Modes Wake-Up From Standby Mode in

More information

Hello, and welcome to this presentation of the STM32 Reset and Clock Controller.

Hello, and welcome to this presentation of the STM32 Reset and Clock Controller. Hello, and welcome to this presentation of the STM32 Reset and Clock Controller. 1 The RCC controller integrated inside STM32 products manages system and peripheral clocks. STM32F7 devices embed two internal

More information

Micro computer Organization

Micro computer Organization Micro computer Organization I Base Basic Components CPU SYSTEM BUSES VDD CLK RESET 1 MPU vs MCU Microprocessor Unit (MPU) CPU (called Microprocessor) is a die All components external to die Basically on

More information

Interrupt Driven Programming in MSP430 Assembly (ESCAPE) *

Interrupt Driven Programming in MSP430 Assembly (ESCAPE) * OpenStax-CNX module: m45965 1 Interrupt Driven Programming in MSP430 Assembly (ESCAPE) * Matthew Johnson Based on Interrupt Driven Programming in MSP430 Assembly by Matthew Johnson This work is produced

More information

ERRATA SHEET INTEGRATED CIRCUITS. Date: 2008 June 2 Document Release: Version 1.6 Device Affected: LPC2468. NXP Semiconductors

ERRATA SHEET INTEGRATED CIRCUITS. Date: 2008 June 2 Document Release: Version 1.6 Device Affected: LPC2468. NXP Semiconductors INTEGRATED CIRCUITS ERRATA SHEET Date: 2008 June 2 Document Release: Version 1.6 Device Affected: LPC2468 This errata sheet describes both the known functional problems and any deviations from the electrical

More information

Chapter 26 Topic Page 26.1 ADC12 Introduction

Chapter 26 Topic Page 26.1 ADC12 Introduction Chapter 26 The module is a high-performance 12-bit analog-to-digital converter (ADC). This chapter describes the. The is implemented in the MSP430x43x MSP430x44x, MSP430FG461x devices. Topic Page 26.1

More information

Introduction to Embedded Systems

Introduction to Embedded Systems Stefan Kowalewski, 4. November 25 Introduction to Embedded Systems Part 2: Microcontrollers. Basics 2. Structure/elements 3. Digital I/O 4. Interrupts 5. Timers/Counters Introduction to Embedded Systems

More information

Embedded Systems and Software

Embedded Systems and Software Embedded Systems and Software Lecture 12 Some Hardware Considerations Hardware Considerations Slide 1 Logic States Digital signals may be in one of three states State 1: High, or 1. Using positive logic

More information

Engineer-to-Engineer Note

Engineer-to-Engineer Note Engineer-to-Engineer Note EE-388 Technical notes on using Analog Devices products and development tools Visit our Web resources http://www.analog.com/ee-notes and http://www.analog.com/processors or e-mail

More information

Course Introduction. Purpose: Objectives: Content: 27 pages 4 questions. Learning Time: 20 minutes

Course Introduction. Purpose: Objectives: Content: 27 pages 4 questions. Learning Time: 20 minutes Course Introduction Purpose: This course provides an overview of the Direct Memory Access Controller and the Interrupt Controller on the SH-2 and SH-2A families of 32-bit RISC microcontrollers, which are

More information

Infineon C167CR microcontroller, 256 kb external. RAM and 256 kb external (Flash) EEPROM. - Small single-board computer (SBC) with an

Infineon C167CR microcontroller, 256 kb external. RAM and 256 kb external (Flash) EEPROM. - Small single-board computer (SBC) with an Microcontroller Basics MP2-1 week lecture topics 2 Microcontroller basics - Clock generation, PLL - Address space, addressing modes - Central Processing Unit (CPU) - General Purpose Input/Output (GPIO)

More information

Distributed by: www.jameco.com 1-800-831-4242 The content and copyrights of the attached material are the property of its owner. MSP430F11x2/12x2 Device Erratasheet Current Version Devices MSP430F1122

More information

MSP430FG4618 Programming Reference Revision 3

MSP430FG4618 Programming Reference Revision 3 MSP430FG4618/F2013 Experimenter Board MSP430FG4618 Programming Reference Revision 3 George Mason University 1. CPU Registers The CPU incorporates sixteen 20-bit registers. R0, R1, R2 and R3 have dedicated

More information

Programming With the MSP430AFE2xx Family and the MSP430i20xx Family

Programming With the MSP430AFE2xx Family and the MSP430i20xx Family Application Report Programming With the MSP430AFE2xx Family and the MSP430i20xx Family Tyler Witt... MSP430 Applications ABSTRACT This application report enables the easy incorporation of the MSP430AFE2xx

More information

Section 8. Reset HIGHLIGHTS. Reset. This section of the manual contains the following major topics:

Section 8. Reset HIGHLIGHTS. Reset. This section of the manual contains the following major topics: Section 8. HIGHLIGHTS This section of the manual contains the following major topics: 8.1 Introduction... 8-2 8.2 Control Registers...8-3 8.3 System...8-6 8.4 Using the RCON Status Bits... 8-11 8.5 Device

More information

ECE PRACTICE EXAM #2 Clocks, Timers, and Digital I/O

ECE PRACTICE EXAM #2 Clocks, Timers, and Digital I/O ECE2049 -- PRACTICE EXAM #2 Clocks, Timers, and Digital I/O Study HW3, Class Notes, Davies Ch 2.6, 5.8, 8, 9.2-3, 9.7, MSP43F5529 User's Guide Ch 5, 17, 28 Work all problems with your note sheet first

More information

CENG-336 Introduction to Embedded Systems Development. Timers

CENG-336 Introduction to Embedded Systems Development. Timers CENG-336 Introduction to Embedded Systems Development Timers Definitions A counter counts (possibly asynchronous) input pulses from an external signal A timer counts pulses of a fixed, known frequency

More information

Let s first take a look at power consumption and its relationship to voltage and frequency. The equation for power consumption of the MCU as it

Let s first take a look at power consumption and its relationship to voltage and frequency. The equation for power consumption of the MCU as it 1 The C8051F91x/0x product family is designed to dramatically increase battery lifetime which is the number one requirement for most battery powered applications. The C8051F91x has the industry s lowest

More information

APPLICATION NOTE 655 Supervisor ICs Monitor Battery-Powered Equipment

APPLICATION NOTE 655 Supervisor ICs Monitor Battery-Powered Equipment Maxim > Design Support > Technical Documents > Application Notes > Automotive > APP 655 Maxim > Design Support > Technical Documents > Application Notes > Microprocessor Supervisor Circuits > APP 655 Keywords:

More information

Section 10. Power-Saving Features

Section 10. Power-Saving Features Section 10. Power-Saving Features HIGHLIGHTS This section of the manual contains the following major topics: 10.1 Introduction... 10-2 10.2 Microcontroller Clock Manipulation... 10-2 10.3 Instruction-Based

More information

ECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class)

ECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class) ECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class) Your homework should be neat and professional looking. You will loose points if your HW is not properly

More information

_ V Intel 8085 Family In-Circuit Emulation. Contents. Technical Notes

_ V Intel 8085 Family In-Circuit Emulation. Contents. Technical Notes _ V9.12. 225 Technical Notes Intel 8085 Family In-Circuit Emulation This document is intended to be used together with the CPU reference manual provided by the silicon vendor. This document assumes knowledge

More information

XMEGA Series Of AVR Processor. Presented by: Manisha Biyani ( ) Shashank Bolia (

XMEGA Series Of AVR Processor. Presented by: Manisha Biyani ( ) Shashank Bolia ( XMEGA Series Of AVR Processor Presented by: Manisha Biyani (200601217) Shashank Bolia (200601200 Existing Microcontrollers Problems with 8/16 bit microcontrollers: Old and inefficient architecture. Most

More information

WHICH MICRO? What does MCU needs to do in my system? What are the tasks? Dr. Adriana Becker-Gomez

WHICH MICRO? What does MCU needs to do in my system? What are the tasks? Dr. Adriana Becker-Gomez 1 WHICH MICRO? What does MCU needs to do in my system? What are the tasks? Dr. Adriana Becker-Gomez Email: axbeec@rit.edu Office: 9-3477 2 Specs System design: High level definition (functional specs)

More information

8. Power Management and Sleep Modes

8. Power Management and Sleep Modes 8. Power Management and Sleep Modes 8.1 Features Power management for adjusting power consumption and functions Five sleep modes Idle Power down Power save Standby Extended standby Power reduction register

More information