assig final (1)

Upload: nagaraju-chowdary

Post on 14-Apr-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Assig Final (1)

    1/17

    EMBEDDED SYSTEM DESIGN

    SOFTWARE FOR SIX CHANNEL CONTROLLERBASED ON CLOCK TIME

    By

    N.Nagaraju(CDS12M004)

    Rahul sinha(CDS12M006)

  • 7/30/2019 Assig Final (1)

    2/17

    OBJECTIVE:

    Develop software for a 6 channel controller which can be individuallyswitched on and off based on clock time. Two channels can be sequenced

    together.

  • 7/30/2019 Assig Final (1)

    3/17

    SIX CHANNEL CONTROLLER

    Fansis FC-525 6-Channel Multi Fan Controller Reeven Six Eyes RFC-01 6 Channel Fan Controller

  • 7/30/2019 Assig Final (1)

    4/17

    SOFTWARE REQUIREMENTS

    1.CLOCK

    2.SIX CHANNEL CONTROLLER

    3.INTERRUPTS

  • 7/30/2019 Assig Final (1)

    5/17

    Theoretically, One Clock Is Enough

    A clock is a square wave signal whose edges trigger hardware

    A clock may be generated by various sources of pulses, e.g. crystal

    But, systems have conflicting requirements

    Low power, fast start/stop, accurate

  • 7/30/2019 Assig Final (1)

    6/17

    Different Requirements for Clocks

    Different clock sources also have differentcharacteristics

    Crystal: accurate and stable (w.r.t. temperature or

    time); expensive, delicate, drawing large current,external component, slow to start up or stabilize

    Resistor and capacitor (RC): cheap, quick to start,integrated within MCU and sleep with CPU; poor

    accuracy and stability Ceramic resonator and MEMS clocks in between

    Need multiple clocks

  • 7/30/2019 Assig Final (1)

    7/17

    Clocks in MSP430

    MSP430 addresses the conflicting demandsfor high performance, low power, precisefrequency by using 3 internal clocks, whichcan be derived from up to 4 sources Master clock (MCLK): for CPU & some peripherals,

    normally driven by digitally controlled oscillator(DCO) in megahertz range

    Subsystem master clock (SMCLK): distributed toperipherals, normally driven by DCO

    Auxiliary clock (ACLK): distributed to peripherals,normally for real-time clocking, driven by a low-frequency crystal oscillator, typically at 32 KHz

  • 7/30/2019 Assig Final (1)

    8/17

    Clock Sources in MSP430

    Low- or high-frequency crystal oscillator, LFXT1:

    External; used with a low- or high frequency crystal; anexternal clock signal can also be used; connected toMSP430 through XIN and XOUT pins

    High-frequency crystal oscillator, XT2:

    External; similar to LFXT1 but at high frequencies

    Very low-power, low-frequency oscillator, VLO:

    Internal at 12 KHz; alternative to LFXT1 when accuracy of acrystal is not needed; may not available in all devices

    Digitally controlled oscillator, DCO:

    Internal; a highly controllable RC oscillator that starts fast

  • 7/30/2019 Assig Final (1)

    9/17

    Clock Sources in MSP430

    Low- or high-frequency crystal oscillator, LFXT1:

    External; used with a low- or high frequency crystal; anexternal clock signal can also be used; connected toMSP430 through XIN and XOUT pins

    High-frequency crystal oscillator, XT2:

    External; similar to LFXT1 but at high frequencies

    Very low-power, low-frequency oscillator, VLO:

    Internal at 12 KHz; alternative to LFXT1 when accuracy of acrystal is not needed; may not available in all devices

    Digitally controlled oscillator, DCO:

    Internal; a highly controllable RC oscillator that starts fast

  • 7/30/2019 Assig Final (1)

    10/17

    From Sources to Clocks

    Typical sources of clocks: MCLK, SMCLK: DCO (typically at 1.1 MHz)

    ACLK: LFXT 1 (typically at 32 KHz)

  • 7/30/2019 Assig Final (1)

    11/17

    INTERRUPTS

    Reaction to something in I/O (human, comm link)

    Usually asynchronous to processor activities

    interrupt handler or interrupt service routine (ISR)

    invoked to take care of condition causing interrupt Change value of internal variable (count)

    Read a data value (sensor, receive)

    Write a data value (actuator, send)

  • 7/30/2019 Assig Final (1)

    12/17

    Relay 1

    Msp

    430

    Power

    Relay 2

    Relay3

    Relay4

    Relay5

    Relay6

    Device1

    Device 2

    Device3

    Device 4

    Device 5

    Device 6

  • 7/30/2019 Assig Final (1)

    13/17

    Start

    Set the Timer based on

    real time(in built timer)

    After 5 minutes First channel

    is set for output p2.1

    After 10 minutes First channel is

    set for output p2.2

    After 15 minutes First channel is

    set for output p2.3

    After 20 minutes First channel is

    set for output p2.4

    After 25 minutes First channel is setfor output p2.5

    After 30 minutes First channel is set

    for output p2.6

    Close

  • 7/30/2019 Assig Final (1)

    14/17

    #include

    #include

    #include /***** Function To Initialize Ports*****/

    int n=0;

    void init_ports()

    {

    DDRB = 0xFF;

    PORTB = 0x00;

    }

    /***** Function To Initialize Interrupts*****/

    void init_interrupts(){

    cli(); //Disable Global Interrupts

    GICR =(1

  • 7/30/2019 Assig Final (1)

    15/17

    if(n==1)

    {

    PORTB = 0x03;

    n++;

    _delay_ms(100);

    }

    else

    if(n==2)

    {

    PORTB = 0x05;

    n++;_delay_ms(100);

    }

    else

    if(n==3)

    {

    PORTB = 0x00;

    n=0;

    _delay_ms(100);

    }

    _delay_ms(100);

    }

  • 7/30/2019 Assig Final (1)

    16/17

    /***** Main Function *****

    int main(void)

    {

    init_ports();

    while(1)

    {

    init_interrupts();

    }

    }

  • 7/30/2019 Assig Final (1)

    17/17

    THANK YOU