+ All Categories
Home > Documents > Design Document fw.pdf

Design Document fw.pdf

Date post: 06-Jul-2018
Category:
Upload: piyushpandey
View: 228 times
Download: 0 times
Share this document with a friend

of 13

Transcript
  • 8/17/2019 Design Document fw.pdf

    1/13

    Distribution is subject to copyright.

    Design DocumentVersion 1.0

    DDC Firmware

    Author: ANUPA

  • 8/17/2019 Design Document fw.pdf

    2/13

    2

    Disclaimers!he in"ormation containe# in this #ocument is the proprietary an# e$c%usi&e property o" A%%green'cotech e$cept as otherwise in#icate#. No part o" this #ocument( in who%e or in part( may berepro#uce#( store#( transmitte#( or use# "or #esign purposes without the prior written permissiono" A%%green 'cotech.

    !he in"ormation containe# in this #ocument is subject to change without notice.

    !he in"ormation in this #ocument is pro&i#e# "or in"ormationa% purposes on%y. A%%green 'cotechspeci"ica%%y #isc%aims a%% warranties( e$press or %imite#( inc%u#ing( but not %imite#( to the imp%ie#warranties o" merchantabi%ity an# "itness "or a particu%ar purpose( e$cept as pro&i#e# "or in aseparate so"tware %icense agreement.

    Privacy Information!his #ocument may contain in"ormation o" a sensiti&e nature. !his in"ormation shou%# not be gi&ento persons other than those who are in&o%&e# in the BMS project or who wi%% become in&o%&e##uring the %i"ecyc%e.

    Version History

    REVISION CHART Version Aut or!s" Descri#tion of Version Date

    Com#lete$

  • 8/17/2019 Design Document fw.pdf

    3/13

    3

    Contents

    Contents.................................................................................................................................................. 3

    1. Introduction ............................... ................... ............................... ................... ......................... 4

    1.1. Document Overview ....................... ......................... ............................ ................... .............. 4

    1.2. Scope ....................... ................... ............................... ................... ............................ ........... 4

    2. LCD Module ............................... ................... ............................ ................... ............................ 4

    2.1. Back round In!ormation ....................... ........................... ........................ .......................... ... 4

    2.2. S"stem #volution Description .................... ............................ ...................... ......................... $

    2.3. Lcd%drv.C ............................... ................... ............................... ................... ......................... $

    2.4. Sendin data&command in 4'(it Mode ................. ............................ ................... ................. )

    2.$. Inter!ace .......................... ...................... ............................ .................... ........................... ... *

    2.). +low c,art LCD initiali-ation ...................... ............................ ................... ............................

    2.*. Lcd%app.c ............................... ................... ............................... ................... .........................

    3. Marti/ 0e"pad Module 4/4 ......................... ............................ ................... .......................... 1

    3.1. Scannin a Matri/ 0e"pad ......................... ............................ ................... .......................... 1

    3.2. +low c,art Matri/ 0e"pad ..................... ........................... ........................ .......................... . 11

    3.3. S"stem #volution Description .................... ............................ ...................... ....................... 12

    3.4. Inter!ace .......................... ...................... ............................ .................... ........................... . 12

    4. Lo ic !low !or t,e ctuator and 5eturn air ...................... .............................. .................... ...... 13

  • 8/17/2019 Design Document fw.pdf

    4/13

    1. Introduction

    6rovide a (rie! introduction t!irmware and t,e concept o!

    1.1. Document Overv

    • Description o! LCD m• Description o! 0e"pad• Description o! Con!i u• Description o! 7inter

    1.2. Scope

    9,is document is entirel" !ordesi ned onl" !or BMS pro:ec

    2. LCD Module

    9,is section will ive an idea

    ,ardware.

    2.1. Background Infor

    9o desi n t,is module a develpin description o! t,e LCD.7e will use t,e LCD in 4(it mto control t,e LCD.

    t,e !irmware developer a(out t,e di!!eren,at module.

    ew

    dule

    module

    ration !ile module

    lo ic !or t,e ctuator 8 alve operation

    t,e !irmware development o! t,e BMS pro:et.

    a(out t,e inter!ace o! 2 /4 LCD wit, our 5C

    mation

    oper s,ould ,ave t,e knowled e o! LCD dat

    ode to save t,e I&6 line o! t,e controller. 9ot

    4

    t module o! t,e BMS

    ct. ll concepts are

    M)*1 (ased

    and command. lso

    al ;6IO will (e used

  • 8/17/2019 Design Document fw.pdf

    5/13

    $

    2.2. Sy tem !volution De cription

    D"namic

  • 8/17/2019 Design Document fw.pdf

    6/13

    )

    • void % l!eEna&le%in ()+---------------------------------------+| Prototype: void PulseEnablePin ()

    | Return Type: void| Arguments: None

    | Description @This function toggles the Enable pin. After a command or adata is written, this function should be called.

    +---------------------------------------+

    • void LCD_Init();+---------------------------------------+| Prototype: void LCD_Init();

    | Return Type: void| Arguments: None

    | Description @Initialize the LCD module for the lcd operation.

    +---------------------------------------+

    • void 'o_Location_ _ ( n!i"ned c ar loc_ * n!i"ned c ar loc_ )+---------------------------------------+| Prototype: void Go_Location_X_Y(unsigned char loc_X,unsigned char loc_Y)

    | Return Type: void| Arguments: X & Y locations .Where X can be within 1 to 4 and Y can

    be within 1 to 20.

    | Description @This function takes the cursor on LCD at the X,Y locations passed. Different checks are used so that user does not enter invalid

    locations . +---------------------------------------+

    2.$. Sending data%command in $&'it Mode

    7e will now look into t,e common steps to send data&command to LCD w,en workinin 4'(it mode. s i alread" e/plained in 4'(it mode data is sent ni((le (" ni((le? !irst wesend ,i ,er ni((le and t,en lower ni((le. 9,is means in (ot, command and datasendin !unction we need to separate t,e ,i ,er 4'(its and lower 4'(its.

    9,e common steps are@

    Mask lower 4'(itsSend to t,e LCD port

  • 8/17/2019 Design Document fw.pdf

    7/13

    *

    Send ena(le si nalMask ,i ,er 4'(its

    Send to LCD portSend ena(le si nal

    7e are done wit, t,e t,eor" part now? In t,e ne/t section we will take a look at t,epro rammin microcontroller to control LCD in 4'(it mode.

    2.(. Interface

    sin le !unction will (e used !or t,e entire application. 9,is api will ,andle t,e userinter!ace. Onl" t,e strin and location s,ould (e passed.

    • void +rite_!trin"_to_lcd ( n!i"ned c ar x * n!i"ned c ar , * n!i"ned c ar- !tr * intlen )+---------------------------------------+| Prototype: void Go_Location_X_Y(unsigned char loc_X,unsigned char loc_Y)| Return Type: void| Arguments: Locations (X & Y), where X can be within 1 to 4 and Y can bewithin 1 to 20.String to be displayed. Length of the string.

    | Description @This function displays a string passed at the location X & Y.This function makes use of Go_Location_X_Y() function.

    +---------------------------------------+

  • 8/17/2019 Design Document fw.pdf

    8/13

    2.). *low c+art LCD initiali,ation

    2.-. Lcd#app.c

    9,is is an application (ased !ile and contains all t,e !unctions needed !or our application. 9,edi!!erent parameters to (e displa"ed on t,e LCD are cate ori-ed in 6a es. 6a e re!ers to t,edata on t,e 2 /4 LCD t,at ets displa"ed at a time.

    6arameter 6a e noCompan"As pro!ile Date'9ime

    1

    nalo Inputs 1?2?3?4 2

  • 8/17/2019 Design Document fw.pdf

    9/13

    nalo Inputs $?)?*? 3Di ital Input Di ital

    Output

    4

    Socket 6ort Status $+irmware >um(er SDcard Status

    )

    nalo Output 1?2?3?4 *

  • 8/17/2019 Design Document fw.pdf

    10/13

    1

    ". Marti /eypad Module 0$ $

    0e"pads are a part o! MI or uman Mac,ine Inter!ace and pla" reall" important role in asmall em(edded s"stem w,ere ,uman interaction or ,uman input is needed. Marti/ ke"padsare well known !or t,eir simple arc,itecture and ease o! inter!acin wit, an" microcontroller.

    ".1. Scanning a Matri /eypad

    ere are man" met,ods dependin on ,ow "ou connect "our ke"pad wit, "our controller? (ut

    t,e (asic lo ic is same. 7e make t,e columns as i&p and we drive t,e rows makin t,em o&p?t,is w,ole procedure o! readin t,e ke"(oard is called scannin .

    In order to detect w,ic, ke" is pressed !rom t,e matri/? we make row lines low one (" one andread t,e columns. LetAs sa" we !irst make 5ow1 low? t,en read t,e columns. I! an" o! t,e ke" inrow1 is pressed will make t,e correspondin column as low i.e. i! second ke" is pressed in5ow1? t,en column2 will ive low. So we come to know t,at ke" 2 o! 5ow1 is pressed. 9,is is,ow scannin is done.

    So to scan t,e ke"pad completel"? we need to make rows low one (" one and read t,ecolumns. I! an" o! t,e (uttons is pressed in a row? it will take t,e correspondin column to alow state w,ic, tells us t,at a ke" is pressed in t,at row. I! (utton 1 o! a row is pressed t,enColumn 1 will (ecome low? i! (utton 2 t,en column2 and so on...

    9,e state mac,ine is initiali-ed to start wit, !ast scan w,ic, outputs -eroes to all rowsand detects all ke"s at t,e same time. 7,en a ke" is pressed? a low level is applied tot,e correspondin column and causes a 6IO interrupt to detect t,e !irst ed e. Once an" ke" isdetected? de(ouncin is started. 9,e attempt to press a ke" on a p,"sical ke"pad and ,ave t,is

  • 8/17/2019 Design Document fw.pdf

    11/13

    11

    activit" detected can !ail as a result o! several noise sources? litc,es? spikes? etc.? to mentionsome o! t,e possi(le causes o! de(ounce pro(lems. 9,e timer is used to eliminate all noise o!

    less t,an a !ew milliseconds. >ormall" t,is is dependent on t,e mec,anical c,aracteristics o!t,e ke"s. 2 ms pro ramma(le de(ouncin time is !ine !or t,is.

    !ter de(ouncin is completed? a detailed scan is e/ecuted. second !ast scan is done to assuret,at an" detection made durin t,e !irst !ast scan sta e was not :ust noise.

    5e!er to +i ure (elow. 9,en? rows are con!i ured as inputs. 7,en a ke" is pressed a ,i , levelis applied in t,e correspondin row. .

    ".2. *low c+art Matri /eypad

  • 8/17/2019 Design Document fw.pdf

    12/13

    12

    ".". Sy tem !volution De cription

    9,ere will (e sin le c !ile !or t,is ke"pad module .i.e. ke"pad%drv.cll t,e port de!inition will (e on t,is sin le !ile. 9,ere will (e two simple !unctions !or t,e ke"

    module.• void e,_init(void);

    +---------------------------------------+| Prototype: void key_init(void); || Return Type: void || Arguments: None || Description: Initialize ports and || Keypad. make Rows as o/p

    and cols are i/p |+---------------------------------------+

    • n!i"ned c ar "et_ e,(void);/*+-----------------------------------------------+| Prototype: unsigned char get_key(void); || Return Type: unsigned char || Arguments: None || Description: To read key from the keypad, |+-----------------------------------------------+*/

    9,is !unction will return t,e ke" value.

    ".$. Interface

    On application part we will use t,e !unction? et%ke" E Scannin o! ke" will (e per!ormed usina separate task .

  • 8/17/2019 Design Document fw.pdf

    13/13

    $. Logic flow for t+e tuator and 3eturn air

    13


Recommended