1 //---------------------------------------------------------------------------
2 // Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved.
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a
5 // copy of this software and associated documentation files (the "Software"),
6 // to deal in the Software without restriction, including without limitation
7 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 // and/or sell copies of the Software, and to permit persons to whom the
9 // Software is furnished to do so, subject to the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 // IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES
18 // OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 // OTHER DEALINGS IN THE SOFTWARE.
21 //
22 // Except as contained in this notice, the name of Dallas Semiconductor
23 // shall not be used except as stated in the Dallas Semiconductor
24 // Branding Policy.
25 //---------------------------------------------------------------------------
26 
27 #ifndef SER550_H
28 #define SER550_H
29 
30 #ifdef __C51__ //Keil's C51 compiler
31    // for nop instruction
32    #include <intrins.h>
33    // sfr/sbit definitions
34    #include <reg550.h>
35 #endif
36 
37 //which serial port to use for console I/O
38 #ifndef STDOUT_P
39    #define STDOUT_P 1
40    #define stdout 1
41 #endif
42 
43 //which serial port to use for 1-Wire I/O w/ ds2480-based adapter
44 #ifndef ONEWIRE_P
45    #define ONEWIRE_P 0
46 #endif
47 
48 // Port for general 1Wire communication using micro's port pin.
49 // WARNING: See appnote 132 to select an appropriate port pin and
50 //          allow for appropriate protection of the pin.
51 #ifndef OW_PORT
52    #define OW_PORT P3_4
53 #endif
54 
55 /* Timer reload values for baud rates:
56       TH1 = 256 - ( (2^SMOD/32) * ( xtal / T1DIV * baud) ) */
57 /* NOTE: mileage may vary on different platforms.
58          With any problems, please check these values first */
59 #define BAUD9600_TIMER_RELOAD_VALUE (256-((2*33000000)/(32L*4*9600)))
60 #define BAUD19200_TIMER_RELOAD_VALUE (256-((2*33000000)/(32L*4*19200)))
61 #define BAUD57600_TIMER_RELOAD_VALUE (256-((2*33000000)/(32L*4*57600)))
62 //not supported at 33 mhz
63 #define BAUD115200_TIMER_RELOAD_VALUE (256-((2*33000000)/(32L*4*115200)))
64 
65 /* Should serial I/O be interrupt driven? */
66 #ifndef USE_SERIAL_INTERRUPTS
67 #define USE_SERIAL_INTERRUPTS 1
68 #endif
69 
70 /* Should both ports run off timer 1? */
71 #ifndef USE_TIMER2_FOR_SERIAL0
72 #define USE_TIMER2_FOR_SERIAL0 0
73 #endif
74 
75 #ifdef USE_SERIAL_INTERRUPTS
76 #define SERIAL_BUFFER_SIZE 256 //DONT CHANGE! Currently breaks code in ds520lnk
77 #endif
78 
79 #endif// SER550_H