Subversion Repositories HomeAutomation

Rev

Rev 97 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /*********************************************************************
  2.  *
  3.  *                  Compiler specific
  4.  *
  5.  *********************************************************************
  6.  * FileName:        $HeadURL: https://svn.auml.se/svn/HomeAutomation/branches/modules/EmbeddedSoftware/PIC/canToSerial/Include/compiler.h $
  7.  * Last changed:    $LastChangedDate: 2006-11-14 21:22:17 +0100 (Tue, 14 Nov 2006) $
  8.  * By:              $LastChangedBy: johboh $
  9.  * Revision:        $Revision: 97 $
  10.  ********************************************************************/
  11.  
  12. #ifndef COMPILER_H
  13. #define COMPILER_H
  14.  
  15. #include <p18cxxx.h>
  16. #define CLOCK_FREQ      (40000000)      // Hz
  17. #define INSTR_FREQ          (CLOCK_FREQ/4)
  18. #define CLOCK_FOSC      (40)      // MHz
  19.  
  20. #define UART_BAUD_RATE       (115200)     // bps
  21. #define HIGH_BRG
  22.  
  23. #ifdef HIGH_BRG
  24.     #define SPBRG_VAL   ( ((CLOCK_FREQ/UART_BAUD_RATE)/4) - 1)
  25.     #define SPBRGH_VAL  0
  26. #else
  27.     #define SPBRG_VAL   ( ((INSTR_FREQ/UART_BAUD_RATE)/16) - 1)
  28. #endif
  29.  
  30.  
  31. #if (SPBRG_VAL > 255)
  32.     #error "Calculated SPBRG value is out of range for currnet CLOCK_FREQ."
  33. #endif
  34.  
  35. #define LED0_TRIS       (TRISCbits.TRISC1)
  36. #define LED0_IO         (PORTCbits.RC1)
  37.  
  38. #define UART_START_BYTE 253
  39. #define UART_END_BYTE 250
  40.  
  41. #define UART_READ_TIMEOUT 30000
  42.  
  43. #endif //compiler.h
  44.