#include"/>

alarm - #include "msp430x44x.h" msp430F449 #include...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 #include "msp430x44x.h" // Definitions, constants, etc for msp430F449 #include <string.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <in430.h> // ***************************************** FUNCTION DECLARATIONS ************************************************** void init_sys(void) void setupKeypad(void) void getKeys(void) void swDelay(unsigned int max_cnt) void clearLCD(void) void initLCD(void) void writeLetter(int position,char letter) void writeWord(const char *word) // also display numbers passed as text void buzzerOn(void) void buzzerOff(void) void alarmOn(void) void waitGetKeys(void) void configBTNS(void) int getBTN() void runtimerb(void) /************************************************************************/ /* */ /* Global variable declarations */ /* */ /************************************************************************/ char *LCD = LCDMEM unsigned char hitKey=0, btn=0 unsigned int timer = 0 unsigned char al=0, t=1, dr=0, dd=1, w=0 /************************************************************************/ /* */ /* main() variable declarations */ /* */ /************************************************************************/ //******************************************** LCD CONSTANTS ******************************************************** // From Muneem Shahriar's LCD driver code from Olimex.com #define a (0x80) // definitions for LCD seegments on the Olimex LCD. 4-Mux operation is assumed #define b (0x40) // For more details on 4-Mux operation, gather your LCD datasheet,
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 #define c (0x20) // TI's MSP430F449 User Guide (look for LCD Controller, then 4-Mux), #define d (0x01) // and MSP-449STK-2 schematic. You will need ALL these 3 when defining #define e (0x02) // each number or character. Remember, the Olimex LCD doesn't use a LCD driver! #define f (0x08) // You tell the LCD what characters to display. It's very time consuming!! #define g (0x04) #define h (0x10) /********************* MAIN FUNCTION *********************/ unsigned char pressedKey=0, pressedBtn=0, pitch=0x0f unsigned char pinArray[4] void main(void) { unsigned int cnt=0, wrg=0 timer=0 al=0 dr=0 dd=1 t=1 w=0 pitch = 0x0f pinArray[0]= 0x31 pinArray[1]= 0x32 pinArray[2]= 0x33 pinArray[3]= 0x34 WDTCTL = WDTPW + WDTHOLD init_sys() _BIS_SR(GIE) clearLCD() writeWord("WELCOME") waitGetKeys() if(pressedKey=='#') { al=1 t=1 clearLCD() writeWord("SYS. ON") runtimerb() while (timer < 10) { waitGetKeys() if ((pressedBtn == 2) || (pressedBtn == 3)) { w=1 } } waitGetKeys()
Background image of page 2
Sheet1 Page 3 timer=0 if ((pressedBtn == 1) || (pressedBtn == 4)) { clearLCD() writeWord("DOOR") swDelay(1) clearLCD() dr=1 dd=1 runtimerb() while (timer < 10) { { waitGetKeys() pitch=0x0f buzzerOn() swDelay(1) buzzerOff() if (pressedKey == pinArray[cnt]) { cnt++ } else { cnt = 0 wrg++ pitch=0x16 buzzerOn() swDelay(1) buzzerOff() } } if (cnt == 4) { pitch=0x0a swDelay(2) buzzerOn() swDelay(1) buzzerOff() swDelay(1) buzzerOn() swDelay(1) buzzerOff() main() } if (wrg == 3) timer = 10 } alarmOn() }
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/16/2008 for the course ECE 2801 taught by Professor Jarvis during the Spring '08 term at WPI.

Page1 / 30

alarm - #include "msp430x44x.h" msp430F449 #include...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online