Subversion Repositories HomeAutomation

Rev

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

Rev 24 Rev 25
-
 
1
/*********************************************************************
-
 
2
 *
-
 
3
 *                  Compiler specific
-
 
4
 *
-
 
5
 *********************************************************************
-
 
6
 * FileName:        compiler.h
-
 
7
 *
-
 
8
 * Author               Date    Comment
-
 
9
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
 
10
 * Johan Böhlin     21-10-06    Original        (Rev 1.0)
-
 
11
 ********************************************************************/
-
 
12
 
1
#ifndef COMPILER_H
13
#ifndef COMPILER_H
2
#define COMPILER_H
14
#define COMPILER_H
3
 
15
 
4
#include <p18cxxx.h>
16
#include <p18cxxx.h>
5
#define CLOCK_FREQ      (40000000)      // Hz
17
#define CLOCK_FREQ      (40000000)      // Hz
6
#define INSTR_FREQ          (CLOCK_FREQ/4)
18
#define INSTR_FREQ          (CLOCK_FREQ/4)
7
#define CLOCK_FOSC      (40)      // MHz
19
#define CLOCK_FOSC      (40)      // MHz
8
 
20
 
9
#define UART_BAUD_RATE       (19200)     // bps
21
#define UART_BAUD_RATE       (19200)     // bps
10
 
22
 
11
#define SPBRG_VAL   ( ((INSTR_FREQ/UART_BAUD_RATE)/16) - 1)
23
#define SPBRG_VAL   ( ((INSTR_FREQ/UART_BAUD_RATE)/16) - 1)
12
 
24
 
13
#if (SPBRG_VAL > 255)
25
#if (SPBRG_VAL > 255)
14
    #error "Calculated SPBRG value is out of range for currnet CLOCK_FREQ."
26
    #error "Calculated SPBRG value is out of range for currnet CLOCK_FREQ."
15
#endif
27
#endif
16
 
28
 
17
#define LED0_TRIS       (TRISCbits.TRISC1)
29
#define LED0_TRIS       (TRISCbits.TRISC1)
18
#define LED0_IO         (PORTCbits.RC1)
30
#define LED0_IO         (PORTCbits.RC1)
19
 
31
 
20
#endif //compiler.h
32
#endif //compiler.h
21
 
33