Aktuální adresář: FITkit /
trunk /
apps /
demo_msp /
led /
mcu /
main.c
1 /*******************************************************************************
2 main: interrupt service routine (ISR) of timer A0 utilized for LED control
3 Copyright (C) 2009 Brno University of Technology,
4 Faculty of Information Technology
5 Author(s): Josef Strnadel <strnadel AT stud.fit.vutbr.cz>
6
7 LICENSE TERMS
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
11 are met:
12 1. Redistributions of source code must retain the above copyright
13 notice, this list of conditions and the following disclaimer.
14 2. Redistributions in binary form must reproduce the above copyright
15 notice, this list of conditions and the following disclaimer in
16 the documentation and/or other materials provided with the
17 distribution.
18 3. All advertising materials mentioning features or use of this software
19 or firmware must display the following acknowledgement:
20
21 This product includes software developed by the University of
22 Technology, Faculty of Information Technology, Brno and its
23 contributors.
24
25 4. Neither the name of the Company nor the names of its contributors
26 may be used to endorse or promote products derived from this
27 software without specific prior written permission.
28
29 This software or firmware is provided ``as is'', and any express or implied
30 warranties, including, but not limited to, the implied warranties of
31 merchantability and fitness for a particular purpose are disclaimed.
32 In no event shall the company or contributors be liable for any
33 direct, indirect, incidental, special, exemplary, or consequential
34 damages (including, but not limited to, procurement of substitute
35 goods or services; loss of use, data, or profits; or business
36 interruption) however caused and on any theory of liability, whether
37 in contract, strict liability, or tort (including negligence or
38 otherwise) arising in any way out of the use of this software, even
39 if advised of the possibility of such damage.
40
41 $Id$
42
43
44 *******************************************************************************/
45
46 #include <fitkitlib.h>
47
48
49 /*******************************************************************************
50 * Vypis uzivatelske napovedy (funkce se vola pri vykonavani prikazu "help")
51 * systemoveho helpu
52 *******************************************************************************/
53 void print_user_help(void)
54 {
55 }
56
57
58 /*******************************************************************************
59 * Dekodovani a vykonani uzivatelskych prikazu
60 *******************************************************************************/
61 unsigned char decode_user_cmd(char *cmd_ucase, char *cmd)
62 {
63 return (CMD_UNKNOWN);
64 }
65
66
67 /*******************************************************************************
68 * Inicializace periferii/komponent po naprogramovani FPGA
69 *******************************************************************************/
70 void fpga_initialized()
71 {
72 term_send_crlf();
73 term_send_str_crlf("Aplikace bezi. Melo by byt videt blikat zelenou LED D5 (levy dolni roh FITkitu), a to s frekvenci 1Hz.");
74 }
75
76
77 /*******************************************************************************
78 * Hlavni funkce
79 *******************************************************************************/
80 void main(void)
81 {
82 initialize_hardware();
83 WDG_stop(); // zastav watchdog
84
85 set_led_d5(1);
86
87 CCTL0 = CCIE; // povol preruseni pro casovac (rezim vystupni komparace)
88 CCR0 = 0x4000; // nastav po kolika ticich (16384 = 0x4000, tj. za 1/2 s) ma dojit k preruseni
89 TACTL = TASSEL_1 + MC_2; // ACLK (f_tiku = 32768 Hz = 0x8000 Hz), nepretrzity rezim
90
91 while (1) {
92 terminal_idle(); // obsluha terminalu
93 }
94 }
95
96 /*******************************************************************************
97 * Obsluha preruseni casovace timer A0
98 *******************************************************************************/
99 interrupt (TIMERA0_VECTOR) Timer_A (void)
100 {
101 flip_led_d5(); //invertuj bit
102 CCR0 += 0x4000; // nastav po kolika ticich (16384 = 0x4000, tj. za 1/2 s) ma dojit k dalsimu preruseni
103 }
104