Subversion Repositories HomeAutomation

Rev

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

  1. /*********************************************************************
  2.  *
  3.  *                  Compiler and hardware specific definitions
  4.  *
  5.  *********************************************************************
  6.  * FileName:        Compiler.h
  7.  * Dependencies:    None
  8.  * Processor:       PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F
  9.  * Complier:        Microchip C18 v3.02 or higher
  10.  *                  Microchip C30 v2.01 or higher
  11.  * Company:         Microchip Technology, Inc.
  12.  *
  13.  * Software License Agreement
  14.  *
  15.  * This software is owned by Microchip Technology Inc. ("Microchip")
  16.  * and is supplied to you for use exclusively as described in the
  17.  * associated software agreement.  This software is protected by
  18.  * software and other intellectual property laws.  Any use in
  19.  * violation of the software license may subject the user to criminal
  20.  * sanctions as well as civil liability.  Copyright 2006 Microchip
  21.  * Technology Inc.  All rights reserved.
  22.  *
  23.  * This software is provided "AS IS."  MICROCHIP DISCLAIMS ALL
  24.  * WARRANTIES, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, NOT LIMITED
  25.  * TO MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
  26.  * INFRINGEMENT.  Microchip shall in no event be liable for special,
  27.  * incidental, or consequential damages.
  28.  *
  29.  *
  30.  * Author               Date    Comment
  31.  *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  32.  * Nilesh Rajbharti     11/14/01 Original        (Rev 1.0)
  33.  * Nilesh Rajbharti     2/9/02  Cleanup
  34.  * Nilesh Rajbharti     5/22/02 Rev 2.0 (See version.log for detail)
  35.  * Howard Schlunder     11/30/04 Added some more defines
  36.  * Howard Schlunder     6/14/06 Added hardware definitions
  37.  * Howard Schlunder     8/10/06 Added PICDEMNET, PIC18F97J60_TEST_BOARD, FS_USB hardware definitions
  38.  ********************************************************************/
  39. #ifndef COMPILER_H
  40. #define COMPILER_H
  41.  
  42. #define APP_VERSION 0x0002
  43.  
  44. #include <p18cxxx.h>
  45. #define CLOCK_FREQ      (40000000)      // Hz
  46. #define INSTR_FREQ          (CLOCK_FREQ/4)
  47.  
  48.     // I/O pins
  49.     #define LED0_TRIS       (TRISCbits.TRISC0)
  50.     #define LED0_IO         (PORTCbits.RC0)
  51.     #define LED1_TRIS       (TRISCbits.TRISC1)
  52.     #define LED1_IO         (PORTCbits.RC1)
  53.  
  54.    
  55.     #define VAR_LED1_HUMAN "LED1"
  56.     #define VAR_LED1_STR "l"
  57.     #define VAR_LED1 VAR_LED1_STR[0]
  58.  
  59.     #define BUTTON0_TRIS    (TRISBbits.TRISB1)
  60.     #define BUTTON0_IO      (PORTBbits.RB1)
  61.    
  62.     // ENC28J60 I/O pins
  63.     #define ENC_RST_TRIS    (TRISBbits.TRISB5)  // Not connected by default
  64.     #define ENC_RST_IO      (LATBbits.LATB5)
  65.     #define ENC_CS_TRIS     (TRISBbits.TRISB3)
  66.     #define ENC_CS_IO       (LATBbits.LATB3)
  67.     #define ENC_SCK_TRIS    (TRISCbits.TRISC3)
  68.     #define ENC_SDI_TRIS    (TRISCbits.TRISC4)
  69.     #define ENC_SDO_TRIS    (TRISCbits.TRISC5)
  70.     #define ENC_SPI_IF      (PIR1bits.SSPIF)
  71.     #define ENC_SSPBUF      (SSPBUF)
  72.     #define ENC_SPISTAT     (SSPSTAT)
  73.     #define ENC_SPISTATbits (SSPSTATbits)
  74.     #define ENC_SPICON1     (SSPCON1)
  75.     #define ENC_SPICON1bits (SSPCON1bits)
  76.     #define ENC_SPICON2     (SSPCON2)
  77.  
  78.     // 25LC256 I/O pins
  79.     #define EEPROM_CS_TRIS      (TRISBbits.TRISB4)
  80.     #define EEPROM_CS_IO        (LATBbits.LATB4)
  81.     #define EEPROM_SCK_TRIS     (TRISCbits.TRISC3)
  82.     #define EEPROM_SDI_TRIS     (TRISCbits.TRISC4)
  83.     #define EEPROM_SDO_TRIS     (TRISCbits.TRISC5)
  84.     #define EEPROM_SPI_IF       (PIR1bits.SSPIF)
  85.     #define EEPROM_SSPBUF       (SSPBUF)
  86.     #define EEPROM_SPICON1      (SSPCON1)
  87.     #define EEPROM_SPICON1bits  (SSPCON1bits)
  88.     #define EEPROM_SPICON2      (SSPCON2)
  89.     #define EEPROM_SPISTAT      (SSPSTAT)
  90.     #define EEPROM_SPISTATbits  (SSPSTATbits)
  91.  
  92. #include <stdio.h>
  93. #include <stdlib.h>
  94. #include <string.h>
  95.  
  96.  
  97. #define ROM                     rom
  98. #define strcpypgm2ram(a, b)     strcpypgm2ram(a,(far rom char*)b)
  99.  
  100.     #define __attribute__(a)
  101.     #define BusyUART()              BusyUSART()
  102.     #define CloseUART()             CloseUSART()
  103.     #define ConfigIntUART(a)        ConfigIntUSART(a)
  104.     #define DataRdyUART()           DataRdyUSART()
  105.     #define OpenUART(a,b,c)         OpenUSART(a,b,c)
  106.     #define ReadUART()              ReadUSART()
  107.     #define WriteUART(a)            WriteUSART(a)
  108.     #define getsUART(a,b,c)         getsUSART(b,a)
  109.     #define putsUART(a)             putsUSART(a)
  110.     #define getcUART()              ReadUSART()
  111.     #define putcUART(a)             WriteUSART(a)
  112.     #define putrsUART(a)            putrsUSART((far rom char*)a)
  113.  
  114. #endif
  115.