Subversion Repositories HomeAutomation

Rev

Rev 64 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 64 Rev 67
Line 12... Line 12...
12
 
12
 
13
#include <compiler.h>
13
#include <compiler.h>
14
#include <stackTasks.h>
14
#include <stackTasks.h>
15
#include <CANdefs.h>
15
#include <CANdefs.h>
16
#include <CAN.h>
16
#include <CAN.h>
17
#include <Tick.h>
17
//#include <Tick.h>
-
 
18
#include <boot.h>
-
 
19
 
-
 
20
/** V E C T O R  R E M A P P I N G *******************************************/
-
 
21
 
-
 
22
#pragma code _HIGH_INTERRUPT_VECTOR = 0x000008
-
 
23
void _high_ISR (void)
-
 
24
{
-
 
25
    _asm goto RM_HIGH_INTERRUPT_VECTOR _endasm
-
 
26
}
-
 
27
 
-
 
28
#pragma code _LOW_INTERRUPT_VECTOR = 0x000018
-
 
29
void _low_ISR (void)
-
 
30
{
-
 
31
    _asm goto RM_LOW_INTERRUPT_VECTOR _endasm
-
 
32
}
-
 
33
 
-
 
34
#pragma code
-
 
35
 
18
 
36
 
19
#ifdef USE_CAN
37
#ifdef USE_CAN
20
    #include <CAN.h>
38
    #include <CAN.h>
21
#endif
39
#endif
22
 
40
 
23
static CAN_PROTO_MESSAGE cm;
41
static CAN_PROTO_MESSAGE cm;
24
static BYTE ful=0;
42
static BYTE ful=0;
25
static DWORD cnt =0;
43
static DWORD cnt =0;
26
 
44
 
27
static void mainInit(void);
45
static void mainInit(void);
28
static BOOL canGetPacket(void);
46
static BOOL canGetPacket(void);
-
 
47
void TBLWT_Func(void);
-
 
48
void TBLWTPOSTINC_Func (void);
-
 
49
void TBLRD_Func(void);
-
 
50
 
-
 
51
#define TICK_SUB_COUNTER_10MS 312
-
 
52
#define PACKET_TIMEOUT 14
-
 
53
#define BOOTLOADER_INIT_TIMOUT 500
-
 
54
 
-
 
55
DWORD tickCounter = 0;
-
 
56
DWORD tickSubCounter = 0;
29
 
57
 
30
#define PACKET_TIMEOUT (TICK_SECOND/20)
58
DWORD tickGet(void);
31
#define BOOTLOADER_INIT_TIMOUT (TICK_SECOND*5)
-
 
32
 
59
 
33
void main()
60
void main()
34
{
61
{
35
    static PROGRAM_STATE pgs = pgsWATING_START;
62
    static PROGRAM_STATE pgs = pgsWATING_START;
36
    static TICK t = 0;
63
    static DWORD t = 0;
37
    static WORD programmerSid=0;
64
    static WORD programmerSid=0;
38
   
65
   
39
    static BYTE errMsg = ERR_NO_ERROR;
66
    static BYTE errMsg = ERR_NO_ERROR;
40
    static PROGRAM_STATE afterAckPgs = pgsWATING_START;
67
    static PROGRAM_STATE afterAckPgs = pgsWATING_START;
41
    static DWORD pgmAddress = 0;
68
    static DWORD pgmAddress = 0;
42
    static BYTE bytesReceived = 0;
69
    static BYTE bytesReceived = 0;
43
 
70
 
-
 
71
    DWORD tBoot;
-
 
72
   
-
 
73
    static BYTE pgmData[64];
-
 
74
 
44
    static BYTE tmp;
75
    static BYTE tmp;
45
 
76
 
46
    // Inits
77
    // Inits
47
 
-
 
48
    mainInit();
78
    mainInit();
49
 
79
 
50
    #ifdef USE_CAN
80
    #ifdef USE_CAN
51
        canInit();
81
        canInit();
52
    #endif
82
    #endif
53
 
-
 
54
 
83
 
55
 
-
 
56
    tickInit();
84
    tBoot = tickGet();
57
 
-
 
58
   
85
   
59
 
86
 
60
    for(;;)
87
    for(;;)
61
    {
88
    {
-
 
89
        BYTE i;
62
        CAN_PROTO_MESSAGE outCm;
90
        CAN_PROTO_MESSAGE outCm;
63
        BOOL hasPacket = canGetPacket();
91
        BOOL hasPacket = canGetPacket();
64
 
92
 
65
        if (hasPacket)
93
        tickSubCounter++;
-
 
94
        if (tickSubCounter>TICK_SUB_COUNTER_10MS)
66
        {
95
        {
67
                tmp=5;
96
            tickCounter++;
-
 
97
            tickSubCounter=0;
68
        }
98
        }
69
 
99
 
70
        switch(pgs)
100
        switch(pgs)
71
        {
101
        {
72
            case pgsWATING_START:
102
            case pgsWATING_START:
Line 74... Line 104...
74
                if (hasPacket==TRUE && cm.funct==FUNCT_BOOTLOADER && cm.funcc==FUNCC_BOOT_INIT && cm.data[RID_INDEX]==MY_ID && cm.nid==MY_NID)
104
                if (hasPacket==TRUE && cm.funct==FUNCT_BOOTLOADER && cm.funcc==FUNCC_BOOT_INIT && cm.data[RID_INDEX]==MY_ID && cm.nid==MY_NID)
75
                {
105
                {
76
                    // Has new start packet
106
                    // Has new start packet
77
                    pgmAddress      = (((DWORD)cm.data[ADDRU_INDEX])<<16)+(((DWORD)cm.data[ADDRH_INDEX])<<8)+((DWORD)cm.data[ADDRL_INDEX]);
107
                    pgmAddress      = (((DWORD)cm.data[ADDRU_INDEX])<<16)+(((DWORD)cm.data[ADDRH_INDEX])<<8)+((DWORD)cm.data[ADDRL_INDEX]);
78
                    programmerSid   = cm.sid;
108
                    programmerSid   = cm.sid;
79
                    t               = tickGet();
109
                    t               = tickGet();
80
                    errMsg          = ERR_NO_ERROR;
110
                    errMsg          = ERR_NO_ERROR;
81
                    afterAckPgs     = pgsWAIT_FIRST_PGM_PACKET;
111
                    afterAckPgs     = pgsWAIT_FIRST_PGM_PACKET;
82
                    pgs             = pgsSEND_ACK;
112
                    pgs             = pgsSEND_ACK;
-
 
113
                    // save pgm adress.
-
 
114
                   
83
                }
115
                }
84
 
116
 
85
                // TODO TIMEOUT!
-
 
86
                // tBoot = tickGet();
117
                // Bootloader timeout
87
                // if ((tickGet()-tBoot)>BOOTLOADER_INIT_TIMOUT) goto userprgm;
118
                if ((tickGet()-tBoot)>BOOTLOADER_INIT_TIMOUT)
-
 
119
                {
-
 
120
                    pgs = pgsDONE;
-
 
121
                }
88
            break;         
122
            break;         
89
 
123
 
90
            case pgsSEND_ACK:
124
            case pgsSEND_ACK:
91
                // send ack
125
                // send ack
92
                outCm.funct             = FUNCT_BOOTLOADER;
126
                outCm.funct             = FUNCT_BOOTLOADER;
Line 109... Line 143...
109
                {
143
                {
110
                    // Timeout, resend ack.
144
                    // Timeout, resend ack.
111
                    errMsg          = ERR_NO_ERROR;
145
                    errMsg          = ERR_NO_ERROR;
112
                    afterAckPgs     = pgsWAIT_FIRST_PGM_PACKET;
146
                    afterAckPgs     = pgsWAIT_FIRST_PGM_PACKET;
113
                    pgs             = pgsSEND_ACK;
147
                    pgs             = pgsSEND_ACK;
114
                }
148
                }
115
 
149
 
116
                // If programming packet...
150
                // If programming packet...
117
                if (hasPacket==TRUE && cm.funct==FUNCT_BOOTLOADER && cm.funcc==FUNCC_BOOT_PGM && cm.nid==MY_NID && cm.sid==programmerSid)
151
                if (hasPacket==TRUE && cm.funct==FUNCT_BOOTLOADER && (cm.funcc & 0x3)==FUNCC_BOOT_PGM && cm.nid==MY_NID && cm.sid==programmerSid)
118
                {
152
                {
-
 
153
                    BYTE localIndex = (BYTE)((cm.funcc & 0x1C)>>2)*8;
-
 
154
 
119
                    // Save bytes in memory, setup start adress etc..
155
                    // Save bytes in memory, setup start adress etc..
120
                    bytesReceived   = 8;
156
                    bytesReceived   = 8;       
-
 
157
                    pgmData[localIndex+0]=cm.data[0]; pgmData[localIndex+1]=cm.data[1]; pgmData[localIndex+2]=cm.data[2]; pgmData[localIndex+3]=cm.data[3];
-
 
158
                    pgmData[localIndex+4]=cm.data[4]; pgmData[localIndex+5]=cm.data[5]; pgmData[localIndex+6]=cm.data[6]; pgmData[localIndex+7]=cm.data[7];
-
 
159
               
121
                    pgs             = pgsWAIT_PGM_PACKET;
160
                    pgs             = pgsWAIT_PGM_PACKET;
122
                }
161
                }
123
 
162
 
124
 
163
 
125
            break;
164
            break;
126
 
165
 
127
 
166
 
128
            case pgsWAIT_PGM_PACKET:
167
            case pgsWAIT_PGM_PACKET:
129
       
168
       
130
           
169
           
131
                // If programming packet...
170
                // If programming packet...
132
                if (hasPacket==TRUE && cm.funct==FUNCT_BOOTLOADER && cm.funcc==FUNCC_BOOT_PGM && cm.nid==MY_NID && cm.sid==programmerSid)
171
                if (hasPacket==TRUE && cm.funct==FUNCT_BOOTLOADER && (cm.funcc & 0x3)==FUNCC_BOOT_PGM && cm.nid==MY_NID && cm.sid==programmerSid)
133
                {
172
                {
-
 
173
                    BYTE localIndex = (BYTE)((cm.funcc & 0x1C)>>2)*8;
134
                    // Save bytes in memory, inc received bytes.
174
                    // Save bytes in memory, inc received bytes.
-
 
175
                    pgmData[localIndex+0]=cm.data[0]; pgmData[localIndex+1]=cm.data[1]; pgmData[localIndex+2]=cm.data[2]; pgmData[localIndex+3]=cm.data[3];
-
 
176
                    pgmData[localIndex+4]=cm.data[4]; pgmData[localIndex+5]=cm.data[5]; pgmData[localIndex+6]=cm.data[6]; pgmData[localIndex+7]=cm.data[7];
-
 
177
                   
135
                    bytesReceived   += 8;
178
                    bytesReceived   += 8;
136
                    pgs              = pgsWAIT_PGM_PACKET;
179
                    pgs              = pgsWAIT_PGM_PACKET;
137
                }
180
                }
138
 
181
 
139
                // If adress packet (control packet)..
182
                // If adress packet (control packet)..
140
                if (hasPacket==TRUE && cm.funct==FUNCT_BOOTLOADER && cm.funcc==FUNCC_BOOT_ADDR && cm.nid==MY_NID && cm.sid==programmerSid)
183
                if (hasPacket==TRUE && cm.funct==FUNCT_BOOTLOADER && cm.funcc==FUNCC_BOOT_ADDR && cm.nid==MY_NID && cm.sid==programmerSid)
141
                {
184
                {
142
                    // Send ack and goto wait first packet.
185
                    // Send ack and goto wait first packet.
-
 
186
                    // save adress.
143
                    errMsg          = ERR_NO_ERROR;
187
                    errMsg          = ERR_NO_ERROR;
144
                    afterAckPgs     = pgsWAIT_FIRST_PGM_PACKET;
188
                    afterAckPgs     = pgsWAIT_FIRST_PGM_PACKET;
145
                    pgs             = pgsSEND_ACK;
189
                    pgs             = pgsSEND_ACK;
146
                }
190
                }
147
               
191
               
148
                // If end packet...
192
                // If end packet...
149
                if (hasPacket==TRUE && cm.funct==FUNCT_BOOTLOADER && cm.funcc==FUNCC_BOOT_DONE && cm.nid==MY_NID && cm.sid==programmerSid)
193
                if (hasPacket==TRUE && cm.funct==FUNCT_BOOTLOADER && cm.funcc==FUNCC_BOOT_DONE && cm.nid==MY_NID && cm.sid==programmerSid)
150
                {
194
                {
Line 154... Line 198...
154
                    // If 64, write.
198
                    // If 64, write.
155
 
199
 
156
                    if (bytesReceived==0)
200
                    if (bytesReceived==0)
157
                    {
201
                    {
158
                        // No received, done.
202
                        // No received, done.
159
                        errMsg          = ERR_NO_ERROR;
203
                        errMsg          = ERR_NO_ERROR;
160
                        afterAckPgs     = pgsDONE;
204
                        afterAckPgs     = pgsDONE;
161
                        pgs             = pgsSEND_ACK;
205
                        pgs             = pgsSEND_ACK;
162
                    }
206
                    }
163
                    else if (bytesReceived!=64)
207
                    else if (bytesReceived!=64)
164
                    {
208
                    {
165
                        errMsg          = ERR_ERROR;
209
                        errMsg          = ERR_ERROR;
166
                        afterAckPgs     = pgsWAIT_FIRST_PGM_PACKET;
210
                        afterAckPgs     = pgsWAIT_FIRST_PGM_PACKET;
167
                        pgs             = pgsSEND_ACK;
211
                        pgs             = pgsSEND_ACK;
168
                    }
212
                    }
169
                    else
213
                    else
170
                    {
214
                    {
171
                        pgs              = pgsWRITE_PROGRAM;
215
                        pgs              = pgsWRITE_PROGRAM;
172
                        afterAckPgs     = pgsDONE;
216
                        afterAckPgs     = pgsDONE;
173
                    }
217
                    }
174
                }
218
                }
175
 
219
 
176
                // If bytes received 64, write..
220
                // If bytes received 64, write..
177
                if (bytesReceived==64)
221
                if (bytesReceived==64)
178
                {
222
                {
179
                    LED0_IO=~LED0_IO;
223
                    LED0_IO=~LED0_IO;
Line 185... Line 229...
185
 
229
 
186
            break;
230
            break;
187
 
231
 
188
 
232
 
189
            case pgsWRITE_PROGRAM:
233
            case pgsWRITE_PROGRAM:
-
 
234
 
190
 
235
 
191
                // Write program and send ack.
236
                // Write program and send ack.
-
 
237
 
-
 
238
                //Load Table pointer registers with base address to erase.
-
 
239
                TBLPTRU = (BYTE)((pgmAddress & 0xFF0000)>>16);
-
 
240
                TBLPTRH = (BYTE)((pgmAddress & 0xFF00)>>8);
-
 
241
                TBLPTRL = (BYTE)(pgmAddress & 0xFF);
-
 
242
 
-
 
243
                // point to Flash program memory
-
 
244
                EECON1bits.EEPGD = 1;
-
 
245
                // access Flash program memory
-
 
246
                EECON1bits.CFGS = 0;
-
 
247
                // enable write to memory
-
 
248
                EECON1bits.WREN = 1;
-
 
249
                // enable Row Erase operation
-
 
250
                EECON1bits.FREE = 1;
-
 
251
                // disable interrupts
-
 
252
                INTCONbits.GIE = 0;
-
 
253
 
-
 
254
                // Do it!
-
 
255
                EECON2 = 0x55;
-
 
256
                EECON2 = 0xAA;
-
 
257
                EECON1bits.WR = 1;
-
 
258
 
-
 
259
                // enable interrupts
-
 
260
                INTCONbits.GIE = 1;
-
 
261
               
-
 
262
                //Load Table pointer registers with base address to program.
-
 
263
                TBLPTRU = (BYTE)((pgmAddress & 0xFF0000)>>16);
-
 
264
                TBLPTRH = (BYTE)((pgmAddress & 0xFF00)>>8);
-
 
265
                TBLPTRL = (BYTE)(pgmAddress & 0xFF);
-
 
266
 
-
 
267
                // Load bytes
-
 
268
                for(i=0;i<63;i++)
-
 
269
                {
-
 
270
                    TABLAT=pgmData[i];
-
 
271
                    TBLWTPOSTINC_Func();
-
 
272
                }
-
 
273
                TABLAT=pgmData[63];
-
 
274
                TBLWT_Func();
-
 
275
 
-
 
276
 
-
 
277
                // point to Flash program memory
-
 
278
                EECON1bits.EEPGD = 1;
-
 
279
                // access Flash program memory
-
 
280
                EECON1bits.CFGS = 0;
-
 
281
                // enable write to memory
-
 
282
                EECON1bits.WREN = 1;
-
 
283
                // disable interrupts
-
 
284
                INTCONbits.GIE = 0;
-
 
285
               
-
 
286
                // Do it!
-
 
287
                EECON2 = 0x55;
-
 
288
                EECON2 = 0xAA;
-
 
289
                EECON1bits.WR = 1;
-
 
290
 
-
 
291
                // enable interrupts
-
 
292
                INTCONbits.GIE = 1;
-
 
293
 
-
 
294
                // disable write to memory
-
 
295
                EECON1bits.WREN = 0;
-
 
296
 
192
                pgmAddress     += 64;
297
                pgmAddress     += 64;
193
                bytesReceived   = 0;
298
                bytesReceived   = 0;
194
                errMsg          = ERR_NO_ERROR;
299
                errMsg          = ERR_NO_ERROR;
195
                pgs             = pgsSEND_ACK;
300
                pgs             = pgsSEND_ACK;
196
 
301
 
197
            break;
302
            break;
198
 
303
 
199
 
304
 
200
            case pgsDONE:
305
            case pgsDONE:
201
                // Goto main program.
-
 
202
                if ((tickGet()-t)>=TICK_SECOND/4)
306
                _asm  goto RM_RESET_VECTOR _endasm
203
                {
-
 
204
                   
-
 
205
                    LED0_IO=~LED0_IO;
-
 
206
                    t=tickGet();
-
 
207
                }
-
 
208
            break;
307
            break;
209
 
308
 
210
       
309
       
211
 
310
 
212
 
311
 
213
            default:
312
            default:
214
                pgs = pgsWATING_START;
313
                pgs = pgsWATING_START;
215
            break;
314
            break;
216
        }
315
        }
217
   
316
   
218
 
-
 
219
    }
-
 
220
}
-
 
221
 
-
 
222
 
-
 
223
#pragma interruptlow HighISR
-
 
224
void HighISR(void)
-
 
225
{
-
 
226
    tickUpdate();
-
 
227
}
-
 
228
#pragma code highVector=0x08
-
 
229
void HighVector (void)
-
 
230
{
-
 
231
    _asm goto HighISR _endasm
-
 
232
}
-
 
233
#pragma code // Return to default code section
-
 
234
 
-
 
235
 
-
 
236
 
-
 
237
#pragma interruptlow LowISR
-
 
238
void LowISR(void)
-
 
239
{
-
 
240
 
317
 
241
}
318
    }
242
#pragma code lowVector=0x18
-
 
243
void LowVector (void)
-
 
244
{
-
 
245
    _asm goto LowISR _endasm
-
 
246
}
319
}
247
#pragma code // Return to default code section
-
 
248
 
320
 
249
 
321
 
250
/*
322
/*
251
*   Function: mainInit
323
*   Function: mainInit
252
*
324
*
253
*   Input:  none
325
*   Input:  none
Line 257... Line 329...
257
*   Depends: none.
329
*   Depends: none.
258
*/
330
*/
259
void mainInit()
331
void mainInit()
260
{
332
{
261
    LED0_TRIS=0;   
333
    LED0_TRIS=0;   
262
 
334
 
263
    // Enable internal PORTB pull-ups
335
    // Enable internal PORTB pull-ups
264
    INTCON2bits.RBPU = 0;
336
    INTCON2bits.RBPU = 0;
265
   
337
   
266
    // Enable Interrupts
338
    // Enable Interrupts
267
    INTCONbits.GIEH = 1;
339
    INTCONbits.GIEH = 1;
268
    INTCONbits.GIEL = 1;
340
    INTCONbits.GIEL = 1;
269
 
341
 
270
    // Enable interrupt prirority
342
    // Enable interrupt prirority
271
    RCONbits.IPEN=1;
343
    RCONbits.IPEN=1;
272
   
344
   
273
 
345
 
274
}
346
}
275
 
347
 
276
 
348
 
277
 
349
 
278
/// CAN-------------------------------------------------------
350
/// CAN-------------------------------------------------------
279
 
351
 
280
 
352
 
281
#ifdef USE_CAN
353
#ifdef USE_CAN
282
 
354
 
Line 446... Line 518...
446
    // None of the transmit buffers were empty. 
518
    // None of the transmit buffers were empty. 
447
    else { return FALSE;}
519
    else { return FALSE;}
448
 
520
 
449
    if (prio<0 || prio>3) prio = 0;
521
    if (prio<0 || prio>3) prio = 0;
450
 
522
 
451
 
523
 
452
        //RXB0SIDH 28 27 26 25 24 23 22 21
524
        //RXB0SIDH 28 27 26 25 24 23 22 21
453
        //RXB0SIDL 20 19 18 xx xx xx 17 16
525
        //RXB0SIDL 20 19 18 xx xx xx 17 16
454
        //RXB0EIDH 15 14 13 12 11 10 09 08
526
        //RXB0EIDH 15 14 13 12 11 10 09 08
455
        //RXB0EIDL 07 06 05 04 03 02 01 00
527
        //RXB0EIDL 07 06 05 04 03 02 01 00
456
 
528
 
Line 461... Line 533...
461
 
533
 
462
        RXB0SIDH = (BYTE)((cm.funct & 0x0F)<<4)+(BYTE)((cm.funcc & 0x03C0)>>6);
534
        RXB0SIDH = (BYTE)((cm.funct & 0x0F)<<4)+(BYTE)((cm.funcc & 0x03C0)>>6);
463
        RXB0SIDL = (BYTE)((cm.funcc & 0x003F)<<2)+(BYTE)((cm.funcc & 0x0006)>>1);
535
        RXB0SIDL = (BYTE)((cm.funcc & 0x003F)<<2)+(BYTE)((cm.funcc & 0x0006)>>1);
464
        RXB0EIDH = (BYTE)((cm.funcc & 0x0001)<<7)+(BYTE)((cm.nid & 0x3F)<<1)+(BYTE)((cm.sid & 0x0100)>>8);
536
        RXB0EIDH = (BYTE)((cm.funcc & 0x0001)<<7)+(BYTE)((cm.nid & 0x3F)<<1)+(BYTE)((cm.sid & 0x0100)>>8);
465
        RXB0EIDL = (BYTE)((cm.sid & 0x00FF));
537
        RXB0EIDL = (BYTE)((cm.sid & 0x00FF));
466
 
538
 
467
        // Data length
539
        // Data length
468
        RXB0DLC = 0;
540
        RXB0DLC = 0;
469
        if (cm.data_length>8) RXB0DLC=8; else RXB0DLC=cm.data_length;
541
        if (cm.data_length>8) RXB0DLC=8; else RXB0DLC=cm.data_length;
470
       
542
       
471
        // Remote request
543
        // Remote request
472
        if (cm.remote_request==TRUE)
544
        if (cm.remote_request==TRUE)
473
        {
545
        {
474
            _asm
546
            _asm
475
                bsf RXB0DLC, 6, 0
547
                bsf RXB0DLC, 6, 0
476
            _endasm
548
            _endasm
477
        }
549
        }
478
        else
550
        else
479
        {
551
        {
480
            _asm
552
            _asm
481
                bcf RXB0DLC, 6, 0
553
                bcf RXB0DLC, 6, 0
482
            _endasm
554
            _endasm
483
        }
555
        }
484
 
556
 
485
        // Data one bye one, for speed
557
        // Data one bye one, for speed
Line 495... Line 567...
495
        RXB0CON = (RXB0CON & 0b11111100) | prio;
567
        RXB0CON = (RXB0CON & 0b11111100) | prio;
496
 
568
 
497
        // mark as redy to transmit
569
        // mark as redy to transmit
498
        _asm
570
        _asm
499
            bsf RXB0CON, 3, 0
571
            bsf RXB0CON, 3, 0
500
        _endasm
572
        _endasm
501
 
573
 
502
        return TRUE;
574
        return TRUE;
503
 
575
 
-
 
576
}
-
 
577
 
-
 
578
 
-
 
579
 
-
 
580
#endif //USE_CAN
-
 
581
 
-
 
582
 
-
 
583
 
-
 
584
 
-
 
585
void TBLRD_Func()
-
 
586
{
-
 
587
_asm
-
 
588
    TBLRD
-
 
589
_endasm
-
 
590
}
-
 
591
 
-
 
592
void TBLWT_Func()
-
 
593
{
-
 
594
_asm
-
 
595
    TBLWT
-
 
596
_endasm
-
 
597
}
-
 
598
 
-
 
599
 
-
 
600
void TBLWTPOSTINC_Func (void){
-
 
601
_asm
-
 
602
    TBLWTPOSTINC
-
 
603
_endasm
-
 
604
}
-
 
605
 
-
 
606
DWORD tickGet()
-
 
607
{
-
 
608
    return tickCounter;
504
}
609
}
505
 
610
 
506
 
611
 
507
 
-
 
508
#endif //USE_CAN
612
#pragma code user = RM_RESET_VECTOR