1 |
588 |
jeremybenn |
/** ###################################################################
|
2 |
|
|
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
|
3 |
|
|
** Filename : COM0.H
|
4 |
|
|
** Project : RTOSDemo
|
5 |
|
|
** Processor : MC9S12DP256BCPV
|
6 |
|
|
** Beantype : AsynchroSerial
|
7 |
|
|
** Version : Bean 02.231, Driver 01.08, CPU db: 2.87.283
|
8 |
|
|
** Compiler : Metrowerks HC12 C Compiler
|
9 |
|
|
** Date/Time : 19/06/2005, 15:07
|
10 |
|
|
** Abstract :
|
11 |
|
|
** This bean "AsynchroSerial" implements an asynchronous serial
|
12 |
|
|
** communication. The bean supports different settings of
|
13 |
|
|
** parity, word width, stop-bit and communication speed,
|
14 |
|
|
** user can select interrupt or polling handler.
|
15 |
|
|
** Communication speed can be changed also in runtime.
|
16 |
|
|
** The bean requires one on-chip asynchronous serial channel.
|
17 |
|
|
** Settings :
|
18 |
|
|
** Serial channel : SCI0
|
19 |
|
|
**
|
20 |
|
|
** Protocol
|
21 |
|
|
** Init baud rate : 38400baud
|
22 |
|
|
** Width : 8 bits
|
23 |
|
|
** Stop bits : 1
|
24 |
|
|
** Parity : none
|
25 |
|
|
** Breaks : Disabled
|
26 |
|
|
**
|
27 |
|
|
** Registers
|
28 |
|
|
** Input buffer : SCI0DRL [207]
|
29 |
|
|
** Output buffer : SCI0DRL [207]
|
30 |
|
|
** Control register : SCI0CR1 [202]
|
31 |
|
|
** Mode register : SCI0CR2 [203]
|
32 |
|
|
** Baud setting reg. : SCI0BD [200]
|
33 |
|
|
** Special register : SCI0SR1 [204]
|
34 |
|
|
**
|
35 |
|
|
** Input interrupt
|
36 |
|
|
** Vector name : INT_SCI0
|
37 |
|
|
** Priority : 1
|
38 |
|
|
**
|
39 |
|
|
** Output interrupt
|
40 |
|
|
** Vector name : INT_SCI0
|
41 |
|
|
** Priority : 1
|
42 |
|
|
**
|
43 |
|
|
** Used pins :
|
44 |
|
|
** ----------------------------------------------------
|
45 |
|
|
** Function | On package | Name
|
46 |
|
|
** ----------------------------------------------------
|
47 |
|
|
** Input | 89 | PS0_RxD0
|
48 |
|
|
** Output | 90 | PS1_TxD0
|
49 |
|
|
** ----------------------------------------------------
|
50 |
|
|
**
|
51 |
|
|
**
|
52 |
|
|
** Used baud modes :
|
53 |
|
|
** ----------------------------------------------------
|
54 |
|
|
** No. | Mode ID | Baud rate
|
55 |
|
|
** ----------------------------------------------------
|
56 |
|
|
** 0 | Bm_38400baud | 38400baud
|
57 |
|
|
** 1 | Bm_19200baud | 19200baud
|
58 |
|
|
** 2 | Bm_9600baud | 9600baud
|
59 |
|
|
** 3 | Bm_4800baud | 4800baud
|
60 |
|
|
** ----------------------------------------------------
|
61 |
|
|
** Contents :
|
62 |
|
|
** SetBaudRateMode - byte COM0_SetBaudRateMode(byte Mod);
|
63 |
|
|
**
|
64 |
|
|
** (c) Copyright UNIS, spol. s r.o. 1997-2002
|
65 |
|
|
** UNIS, spol. s r.o.
|
66 |
|
|
** Jundrovska 33
|
67 |
|
|
** 624 00 Brno
|
68 |
|
|
** Czech Republic
|
69 |
|
|
** http : www.processorexpert.com
|
70 |
|
|
** mail : info@processorexpert.com
|
71 |
|
|
** ###################################################################*/
|
72 |
|
|
|
73 |
|
|
#ifndef __COM0
|
74 |
|
|
#define __COM0
|
75 |
|
|
|
76 |
|
|
/* MODULE COM0. */
|
77 |
|
|
|
78 |
|
|
#include "Cpu.h"
|
79 |
|
|
|
80 |
|
|
#define COM0_Bm_38400baud 0 /* Constant for switch to mode 0 */
|
81 |
|
|
#define COM0_Bm_19200baud 1 /* Constant for switch to mode 1 */
|
82 |
|
|
#define COM0_Bm_9600baud 2 /* Constant for switch to mode 2 */
|
83 |
|
|
#define COM0_Bm_4800baud 3 /* Constant for switch to mode 3 */
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
#ifndef __BWUserType_tItem
|
88 |
|
|
#define __BWUserType_tItem
|
89 |
|
|
typedef struct { /* Item of the index table for possible baudrates */
|
90 |
|
|
word div; /* divisior */
|
91 |
|
|
byte val; /* values of the prescalers */
|
92 |
|
|
} tItem;
|
93 |
|
|
#endif
|
94 |
|
|
#ifndef __BWUserType_COM0_TError
|
95 |
|
|
#define __BWUserType_COM0_TError
|
96 |
|
|
typedef union {
|
97 |
|
|
byte err;
|
98 |
|
|
struct {
|
99 |
|
|
bool OverRun : 1; /* OverRun error flag */
|
100 |
|
|
bool Framing : 1; /* Framing error flag */
|
101 |
|
|
bool Parity : 1; /* Parity error flag */
|
102 |
|
|
bool RxBufOvf : 1; /* Rx buffer full error flag */
|
103 |
|
|
bool Noise : 1; /* Noise error */
|
104 |
|
|
bool Break : 1; /* Break detect */
|
105 |
|
|
bool Idle : 1; /* Idle characted */
|
106 |
|
|
}errName;
|
107 |
|
|
} COM0_TError;
|
108 |
|
|
#endif
|
109 |
|
|
#ifndef __BWUserType_TDirection
|
110 |
|
|
#define __BWUserType_TDirection
|
111 |
|
|
typedef enum { /* */
|
112 |
|
|
TXD_INPUT,
|
113 |
|
|
TXD_OUTPUT
|
114 |
|
|
} TDirection;
|
115 |
|
|
#endif
|
116 |
|
|
|
117 |
|
|
#ifndef __BWUserType_COM0_TComData
|
118 |
|
|
#define __BWUserType_COM0_TComData
|
119 |
|
|
typedef byte COM0_TComData ; /* User type for communication. Size of this type depends on the communication data witdh. */
|
120 |
|
|
#endif
|
121 |
|
|
|
122 |
|
|
#pragma CODE_SEG COM0_CODE /* Code section for this module. */
|
123 |
|
|
|
124 |
|
|
byte COM0_SetBaudRateMode(byte Mod);
|
125 |
|
|
/*
|
126 |
|
|
** ===================================================================
|
127 |
|
|
** Method : COM0_SetBaudRateMode (bean AsynchroSerial)
|
128 |
|
|
**
|
129 |
|
|
** Description :
|
130 |
|
|
** This method changes the channel communication speed (baud
|
131 |
|
|
** rate). This method can be used only if you specify a list
|
132 |
|
|
** of possible period settings at design time (see
|
133 |
|
|
** dialog box> - Runtime setting - from a list of values).
|
134 |
|
|
** Each of these settings constitutes a mode and Processor
|
135 |
|
|
** Expert^[TM] assigns them a mode identifier. The prescaler
|
136 |
|
|
** and compare values corresponding to each mode are
|
137 |
|
|
** calculated at design time. You may switch modes at
|
138 |
|
|
** runtime by referring only to a mode identifier. No
|
139 |
|
|
** run-time calculations are performed, all the calculations
|
140 |
|
|
** are performed at design time.
|
141 |
|
|
** Parameters :
|
142 |
|
|
** NAME - DESCRIPTION
|
143 |
|
|
** Mod - Timing mode to set
|
144 |
|
|
** Returns :
|
145 |
|
|
** --- - Error code, possible codes:
|
146 |
|
|
** ERR_OK - OK
|
147 |
|
|
** ERR_SPEED - This device does not work in
|
148 |
|
|
** the active speed mode
|
149 |
|
|
** ===================================================================
|
150 |
|
|
*/
|
151 |
|
|
|
152 |
|
|
#pragma CODE_SEG __NEAR_SEG NON_BANKED /* Interrupt section for this module. Placement will be in NON_BANKED area. */
|
153 |
|
|
__interrupt void COM0_Interrupt(void);
|
154 |
|
|
#pragma CODE_SEG COM0_CODE /* Code section for this module. */
|
155 |
|
|
/*
|
156 |
|
|
** ===================================================================
|
157 |
|
|
** Method : COM0_Interrupt (bean AsynchroSerial)
|
158 |
|
|
**
|
159 |
|
|
** Description :
|
160 |
|
|
** This method is internal. It is used by Processor Expert
|
161 |
|
|
** only.
|
162 |
|
|
** ===================================================================
|
163 |
|
|
*/
|
164 |
|
|
|
165 |
|
|
|
166 |
|
|
void COM0_Init(void);
|
167 |
|
|
/*
|
168 |
|
|
** ===================================================================
|
169 |
|
|
** Method : COM0_Init (bean AsynchroSerial)
|
170 |
|
|
**
|
171 |
|
|
** Description :
|
172 |
|
|
** This method is internal. It is used by Processor Expert
|
173 |
|
|
** only.
|
174 |
|
|
** ===================================================================
|
175 |
|
|
*/
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
#pragma CODE_SEG DEFAULT /* Change code section to DEFAULT. */
|
179 |
|
|
|
180 |
|
|
/* END COM0. */
|
181 |
|
|
|
182 |
|
|
/*
|
183 |
|
|
** ###################################################################
|
184 |
|
|
**
|
185 |
|
|
** This file was created by UNIS Processor Expert 03.33 for
|
186 |
|
|
** the Motorola HCS12 series of microcontrollers.
|
187 |
|
|
**
|
188 |
|
|
** ###################################################################
|
189 |
|
|
*/
|
190 |
|
|
|
191 |
|
|
#endif /* ifndef __COM0 */
|