Subversion Repositories HomeAutomation

Rev

Details | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
140 johboh 1
/*********************************************************************
129 johboh 2
 *
3
 *                  Main application
4
 *
5
 *********************************************************************
6
 * FileName:        $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canLCD/Source/Main.c $
7
 * Last changed:    $LastChangedDate: 2007-03-04 12:01:27 +0100 (Sun, 04 Mar 2007) $
8
 * By:              $LastChangedBy: johboh $
9
 * Revision:        $Revision: 357 $
10
 ********************************************************************/
11
 
12
 
13
#include <compiler.h>
14
#include <stackTasks.h>
15
#include <Tick.h>
16
#include <funcdefs.h>
260 johboh 17
#include <CAN.h>
357 johboh 18
#include "..\canBoot\Include\boot.h"
129 johboh 19
 
357 johboh 20
#ifdef USE_GLCD
21
    #include "glcd.h"
140 johboh 22
#endif
23
 
357 johboh 24
#ifdef USE_GLCD
25
    const rom BYTE pic[]={
26
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
27
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
28
0x00,0x00,0x00,0x60,0x90,0x90,0x10,0x30,
29
0x00,0x10,0xF0,0x80,0x80,0x00,0x00,0x00,
30
0x00,0x80,0x80,0x00,0x00,0x80,0x80,0x80,
31
0x80,0x00,0x00,0x00,0x80,0x80,0x8C,0x80,
32
0x00,0x10,0xF0,0x80,0x80,0x00,0x00,0x00,
33
0x00,0x80,0x80,0x00,0x00,0x80,0x80,0x80,
34
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
35
0x00,0x30,0x10,0xF0,0x10,0x30,0x00,0xE0,
36
0x10,0x10,0x10,0xE0,0x00,0x10,0xF0,0x90,
37
0x90,0x60,0x00,0x70,0x80,0xF0,0x8C,0x70,
38
0x00,0x00,0x80,0x70,0xC0,0x00,0x00,0x10,
39
0x70,0x80,0x70,0x10,0x00,0x00,0x00,0x00,
40
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
41
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
42
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
43
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
44
0x00,0x00,0x00,0x0C,0x08,0x08,0x09,0x06,
45
0x00,0x08,0x0F,0x08,0x00,0x0F,0x08,0x00,
46
0x07,0x0A,0x0A,0x0B,0x00,0x08,0x0F,0x08,
47
0x00,0x0F,0x08,0x00,0x08,0x08,0x09,0x08,
48
0x00,0x08,0x0F,0x08,0x00,0x0F,0x08,0x00,
49
0x07,0x0A,0x0A,0x0B,0x00,0x08,0x0F,0x08,
50
0x00,0x0F,0x08,0x00,0x00,0x00,0x00,0x00,
51
0x00,0x00,0x08,0x0F,0x08,0x00,0x00,0x07,
52
0x08,0x08,0x08,0x07,0x00,0x08,0x0F,0x08,
53
0x00,0x00,0x00,0x00,0x0F,0x00,0x0F,0x00,
54
0x00,0x08,0x0F,0x02,0x03,0x0E,0x08,0x00,
55
0x08,0x0F,0x08,0x00,0x00,0x00,0x00,0x00,
56
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
57
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
58
0x00,0x03,0x81,0xFF,0x81,0x03,0x00,0x00,
59
0x70,0xA8,0xA8,0xB0,0x00,0x00,0x70,0x88,
60
0x88,0x98,0x00,0x81,0xFF,0x88,0x08,0xF0,
61
0x80,0x88,0xF8,0x88,0x08,0xF0,0x80,0x00,
62
0x70,0x88,0x88,0x70,0x00,0x81,0x81,0xFF,
63
0x80,0x80,0x00,0x00,0x70,0x88,0x88,0x70,
64
0x00,0x00,0xD0,0xA8,0xA8,0x98,0x08,0x08,
65
0x38,0xC8,0x60,0x18,0x08,0x00,0x00,0x00,
66
0x00,0x00,0x00,0x7E,0x81,0x81,0x81,0x43,
67
0x00,0x00,0x70,0x88,0x88,0x70,0x00,0x00,
68
0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
69
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
70
0x00,0x81,0xFF,0x81,0x80,0x80,0xC0,0x00,
71
0x08,0x7E,0x88,0x80,0x00,0x00,0x70,0x88,
72
0x89,0xFF,0x80,0x00,0x80,0x00,0x00,0x00,
73
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
74
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
75
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
76
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
77
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
78
0x00,0x00,0x01,0x02,0x02,0x01,0x00,0x00,
79
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
80
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
81
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
82
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
83
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
84
0x02,0x02,0x01,0x02,0x00,0x00,0x00,0x00,
85
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
86
0x00,0x02,0x01,0x00,0x00,0x00,0x00,0x00,
87
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
88
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
89
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
90
0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,
91
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
92
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
93
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
94
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
95
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
96
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
97
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
98
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
99
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x81,
100
0xC0,0xFF,0x0F,0xF0,0x89,0x89,0x8B,0x70,
101
0x81,0x7E,0x00,0x42,0x00,0x76,0x89,0x89,
102
0xFF,0x89,0x89,0x76,0x00,0x00,0x00,0x00,
103
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
104
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
105
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
106
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
107
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
108
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
109
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
110
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
111
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
112
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
113
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
114
0xFF,0x81,0x80,0x80,0x0F,0xFF,0x00,0x81,
115
0x00,0x78,0x81,0x81,0x81,0x89,0x89,0x76,
116
0x89,0x76,0x00,0x81,0x00,0x00,0x00,0x00,
117
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
118
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
119
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
120
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
121
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
122
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
123
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
124
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
125
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
126
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
127
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
128
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
129
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
130
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
131
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
132
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
133
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
134
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
135
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
136
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
137
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
138
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
139
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
140
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
141
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
142
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
143
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
144
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
145
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
146
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
147
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
148
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
149
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
150
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
151
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
152
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
153
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
154
};
129 johboh 155
 
357 johboh 156
const rom BYTE pic2[] = {
157
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
158
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
159
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
160
0x00,0x00,0x00,0x80,0x03,0x00,0x00,0x00,
161
0x00,0x00,0x00,0xc0,0x0f,0x00,0x00,0x00,
162
0x00,0x00,0x00,0xc0,0x3f,0x00,0x00,0x00,
163
0x00,0x00,0x00,0xe0,0xff,0x00,0x00,0x00,
164
0x00,0x00,0x00,0xe0,0xff,0x03,0x00,0x00,
165
0x00,0x00,0x00,0xe0,0xff,0xcf,0x03,0x00,
166
0x00,0x00,0x00,0x00,0xff,0xff,0x03,0x00,
167
0x00,0x00,0x00,0x00,0xfc,0xff,0x03,0x00,
168
0x00,0x00,0x00,0x00,0xf0,0xff,0x03,0x00,
169
0x00,0x00,0x00,0x00,0xc0,0xff,0x01,0x00,
170
0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,
171
0x00,0x00,0x00,0x80,0x1f,0x78,0x00,0x00,
172
0x00,0x00,0x00,0xe0,0xff,0x00,0x00,0x00,
173
0x00,0x00,0x00,0xe0,0xff,0x03,0x00,0x00,
174
0x00,0x00,0x00,0xf0,0xff,0x07,0x00,0x00,
175
0x00,0x00,0x00,0xf0,0xff,0x0f,0x00,0x00,
176
0x00,0x00,0x00,0xf0,0xfe,0x1f,0x00,0x00,
177
0x00,0x00,0x00,0xf0,0xf1,0x1f,0x00,0x00,
178
0x00,0x00,0x00,0xf0,0xc7,0x1f,0x00,0x00,
179
0x00,0x00,0x00,0xf0,0x3f,0x1f,0x00,0x00,
180
0x00,0x00,0x00,0xf0,0xff,0x0f,0x00,0x00,
181
0x00,0x00,0x00,0xf0,0xff,0x0f,0x00,0x00,
182
0x00,0x00,0x00,0xe0,0xff,0x0f,0x00,0x00,
183
0x00,0x00,0xc0,0x83,0xff,0x07,0x00,0x00,
184
0x00,0x00,0xc0,0x3f,0xfc,0x03,0x00,0x00,
185
0x00,0x00,0xc0,0xff,0x01,0x00,0x00,0x00,
186
0x00,0x00,0xc0,0xff,0x1f,0x00,0x00,0x00,
187
0x00,0x00,0xe0,0xff,0xff,0x01,0x00,0x00,
188
0x00,0x00,0xe0,0xff,0xff,0x03,0x00,0x00,
189
0x00,0x00,0x00,0xff,0xff,0x03,0x00,0x00,
190
0x00,0x00,0x00,0xff,0xff,0x01,0x00,0x00,
191
0x00,0x00,0x00,0x0f,0xfe,0x01,0x00,0x00,
192
0x00,0x00,0x80,0x0f,0xe0,0x01,0x00,0x00,
193
0x00,0x00,0x80,0x7f,0x00,0x00,0x00,0x00,
194
0x00,0x00,0x80,0xff,0x0f,0x00,0x00,0x00,
195
0x00,0x00,0x80,0xff,0xff,0x00,0x00,0x00,
196
0x00,0x00,0x80,0xff,0xff,0x00,0x00,0x00,
197
0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,
198
0x00,0x00,0x00,0xfe,0xff,0x00,0x00,0x00,
199
0x00,0x00,0x78,0x80,0x7f,0x00,0x00,0x00,
200
0x00,0x00,0xf8,0x1f,0x60,0x00,0x00,0x00,
201
0x00,0x00,0xf8,0xff,0x0f,0x00,0x00,0x00,
202
0x00,0x00,0xf8,0xff,0x7f,0x00,0x00,0x00,
203
0x00,0x00,0xfc,0xff,0x7f,0x00,0x00,0x00,
204
0x00,0x00,0xfc,0xff,0x7f,0x00,0x00,0x00,
205
0x00,0x00,0xe0,0xff,0x3f,0x00,0x00,0x00,
206
0x00,0x00,0xe0,0xc1,0x3f,0x00,0x00,0x00,
207
0x00,0x00,0xe0,0x07,0x1c,0x00,0x00,0x00,
208
0x00,0x00,0xe0,0xff,0x3f,0x00,0x00,0x00,
209
0x00,0x00,0xe0,0xff,0x3f,0x00,0x00,0x00,
210
0x00,0x00,0xe0,0xff,0x3f,0x00,0x00,0x00,
211
0x00,0x00,0xe0,0xff,0x3f,0x00,0x00,0x00,
212
0x00,0x00,0xc0,0xff,0x1f,0x00,0x00,0x00,
213
0x00,0x00,0x00,0xe0,0x0f,0x00,0x00,0x00,
214
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
215
0x00,0x00,0x80,0xff,0x07,0x00,0x00,0x00,
216
0x00,0x00,0xc0,0xff,0x0f,0x00,0x00,0x00,
217
0x00,0x00,0xe0,0xff,0x1f,0x00,0x00,0x00,
218
0x00,0x00,0xe0,0xff,0x1f,0x00,0x00,0x00,
219
0x00,0x00,0xe0,0xff,0x1f,0x00,0x00,0x00,
220
0x00,0x00,0xf0,0xff,0x1f,0x00,0x00,0x00,
221
0x00,0x00,0xf0,0x01,0x1e,0x00,0x00,0x00,
222
0x00,0x00,0xe0,0xff,0x1f,0x00,0x00,0x00,
223
0x00,0x00,0xe0,0xff,0x1f,0x00,0x00,0x00,
224
0x00,0x00,0xe0,0xff,0x1f,0x00,0x00,0x00,
225
0x00,0x00,0xc0,0xff,0x0f,0x00,0x00,0x00,
226
0x00,0x00,0xc0,0xff,0x07,0x00,0x00,0x00,
227
0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x00,
228
0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,
229
0x00,0x00,0xe0,0xff,0x3f,0x00,0x00,0x00,
230
0x00,0x00,0xfc,0xff,0x3f,0x00,0x00,0x00,
231
0x00,0x00,0xfc,0xff,0x3f,0x00,0x00,0x00,
232
0x00,0x00,0xfc,0xff,0x3f,0x00,0x00,0x00,
233
0x00,0x00,0xfc,0xff,0x3f,0x00,0x00,0x00,
234
0x00,0x00,0xfc,0xff,0x00,0x00,0x00,0x00,
235
0x00,0x00,0xfc,0x03,0x00,0x00,0x00,0x00,
236
0x00,0x00,0xc0,0x03,0x7c,0x00,0x00,0x00,
237
0x00,0x00,0xc0,0xff,0x7f,0x00,0x00,0x00,
238
0x00,0x00,0xc0,0xff,0x7f,0x00,0x00,0x00,
239
0x00,0x00,0xc0,0xff,0x7f,0x00,0x00,0x00,
240
0x00,0x00,0xc0,0xff,0x7f,0x00,0x00,0x00,
241
0x00,0x00,0xc0,0xff,0x7f,0x00,0x00,0x00,
242
0x00,0x00,0x80,0xff,0x01,0x00,0x00,0x00,
243
0x00,0x00,0x00,0x06,0xf8,0x00,0x00,0x00,
244
0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,
245
0x00,0x00,0x00,0xfc,0xff,0x00,0x00,0x00,
246
0x00,0x00,0xf0,0xff,0xff,0x01,0x00,0x00,
247
0x00,0x00,0xf0,0xff,0xff,0x01,0x00,0x00,
248
0x00,0x00,0xf0,0xff,0x37,0x00,0x00,0x00,
249
0x00,0x00,0xe0,0xff,0x00,0x00,0x00,0x00,
250
0x00,0x00,0xe0,0x0f,0x00,0x00,0x00,0x00,
251
0x00,0x00,0xe0,0x01,0x00,0x00,0x00,0x00,
252
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
253
0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x00,
254
0x00,0x00,0x00,0x00,0xc0,0x0f,0x00,0x00,
255
0x00,0x00,0x00,0x00,0xc0,0x0f,0x00,0x00,
256
0x00,0x00,0x00,0x80,0xc7,0x0f,0x00,0x00,
257
0x00,0x00,0x00,0xc0,0xc7,0x0f,0x00,0x00,
258
0x00,0x00,0x00,0xc0,0x8f,0x07,0x00,0x00,
259
0x00,0x00,0x00,0xc0,0x8f,0x01,0x00,0x00,
260
0x00,0x00,0x00,0x80,0x3f,0x00,0x00,0x00,
261
0x00,0x00,0x00,0x80,0x7f,0x00,0x00,0x00,
262
0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,
263
0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,
264
0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,
265
0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,
266
0x00,0x00,0x00,0x00,0xf0,0x61,0x00,0x00,
267
0x00,0x00,0x00,0x00,0xf0,0xf1,0x00,0x00,
268
0x00,0x00,0x00,0x00,0xe0,0xf0,0x00,0x00,
269
0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,
270
0x00,0x00,0x00,0x00,0x00,0xfe,0x01,0x00,
271
0x00,0x00,0x00,0x00,0x80,0xff,0x01,0x00,
272
0x00,0x00,0x00,0x00,0xe0,0xff,0x01,0x00,
273
0x00,0x00,0x00,0xe0,0xf8,0xff,0x00,0x00,
274
0x00,0x00,0x00,0xe0,0xff,0x7f,0x00,0x00,
275
0x00,0x00,0x00,0xe0,0xff,0x1f,0x00,0x00,
276
0x00,0x00,0x00,0xe0,0xff,0x07,0x00,0x00,
277
0x00,0x00,0x00,0xc0,0xff,0x01,0x00,0x00,
278
0x00,0x00,0x00,0xc0,0x7f,0x00,0x00,0x00,
279
0x00,0x00,0x00,0x80,0x1f,0x00,0x00,0x00,
280
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
281
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
282
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
283
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
284
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
285
};
286
 
287
const rom BYTE pic3[] = {
288
'\xff','\xff','\xff','\xff','\xff','\xff','\xff','\xff',
289
'\xff','\xff','\xff','\xff','\xff','\xff','\xff','\xff',
290
'\xff','\xff','\xff','\xff','\xff','\xff','\xff','\xff',
291
'\xf9','\xff','\xff','\xff','\xff','\xff','\xff','\xff',
292
'\xe1','\xff','\xff','\xff','\xff','\xff','\xff','\xff',
293
'\xed','\xff','\xff','\xff','\xff','\xff','\xff','\xff',
294
'\xdd','\xff','\xff','\xff','\xff','\xff','\xff','\xff',
295
'\x9d','\xff','\xff','\xff','\xff','\xff','\xff','\xff',
296
'\xb9','\xff','\xff','\xff','\xff','\xff','\xff','\xff',
297
'\xbb','\xff','\xff','\x07','\xfc','\xff','\xff','\xff',
298
'\x7b','\xfe','\xff','\xfb','\xfb','\xff','\xff','\xff',
299
'\xfb','\xfe','\xff','\xf9','\xf3','\xff','\xff','\xff',
300
'\xf3','\xfc','\xff','\xfd','\xe7','\xff','\xff','\xff',
301
'\x07','\xfc','\xff','\xfc','\xef','\xff','\xff','\xff',
302
'\xf7','\xfd','\x7f','\xfe','\xdf','\xff','\xff','\xff',
303
'\xf7','\xfd','\x7f','\xff','\xdf','\xff','\xff','\xff',
304
'\xf7','\xfd','\x7f','\xff','\xbf','\xff','\xff','\xff',
305
'\xf7','\xfd','\x7f','\x1f','\x70','\xff','\xff','\xff',
306
'\xf7','\x3d','\x00','\xe7','\x67','\xff','\xff','\xff',
307
'\xf7','\xdd','\x7f','\xfb','\x6f','\xff','\xff','\xff',
308
'\xf7','\xe5','\x7f','\xfb','\xef','\xfe','\xff','\xff',
309
'\xf7','\xf9','\x7f','\xfb','\xef','\xfe','\xff','\xff',
310
'\xf7','\xfa','\x7f','\xfb','\xef','\xfd','\xff','\xff',
311
'\xf7','\xfc','\x7f','\xfb','\xef','\xfd','\xff','\xff',
312
'\xf7','\xfc','\x7f','\xfb','\xef','\xfb','\xff','\xff',
313
'\xf7','\xfc','\x7f','\xfb','\xef','\xfb','\xff','\xff',
314
'\xf7','\xfe','\x7f','\xf9','\xef','\xfb','\xff','\xff',
315
'\xf7','\xfe','\x7f','\xf9','\xef','\x87','\xff','\xff',
316
'\xf7','\xfe','\x7f','\xf9','\xef','\xb7','\xff','\xff',
317
'\xf7','\xfe','\x7f','\xf9','\xf7','\xb7','\xff','\xff',
318
'\xf7','\xfc','\x7f','\xf3','\xf7','\xb7','\xff','\xff',
319
'\xf7','\xfc','\x7f','\xe7','\xfb','\xb7','\xff','\xff',
320
'\xf7','\xfa','\x7f','\x1f','\xfc','\xb7','\xff','\xff',
321
'\xf7','\x7a','\x78','\xff','\xff','\xb7','\xff','\xff',
322
'\xf7','\x36','\x70','\xff','\xff','\x37','\xff','\xff',
323
'\xf7','\x36','\x70','\xff','\xff','\x77','\xff','\xff',
324
'\xf7','\x4e','\x70','\xff','\xff','\x77','\xff','\xff',
325
'\xf7','\x1e','\x00','\xff','\xff','\x77','\xff','\xff',
326
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xff','\xff',
327
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xff','\xff',
328
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xff','\xff',
329
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xff','\xff',
330
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xff','\xff',
331
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xff','\xff',
332
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xfe','\xff',
333
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xf0','\xff',
334
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xe7','\xff',
335
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xef','\xff',
336
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xcf','\xff',
337
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\x3f','\xff',
338
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\x7f','\xf8',
339
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xff','\xe7',
340
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xff','\xef',
341
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xff','\xef',
342
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xff','\xe0',
343
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xff','\xfe',
344
'\xf7','\xfe','\x7f','\xff','\xff','\x77','\xc0','\xfe',
345
'\xf7','\xfe','\x7f','\xff','\xff','\x7b','\xdf','\xc0',
346
'\xf7','\xfe','\x7f','\xff','\xff','\x7b','\xdf','\x9f',
347
'\xf7','\xfe','\x7f','\xff','\xff','\x7b','\xdf','\xbf',
348
'\xf7','\xfc','\x7f','\xff','\xff','\x7b','\xdf','\xbf',
349
'\xf7','\xfd','\x7f','\xff','\xff','\x7b','\xdf','\x81',
350
'\xf7','\xfd','\x7f','\xff','\xff','\x7b','\xdf','\xfd',
351
'\xf7','\xfd','\x7f','\xff','\xff','\x7b','\xdf','\xfd',
352
'\xf7','\xfd','\x7f','\x3f','\xf8','\x3d','\xdf','\xfd',
353
'\xf7','\x0d','\x00','\xcf','\xfb','\xbd','\xdf','\xfd',
354
'\xf7','\x22','\x60','\xe7','\xf7','\x9d','\xdf','\xfd',
355
'\xf7','\x38','\x70','\xf7','\xf7','\xdd','\xdf','\xfd',
356
'\xf7','\xfc','\x7f','\xf3','\xf7','\xcd','\xdf','\xfd',
357
'\xf7','\xfc','\x7f','\xfb','\xf7','\xe5','\xdf','\xfd',
358
'\xf7','\xfe','\x7f','\xfb','\xf7','\xf8','\xdf','\xfd',
359
'\xf7','\xfe','\x7f','\xfb','\xf7','\xfe','\xdf','\xfd',
360
'\xf7','\xfe','\x7f','\xfb','\xf7','\xfe','\xdf','\xfd',
361
'\xf7','\xfe','\x7f','\xfb','\xf7','\xfe','\xdf','\xfd',
362
'\xf7','\xfc','\x7f','\xfb','\xf7','\xfe','\xdf','\xfd',
363
'\xf7','\xfc','\x7f','\xf3','\xf7','\xfe','\xdf','\xfd',
364
'\xf7','\xf8','\x7f','\xf3','\xf7','\xfe','\xdf','\xfd',
365
'\xf3','\xf2','\x7f','\xf3','\xf7','\xfe','\xdf','\xfd',
366
'\x03','\xe6','\x7f','\xf3','\xf8','\xfe','\xdf','\xfd',
367
'\xfb','\xce','\x7f','\x03','\xfe','\xfe','\xdf','\xfd',
368
'\xfb','\x1e','\x7f','\xfb','\xff','\xfe','\xdf','\xfd',
369
'\xfb','\x7e','\x00','\xff','\xff','\xfe','\xdf','\xfd',
370
'\xfb','\xfe','\x7f','\xff','\xff','\xfe','\xdf','\xfd',
371
'\xf9','\xfe','\x7f','\xff','\x7f','\xfe','\xdf','\xfd',
372
'\x7d','\xfe','\x7f','\xff','\x7f','\xff','\xdf','\xfd',
373
'\x05','\xff','\x7f','\xff','\x7f','\xff','\xdf','\xfd',
374
'\xf9','\xff','\x3f','\xff','\x3f','\xff','\xdf','\xfd',
375
'\xff','\xff','\x7f','\xff','\xbf','\xff','\xdf','\xfd',
376
'\xff','\xff','\x7f','\xfe','\xdf','\xff','\xdf','\xfd',
377
'\xff','\xff','\xff','\xfe','\xcf','\xff','\xdf','\xfd',
378
'\xff','\xff','\xff','\x00','\xe0','\xff','\xdf','\xfd',
379
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xfd',
380
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xfd',
381
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xfd',
382
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xfd',
383
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xfd',
384
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xfd',
385
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xe1',
386
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xdf',
387
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xdf',
388
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xbf',
389
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\x81',
390
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xfc',
391
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xfe',
392
'\xff','\xff','\xff','\xff','\xff','\xff','\xdf','\xfe',
393
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xe0',
394
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xdf',
395
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xdf',
396
'\xff','\xff','\xff','\xff','\xff','\xff','\x3f','\xdf',
397
'\xff','\xff','\xff','\xff','\xff','\xff','\x3f','\xc0',
398
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xff',
399
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xff',
400
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xff',
401
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xff',
402
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xff',
403
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xff',
404
'\xff','\xff','\xff','\xff','\xff','\xff','\x7f','\xff',
405
'\xff','\xff','\xff','\xff','\xff','\xff','\x7f','\xff',
406
'\xff','\xff','\xff','\xff','\xff','\xff','\x7f','\xff',
407
'\xff','\xff','\xff','\xff','\xff','\xff','\x7f','\xce',
408
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xc0',
409
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xfd',
410
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xfd',
411
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xfb',
412
'\xff','\xff','\xff','\xff','\xff','\xff','\xbf','\xf3',
413
'\xff','\xff','\xff','\xff','\xff','\xff','\xff','\xf7',
414
'\xff','\xff','\xff','\xff','\xff','\xff','\xff','\xff',
415
'\xff','\xff','\xff','\xff','\xff','\xff','\xff','\xff'
416
};
417
 
418
 
419
 
420
 
421
rom BYTE str[] = "Johboh är bäst! ;)";
422
 
423
#endif
424
 
129 johboh 425
static void mainInit(void);
426
 
427
 
357 johboh 428
 
429
 
430
 
129 johboh 431
void main()
432
{
433
    // Inits
434
    mainInit();
260 johboh 435
    canInit();
129 johboh 436
 
437
 
357 johboh 438
    #ifdef USE_GLCD
439
        GLCD_CS_IO = 0;
440
        glcdInit();
441
        GLCD_CS_IO = 1;
140 johboh 442
    #endif
443
 
129 johboh 444
    while(1)
445
    {
357 johboh 446
        TICK currentTick = tickGet();
447
        static TICK tick_led = 0;
448
        static TICK tick_pic = 0;
129 johboh 449
 
357 johboh 450
        static BYTE picCnt = 0;
451
 
452
        if ((currentTick-tick_led)>(1*TICK_1S))
129 johboh 453
        {
454
            LED0_IO=~LED0_IO;
357 johboh 455
            tick_led = currentTick;
129 johboh 456
        }
357 johboh 457
 
458
        #ifdef USE_GLCD
459
        if ((currentTick-tick_pic)>(5*TICK_1S))
460
        {
461
            CAN_PACKET outCp;  
462
 
463
            GLCD_CS_IO = 0;
464
            glcdSetStartLine(0x00);
465
            glcdClearScr();
466
            if (picCnt==0) glcdDisplayPic(0,0,pic);
467
            else if (picCnt==1) glcdDisplayPic(0,0,pic2);
468
            else if (picCnt==2) glcdPutrs(0,0,str);
469
            else if (picCnt==3) glcdDisplayPic(0,0,pic3);
470
            GLCD_CS_IO = 1;
471
 
472
            outCp.type      = ptPGM;
473
            outCp.pgm.class = pcSENSOR;
474
            outCp.pgm.id    = pstIR;
475
            outCp.length    = 1;
476
            outCp.data[0]   = picCnt;
477
            while(!canSendMessage(outCp,PRIO_HIGH));
478
 
479
 
480
            if (++picCnt>3) picCnt=0;
481
 
482
            tick_pic = currentTick;
483
        }
484
        #endif
485
 
129 johboh 486
    }
487
}
488
 
489
 
490
#pragma interrupt high_isr
491
void high_isr(void)
492
{
260 johboh 493
    canISR();
129 johboh 494
}
495
 
496
 
497
#pragma interrupt low_isr
498
void low_isr(void)
499
{
500
 
501
}
502
 
503
 
504
 
505
/*
506
*   Function: mainInit
507
*
508
*   Input:  none
509
*   Output: none
510
*   Pre-conditions: none
511
*   Affects: Se code
512
*   Depends: none.
513
*/
514
void mainInit()
515
{
516
    LED0_TRIS=0;   
517
 
518
    // Enable Interrupts
519
    INTCONbits.GIEH = 1;
520
    INTCONbits.GIEL = 1;
521
 
522
    // Enable interrupt prirority
523
    RCONbits.IPEN=1;
524
 
525
 
526
}
527
 
528
/*
529
*   Function: canParse
530
*
531
*   Input:  Received can message
532
*   Output: none
533
*   Pre-conditions: canInit and received packet.
534
*   Affects: Sensors/actuators/etc. See code.
535
*   Depends: none.
536
*/
357 johboh 537
void canParse(CAN_PACKET cp)
129 johboh 538
{
357 johboh 539
 
129 johboh 540
}
541
 
542
 
543
// Below are mandantory when using bootloader
544
// define DEBUG_MODE to use without bootloader.
545
 
546
#ifndef DEBUG_MODE
547
extern void _startup (void);
357 johboh 548
#pragma code _RESET_INTERRUPT_VECTOR = RM_RESET_VECTOR
129 johboh 549
void _reset (void)
550
{
551
    _asm goto _startup _endasm
552
}
553
#pragma code
554
#endif
555
 
357 johboh 556
#pragma code _HIGH_INTERRUPT_VECTOR = RM_HIGH_INTERRUPT_VECTOR
129 johboh 557
void _high_ISR (void)
558
{
559
    _asm GOTO high_isr _endasm
560
}
561
#pragma code
562
 
357 johboh 563
#pragma code _LOW_INTERRUPT_VECTOR = RM_LOW_INTERRUPT_VECTOR
129 johboh 564
void _low_ISR (void)
565
{
566
    _asm GOTO low_isr _endasm
567
}
568
#pragma code
357 johboh 569
 
570
 
571