Subversion Repositories HomeAutomation

Rev

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

Rev Author Line No. Line
53 johboh 1
/*********************************************************************
2
 *
3
 *                  Main application
4
 *
5
 *********************************************************************
6
 * FileName:        Main.c
7
 *
8
 * Author               Date    Comment
9
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10
 * Johan Böhlin     21-10-06    Original        (Rev 1.0)
11
 ********************************************************************/
12
 
13
#include <compiler.h>
14
#include <stackTasks.h>
15
 
16
#ifdef USE_CAN
17
    #include <CAN.h>
18
#endif
19
 
20
static void mainInit(void);
21
 
22
void main()
23
{
24
 
25
    // Inits
26
 
27
    mainInit();
28
 
29
    #ifdef USE_CAN
30
        canInit();
31
    #endif
32
 
33
 
34
    while(1)
35
    {
36
    }
37
}
38
 
39
 
40
#pragma interruptlow HighISR
41
void HighISR(void)
42
{
43
 
44
 
45
    #ifdef USE_CAN
46
        canISR();
47
    #endif
48
 
49
}
50
#pragma code highVector=0x08
51
void HighVector (void)
52
{
53
    _asm goto HighISR _endasm
54
}
55
#pragma code // Return to default code section
56
 
57
 
58
 
59
#pragma interruptlow LowISR
60
void LowISR(void)
61
{
62
 
63
}
64
#pragma code lowVector=0x18
65
void LowVector (void)
66
{
67
    _asm goto LowISR _endasm
68
}
69
#pragma code // Return to default code section
70
 
71
 
72
/*
73
*   Function: mainInit
74
*
75
*   Input:  none
76
*   Output: none
77
*   Pre-conditions: none
78
*   Affects: Se code
79
*   Depends: none.
80
*/
81
void mainInit()
82
{
83
    LED0_TRIS=0;   
84
 
85
    // Enable internal PORTB pull-ups
86
    INTCON2bits.RBPU = 0;
87
 
88
    // Enable Interrupts
89
    INTCONbits.GIEH = 1;
90
    INTCONbits.GIEL = 1;
91
 
92
    // Enable interrupt prirority
93
    RCONbits.IPEN=1;
94
 
95
 
96
}
97
 
98
/*
99
*   Function: canParse
100
*
101
*   Input:  Received can message
102
*   Output: none
103
*   Pre-conditions: canInit and received packet.
104
*   Affects: Sensors/actuators/etc. See code.
105
*   Depends: none.
106
*/
107
#ifdef USE_CAN
108
void canParse(CAN_MESSAGE cm)
109
{
110
 
111
}
112
#endif
113