Subversion Repositories HomeAutomation

Rev

Rev 358 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 358 Rev 359
1
/*********************************************************************
1
/*********************************************************************
2
 *
2
 *
3
 *                  Compiler specifics like clockspeed and portIOs.
3
 *                  Compiler specifics like clockspeed and portIOs.
4
 *
4
 *
5
 *********************************************************************
5
 *********************************************************************
6
 * FileName:        $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canLCD/Include/compiler.h $
6
 * FileName:        $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canLCD/Include/compiler.h $
7
 * Last changed:    $LastChangedDate: 2007-03-04 14:49:20 +0100 (Sun, 04 Mar 2007) $
7
 * Last changed:    $LastChangedDate: 2007-03-04 15:13:16 +0100 (Sun, 04 Mar 2007) $
8
 * By:              $LastChangedBy: johboh $
8
 * By:              $LastChangedBy: johboh $
9
 * Revision:        $Revision: 358 $
9
 * Revision:        $Revision: 359 $
10
 ********************************************************************/
10
 ********************************************************************/
11
 
11
 
12
#ifndef COMPILER_H
12
#ifndef COMPILER_H
13
#define COMPILER_H
13
#define COMPILER_H
14
 
14
 
15
#define APP_VERSION 0x0001
15
#define APP_VERSION 0x0001
16
 
16
 
-
 
17
#define DOOR_OPEN 1
-
 
18
#define DOOR_CLOSED 0
17
 
19
 
18
#include <p18cxxx.h>
20
#include <p18cxxx.h>
19
#define CLOCK_FREQ      (40000000)      // Hz
21
#define CLOCK_FREQ      (40000000)      // Hz
20
#define INSTR_FREQ          (CLOCK_FREQ/4)
22
#define INSTR_FREQ          (CLOCK_FREQ/4)
21
#define CLOCK_FOSC      (40)      // MHz
23
#define CLOCK_FOSC      (40)      // MHz
22
#define NUM_CYK_1us     10
24
#define NUM_CYK_1us     10
23
#define NUM_CYK_1ms     10000
25
#define NUM_CYK_1ms     10000
24
 
26
 
25
#define LED0_IO         (PORTCbits.RC1)
27
#define LED0_IO         (PORTCbits.RC1)
26
#define LED0_TRIS       (TRISCbits.TRISC1)
28
#define LED0_TRIS       (TRISCbits.TRISC1)
27
 
29
 
28
// GLCD
30
// GLCD
29
#define GLCD_CS_IO      (PORTCbits.RC0)
31
#define GLCD_CS_IO      (PORTCbits.RC0)
30
#define GLCD_CS_TRIS    (TRISCbits.TRISC0)
32
#define GLCD_CS_TRIS    (TRISCbits.TRISC0)
31
#define GLCD_RES_IO     (PORTCbits.RC7)
33
#define GLCD_RES_IO     (PORTCbits.RC7)
32
#define GLCD_RES_TRIS   (TRISCbits.TRISC7)
34
#define GLCD_RES_TRIS   (TRISCbits.TRISC7)
33
#define GLCD_A0_IO      (PORTCbits.RC1)
35
#define GLCD_A0_IO      (PORTCbits.RC1)
34
#define GLCD_A0_TRIS    (TRISCbits.TRISC1)
36
#define GLCD_A0_TRIS    (TRISCbits.TRISC1)
35
#define GLCD_SCL_IO     (PORTCbits.RC3)
37
#define GLCD_SCL_IO     (PORTCbits.RC3)
36
#define GLCD_SCL_TRIS   (TRISCbits.TRISC3)
38
#define GLCD_SCL_TRIS   (TRISCbits.TRISC3)
37
#define GLCD_SI_IO      (PORTCbits.RC5)
39
#define GLCD_SI_IO      (PORTCbits.RC5)
38
#define GLCD_SI_TRIS    (TRISCbits.TRISC5)
40
#define GLCD_SI_TRIS    (TRISCbits.TRISC5)
39
 
41
 
40
#define GLCD_BAL_IO     (PORTCbits.RC2)
42
#define GLCD_BAL_IO     (PORTCbits.RC2)
41
#define GLCD_BAL_TRIS   (TRISCbits.TRISC2)
43
#define GLCD_BAL_TRIS   (TRISCbits.TRISC2)
42
 
44
 
43
// Rotary, Rotary switch, switch
45
// Rotary, Rotary switch, switch
44
#define ROTARY_A_IO     (PORTBbits.RB4)
46
#define ROTARY_A_IO     (PORTBbits.RB4)
45
#define ROTARY_A_TRIS   (TRISBbits.TRISB4)   // RB0
47
#define ROTARY_A_TRIS   (TRISBbits.TRISB4)   // RB0
46
#define ROTARY_B_IO     (PORTBbits.RB5)
48
#define ROTARY_B_IO     (PORTBbits.RB5)
47
#define ROTARY_B_TRIS   (TRISBbits.TRISB5)
49
#define ROTARY_B_TRIS   (TRISBbits.TRISB5)
48
 
50
 
49
#define ROTARY_SW_IO    (PORTAbits.RA4)
51
#define ROTARY_SW_IO    (PORTAbits.RA4)
50
#define ROTARY_SW_TRIS  (TRISAbits.TRISA4)   // RB1
52
#define ROTARY_SW_TRIS  (TRISAbits.TRISA4)   // RB1
51
#define SW0_IO          (PORTAbits.RA5)
53
#define SW0_IO          (PORTAbits.RA5)
52
#define SW0_TRIS        (TRISAbits.TRISA5)
54
#define SW0_TRIS        (TRISAbits.TRISA5)
53
 
55
 
54
// door
56
// door
55
#define SW1_IO          (PORTAbits.RA2)     // Poll
57
#define SW1_IO          (PORTAbits.RA2)     // Poll
56
#define SW1_TRIS        (TRISAbits.TRISA2)
58
#define SW1_TRIS        (TRISAbits.TRISA2)
57
 
59
 
58
// VREF, temp
60
// VREF, temp
59
#define VREF_IO         (PORTAbits.RA3)
61
#define VREF_IO         (PORTAbits.RA3)
60
#define VREF_TRIS       (TRISAbits.TRISA3)
62
#define VREF_TRIS       (TRISAbits.TRISA3)
61
#define TEMP_IO         (PORTAbits.RA0)
63
#define TEMP_IO         (PORTAbits.RA0)
62
#define TEMP_TRIS       (TRISAbits.TRISA0)
64
#define TEMP_TRIS       (TRISAbits.TRISA0)
63
 
65
 
64
// EE
66
// EE
65
#define EE_CS_IO        (PORTCbits.RC6)
67
#define EE_CS_IO        (PORTCbits.RC6)
66
#define EE_CS_TRIS      (TRISCbits.TRISC6)
68
#define EE_CS_TRIS      (TRISCbits.TRISC6)
67
#define EE_SI_IO        (PORTCbits.RC4)
69
#define EE_SI_IO        (PORTCbits.RC4)
68
#define EE_SI_TRIS      (TRISCbits.TRISC4)
70
#define EE_SI_TRIS      (TRISCbits.TRISC4)
69
 
71
 
70
 
72
 
71
// LCD
73
// LCD
72
/*
74
/*
73
#define LCD_DATA_4_TRIS (PORTCbits.RC0)
75
#define LCD_DATA_4_TRIS (PORTCbits.RC0)
74
#define LCD_DATA_4_IO   (TRISCbits.TRISC0)
76
#define LCD_DATA_4_IO   (TRISCbits.TRISC0)
75
#define LCD_DATA_5_TRIS (PORTCbits.RC1)
77
#define LCD_DATA_5_TRIS (PORTCbits.RC1)
76
#define LCD_DATA_5_IO   (TRISCbits.TRISC1)
78
#define LCD_DATA_5_IO   (TRISCbits.TRISC1)
77
#define LCD_DATA_6_TRIS (PORTCbits.RC2)
79
#define LCD_DATA_6_TRIS (PORTCbits.RC2)
78
#define LCD_DATA_6_IO   (TRISCbits.TRISC2)
80
#define LCD_DATA_6_IO   (TRISCbits.TRISC2)
79
#define LCD_DATA_7_TRIS (PORTCbits.RC3)
81
#define LCD_DATA_7_TRIS (PORTCbits.RC3)
80
#define LCD_DATA_7_IO   (TRISCbits.TRISC3)
82
#define LCD_DATA_7_IO   (TRISCbits.TRISC3)
81
 
83
 
82
#define LCD_RS_TRIS (PORTAbits.RA4)
84
#define LCD_RS_TRIS (PORTAbits.RA4)
83
#define LCD_RS_IO   (TRISAbits.TRISA4)
85
#define LCD_RS_IO   (TRISAbits.TRISA4)
84
#define LCD_EN_TRIS (PORTAbits.RA5)
86
#define LCD_EN_TRIS (PORTAbits.RA5)
85
#define LCD_EN_IO   (TRISAbits.TRISA5)
87
#define LCD_EN_IO   (TRISAbits.TRISA5)
86
 
88
 
87
#define LCD_LINE1 0
89
#define LCD_LINE1 0
88
#define LCD_LINE2 40
90
#define LCD_LINE2 40
89
#define LCD_LINE_LENGTH 24
91
#define LCD_LINE_LENGTH 24
90
*/
92
*/
91
 
93
 
92
#define TEMPERATURE_OUTSIDE 0x0
94
#define TEMPERATURE_OUTSIDE 0x0
93
 
95
 
94
 
96
 
95
 
97
 
96
 
98
 
97
#endif //compiler.h
99
#endif //compiler.h
98
 
100