root / TL16C754_training.X / macros_def.h @ master
Historique | Voir | Annoter | Télécharger (2,876 ko)
1 |
/* Microchip Technology Inc. and its subsidiaries. You may use this software
|
---|---|
2 |
* and any derivatives exclusively with Microchip products.
|
3 |
*
|
4 |
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
|
5 |
* EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
|
6 |
* WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
|
7 |
* PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
|
8 |
* WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
|
9 |
*
|
10 |
* IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
|
11 |
* INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
|
12 |
* WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
|
13 |
* BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
|
14 |
* FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS
|
15 |
* IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF
|
16 |
* ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
17 |
*
|
18 |
* MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
|
19 |
* TERMS.
|
20 |
*/
|
21 |
|
22 |
/*
|
23 |
* File:
|
24 |
* Author:
|
25 |
* Comments:
|
26 |
* Revision history:
|
27 |
*/
|
28 |
|
29 |
// This is a guard condition so that contents of this file are not included
|
30 |
// more than once.
|
31 |
#ifndef MACROS_DEF_HEADER_H
|
32 |
#define MACROS_DEF_HEADER_H
|
33 |
|
34 |
#include <xc.h> // include processor files - each processor file is guarded. |
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
//Data pins
|
41 |
#define DATAWRITE(x) PORTD.OUT = x
|
42 |
#define DATADIR(x) PORTD.DIR = x
|
43 |
#define DATAREAD PORTD.IN
|
44 |
|
45 |
//Address pins
|
46 |
#define ADDRWRITE(x) PORTE.OUT = x
|
47 |
#define ADDR_ENABLE PORTE.DIR |= 0x07 |
48 |
|
49 |
|
50 |
//Controls pins
|
51 |
#define ENABLE_POW_SUPPLY_PIN PORTF.DIR |= 0x01 |
52 |
#define ENABLE_WR_RD_PINS PORTB.DIR |= 0x30 |
53 |
#define ENABLE_CS_PINS PORTB.DIR |= 0x0F |
54 |
#define ENABLE_RESET_PIN PORTE.DIR |= 0x08 |
55 |
#define POWER_ON PORTF.OUT |= 0x01 |
56 |
#define POWER_OFF PORTF.OUT &= ~(0x01) |
57 |
#define SETRST PORTE.OUT |= 0x08 |
58 |
#define SETWR PORTB.OUT |= 0x10 |
59 |
#define SETRD PORTB.OUT |= 0x20 |
60 |
#define SETCSA PORTB.OUT |= 0x01 |
61 |
#define SETCSB PORTB.OUT |= 0x02 |
62 |
#define SETCSC PORTB.OUT |= 0x04 |
63 |
#define SETCSD PORTB.OUT |= 0x08 |
64 |
#define CLRRST PORTE.OUT |= ~(0x08) |
65 |
#define CLRWR PORTB.OUT &= ~(0x10) |
66 |
#define CLRRD PORTB.OUT &= ~(0x20) |
67 |
#define CLRCSA PORTB.OUT &= ~(0x01) |
68 |
#define CLRCSB PORTB.OUT &= ~(0x02) |
69 |
#define CLRCSC PORTB.OUT &= ~(0x04) |
70 |
#define CLRCSD PORTB.OUT &= ~(0x08) |
71 |
|
72 |
|
73 |
|
74 |
//////////////////////////////////////////////////
|
75 |
//For uC
|
76 |
enum prescaler_index {
|
77 |
DIV1 = 0,
|
78 |
DIV2, |
79 |
DIV4, |
80 |
DIV8, |
81 |
DIV16, |
82 |
DIV64, |
83 |
DIV256, |
84 |
DIV1024, |
85 |
}; |
86 |
|
87 |
|
88 |
|
89 |
|
90 |
#endif /* XC_HEADER_TEMPLATE_H */ |
91 |
|