Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Interfacing with C plus plus-programing communication with microcontrolers (K. Bentley, 2006)

.pdf
Скачиваний:
192
Добавлен:
12.08.2013
Размер:
3.18 Mб
Скачать

Appendix B - Software

C++ Keywords

Operator Precedence

ASCII Character Set

C++ Keywords

asm

private

auto

protected

break

public

case

register

catch

return

char

short

class

signed

const

sizeof

continue

static

default

struct

delete

switch

do

template

double

this

else

throw

enum

try

far

typedef

float

union

for

unsigned

friend

virtual

goto

void

if

volatile

inline

while

int

 

interrupt

 

long

 

near

 

new

 

operator

 

APPENDIX B - SOFTWARE 481

Operator Precedence

The table below shows the precedence of C++ operators. The highest priority is given to the operators on the first row and the lowest priority is given to the operator in the last row. Operators placed on the same row have the same priority. The operators are used from left to right, except for the rows marked with a †. These rows are used from right to left. For example, a=b; is used from right to left. That is, b’s value is assigned to a.

Table B-1 Operator precedence.

Operators

()

[] -> :: .

 

 

 

 

!

~

+

-

++

--

&

*

sizeof

 

new

 

delete

 

.*

->*

 

 

 

 

 

 

 

*

/

%

 

 

 

 

 

 

+

-

 

 

 

 

 

 

 

<<

>>

 

 

 

 

 

 

 

<

<=

>

>=

 

 

 

 

 

==

!=

 

 

 

 

 

 

 

&

 

 

 

 

 

 

 

 

^

 

 

 

 

 

 

 

 

|

 

 

 

 

 

 

 

 

&&

 

 

 

 

 

 

 

 

||

 

 

 

 

 

 

 

 

?:

 

 

 

 

 

 

 

=

*=

/=

%=

+=

-=

&=

^= |= <<= >>=

,

 

 

 

 

 

 

 

 

482 APPENDIX B - SOFTWARE

ASCII Character Set

NUL

DLE

SP

0

@

P

`

p

0x00

0x10

0x20

0x30

0x40

0x50

0x60

0x70

SOH

CD1

!

1

A

Q

a

q

0x01

0x11

0x21

0x31

0x41

0x51

0x61

0X71

STX

DC2

"

2

B

R

b

r

0x02

0x12

0x22

0x32

0x42

0x52

0x62

0x72

ETX

DC3

#

3

C

S

c

s

0x03

0x13

0x23

0x33

0x43

0x53

0x63

0x73

EOT

DC4

$

4

D

T

d

t

0x04

0x14

0x24

0x34

0x44

0x54

0x64

0x74

ENQ

NAK

%

5

E

U

e

u

0x05

0x15

0x25

0x35

0x45

0x55

0x65

0x75

ACK

SYN

&

6

F

V

f

v

0x06

0x16

0x26

0x36

0x46

0x56

0x66

0x76

BEL

ETB

'

7

G

W

g

w

0x07

0x17

0x27

0x37

0x47

0x57

0x67

0x77

BS

CAN

(

8

H

X

h

x

0x08

0x18

0x28

0x38

0x48

0x58

0x68

0x78

HT

EM

)

9

I

Y

i

y

0x09

0x19

0x29

0x39

0x49

0x59

0x69

0x79

LF

SUB

*

:

J

Z

j

z

0x0A

0x1A

0x2A

0x3A

0x4A

0x5A

0x6A

0x7A

VT

ESC

+

;

K

[

k

{

0x0B

0x1B

0x2B

0x3B

0x4B

0x5B

0x6B

0x7B

FF

FS

,

<

L

/

l

|

0x0C

0x1C

0x2C

0x3C

0x4C

0x5C

0x6C

0x7C

CR

GS

-

=

M

]

m

}

0x0D

0x1D

0x2D

0x3D

0x4D

0x5D

0x6D

0x7D

SO

RS

.

>

N

^

n

~

0x0E

0x1E

0x2E

0x3E

0x4E

0x5E

0x6E

0x7E

SI

US

/

?

O

_

o

DEL

0x0F

0x1F

0x2F

0x3F

0x4F

0x5F

0x6F

0x7F

Index

- .................................................

150

--.................................................

150

!

 

! .................................................

150

!=.................................................

150

#

 

# .....................................................

3

#define.....................................

288

#endif .......................................

288

#ifndef.....................................

288

$

 

$ ...................................................

31

%

 

%c ...................................................

49

%d ...................................................

49

%f ...................................................

49

%s ...................................................

49

%X, %x ..........................................

49

&

 

& .........................

161, 163, 186, 368

(

 

( .....................................................

6

)

 

) .....................................................

6

*

 

* .........................................

161, 186

*/.....................................................

7

.

 

.exe............................................

300

.lib............................................

300

.obj............................................

300

/

 

/*.....................................................

7

:

 

:: ..................................................

83

;

 

; ...................................................

79

?

 

?: ................................................

155

\

 

\n ................................................

313

\r ................................................

313

^

 

^ ...................................................

52

^= ...................................................

55

{

 

{ .........................................

9, 45, 79

}

 

} .........................................

9, 45, 79

~

 

~ .................................................

150

 

“ “..............................................

287

+

 

+ .................................................

150

++ ................................................

150

<

 

< .................................................

149

< >................................................

287

<< ....................................................

8

<= ................................................

149

=

 

== ................................................

150

484 INDEX

>

 

 

> .................................................

 

149

->.................................................

 

164

>=.................................................

 

149

0

 

 

0x...................................................

 

31

0x378............................................

 

32

0x379............................................

 

32

0x37A............................................

 

32

8

 

 

8254 .............................................

 

400

A

 

 

abstract objects...............................

 

58

AbstractMotor class......

211, 213

access attributes .......

79, 90, 118, 145

private...................................

 

79

protected......................

 

79, 131

public .....................................

 

79

access specifiers ...................

 

122, 133

private.................................

 

133

protected............................

 

133

public ...................................

 

133

ADC

 

 

dual slope .................................

 

336

flash..........................................

 

340

single slope...............................

 

334

successive approximation

........338

ADC class......................................

 

348

ADC0804 .....................................

 

339

ADConvert() ...........................

 

352

address decoding..........................

 

349

aliasing .........................................

 

345

analog to digital converter...

See ADC

anode..............................................

 

41

aperture interval ...........................

 

341

arrays......................................

 

11, 157

one dimensional .......................

 

158

subscript ...................................

 

158

two dimensional .......................

 

159

B

 

 

back-emf ......................................

 

210

BASE..............................................

 

29

base address .............................

 

27, 32

base class ...............................

 

64, 121

base_adr.exe ..........................

 

46

BASE+1.........................................

 

29

BASE+2.........................................

 

29

bias.................................................

 

43

bifilar winding .............................

 

205

binary .............................................

 

30

binary logic ....................................

 

24

bioskey()................................

 

257

bipolar output...............................

 

114

bit ...................................................

 

26

block ............................................

 

148

body .................................................

 

8

Brake() ....................................

 

214

break .................................

 

155, 157

breakdown voltage.........................

 

42

brushless motor............................

 

199

buffer ...............................

39, 41, 115

byte ................................................

 

26

C

 

 

calibration ....................................

 

324

carriage return................................

 

50

case............................................

 

157

catch .........................................

 

190

cathode...........................................

 

41

central processing unit .........

 

See CPU

ChangeAddress() ...................

 

93

char ................................................

 

16

chip select ....................................

 

349

chopper drive ...............................

 

209

class ...........................................

 

62

class definition.........................

 

62, 79

class hierarchy ...............................

 

64

CMOS............................................

 

25

coding ..........................................

 

274

comments.........................................

 

7

commutator..................................

 

198

compiler ...........................................

 

3

compiler directives.....................

 

3, 45

compound statement ....................

 

148

conceptual objects..........................

 

58

conditional expression .................

 

152

const .........................................

 

368

constant integer expression

..........157

INDEX 485

constructor................................

62, 81

copy....................................

81, 373

default ........................................

81

default ........................................

62

continue ..................................

155

conversion time............................

333

cout................................................

8

CPU..................................................

3

D

 

D25F connector..............................

26

DAC

 

R-2R Ladder.............................

111

summing amplifier ...................

110

DAC0800 .....................................

113

data area .......................................

185

data logging..................................

393

data types .........................................

9

floating point..............................

15

fundamental................................

15

integral .......................................

15

pointer ........................................

15

DC Motors ...................................

198

DCMotor class...................

212, 221

decimal...........................................

30

declaration......................................

89

define .........................................

45

Delay().....................................

412

delete .......................................

186

delimiters..........................................

4

de-referencing ..............................

161

derived classes .............................

121

destructor..................................

62, 82

default ........................................

62

dielectric absorption.....................

336

digital logic ....................................

24

digital to analog converter...

See DAC

diode.......................................

37, 305

double.............................................

16

do-while ....................................

152

driver......................................

41, 319

duty cycle.....................................

224

dynamic binding...........................

215

dynamic memory allocation.161, 185

E

 

early binding ................................

215

editor................................................

2

else ............................................

152

encapsulation .................................

63

encoder.........................................

201

endl................................................

8

enum....................................

228, 307

equality operators.........................

150

equivalent time sampling.............

346

event counting..............................

400

exception handling.......................

189

exclusive-OR ......................

See XOR

executable file..................................

5

exit().......................................

323

F

 

false clause...................................

152

field width................................

50, 98

filter .........................................

53, 55

float ............................................

16

for statement..............................

148

format specifiers ............................

49

forward voltage..............................

42

Forward()................................

214

free store ................................

20, 186

full-scale error..............................

117

functions

 

actual arguments to ....................

10

caller of ......................................

20

calling ..................................

14, 20

const .....................................

370

declaration of .......................

13, 19

default arguments to ................

219

definition of ...............................

12

formal arguments to...................

10

friend...................................

384

in-line.........................................

84

overloading ........................

82, 135

parameters to..............................

10

polymorphic.............................

212

prototype of..........................

14, 45

pure virtual...............................

216

return value of............................

10

syntax of ....................................

13

virtual ................................

233

G

 

gain error......................................

117

486 INDEX

GetADCValue() ......................

356

getch().................................

47, 50

getmaxx()................................

320

getmaxy()................................

320

GetPeriod() ...........................

309

GetSpeed()..............................

214

gotoxy()........................................

314

grapherror().........................

323

grapherrormsg()..................

323

graphresult() ......................

323

H

 

hardware triggered strobe.............

406

header files .......................................

7

heap........................................

20, 186

heatsink ..........................................

37

hexadecimal ...................................

30

I

 

I/O address .....................................

27

I/O stream.......................................

10

I/O streams ...................................

386

IDE.............................................

2, 47

identifiers .............................

9, 16, 17

declaration............................

16, 49

declared and initialised...............

17

if .................................................

152

ifstream ..................................

387

include directory ..............................

7

include files................................

7, 32

include statement .............................

7

incremental expression.................

150

inheritance........................

65, 72, 122

multiple ....................................

211

initgraph() ....................................

323

initializing expression ..................

149

inportb()..................................

47

input impedance ...........................

334

instantiation........................

63, 81, 89

int.................................................

16

Integrated Development

 

Environment.....................

See IDE

integration ....................................

335

interface board

 

power supply..............................

36

interface cable ................................

29

interrupts......................................

401

inversions.......................................

50

inverting input..............................

107

istream ....................................

387

K

 

kbhit() ....................................

178

keywords..........................................

9

L

 

late binding ....................

65, 213, 215

least significant bit...............

See LSB

LED ...............................................

41

characteristic curve ....................

42

LED class....................................

176

library...............................................

4

light emitting diode..............

See LED

line feed .....................................

3, 50

lineto() .........................................

323

linker................................................

5

loader ...............................................

5

logic families .................................

25

logic levels.....................................

24

loop counters................................

149

LSB................................................

30

M

 

macros..........................................

184

main().....................................

6, 45

mains supply ..................................

36

make files.....................................

299

MeasurePeriod() .................

309

member data ............................

62, 78

member functions ....................

62, 78

memory leak ................................

187

microstepping ..............................

210

modules........................................

283

monotonic error ...........................

334

most significant bit .............

See MSB

Motor class ........................

212, 217

moveto() ..................................

323

MSB...............................................

30

multiple file program ...................

282

multiplexer...................................

334

N

 

negative feedback ........................

109

INDEX 487

negative temperature coefficient..

305

new ..............................................

 

186

nibble .............................................

 

31

noise margins .................................

 

24

non-inverting input.......................

 

107

non-linearity.................................

 

117

NULL............................................

 

188

O

 

 

object class...............................

58, 61

object code .......................................

 

4

object file .........................................

 

3

object oriented programming.........

58

Off()..........................................

 

214

offset error....................................

 

117

ofstream ..................................

 

387

open loop......................................

 

225

operand...........................................

 

52

operational amplifier....................

 

106

operator(s)

 

 

address of .................................

 

161

bit-wise.......................................

 

52

indirection ................................

 

161

overloaded assignment.............

 

390

overloading ......................

380, 383

scope resolution .......................

 

138

operators

 

 

overloaded assignment...............

 

81

ostream.....................................

 

387

outportb()................................

 

44

P

 

 

parallel port ....................................

 

24

ParallelPort class ............

76, 99

parameter passing

 

 

by reference..............................

 

367

pass through objects.....................

 

388

pcb..................................................

 

24

PCTimer class ............................

 

409

pointer

 

 

this........................................

 

392

pointers.........................................

 

160

arithmetic .................................

 

167

arrays of ...................................

 

166

base class..................................

 

234

class objects .............................

 

163

constant ....................................

 

164

declaration ...............................

 

162

function....................................

 

170

functions returning...................

 

173

one dimensional arrays ............

 

164

scalars ......................................

 

162

two dimensional arrays ............

 

165

void........................................

 

173

polymorphism........................

 

66, 134

port.................................................

 

24

positive feedback .........................

 

109

power-pack ....................................

 

36

preprocessor.....................................

 

3

printer port .....................................

 

24

printf() ............................

 

47, 313

procedure abstraction...............

 

12, 14

project file....................................

 

299

pseudo-code .........................

 

274, 309

public interface ........................

 

60, 72

pull-up resistor...............................

 

39

pulse frequency modulation

.........200

pulse width modulation......

See PWM

pure virtual functions.....................

 

64

PWM............................................

 

224

Q

 

 

quadrature ....................................

 

201

quantisation..................................

 

333

error .........................................

 

334

level .........................................

 

343

quartz crystals ..............................

 

305

R

 

 

ReadPCTimer() ......................

 

412

ReadPort1().............................

 

95

real objects.....................................

 

58

real time sampling........................

 

346

rectifier...........................................

 

37

reflex measurement......................

 

417

relational operators ......................

 

149

return.........................................

 

19

return value ....................................

 

49

recipient .....................................

 

20

type ..............................................

 

9

Reverse()................................

 

214

RTL..................................................

 

5

Run-time library...................

 

See RTL

488 INDEX

S

 

sample and hold ...................

341, 343

scalar ..............................................

11

schematic diagrams........................

28

segment:offset ..............................

258

sentries .........................................

287

series resistance drive ..................

209

SetSpeed()..............................

214

settling time..................................

117

SignalLevel() ......................

308

signed and unsigned types..............

15

single timeout...............................

405

sink current...........................

109, 113

slew rate .......................................

343

source code.......................................

3

source current...............................

109

source file.........................................

3

speaker .........................................

402

square wave generator..................

406

stack .......................................

20, 186

static binding................................

215

stepper motors

 

bipolar ......................................

205

control of..................................

208

dynamic torque.........................

210

full stepping .............................

202

half stepping.............................

203

holding torque ..........................

210

hybrid .......................................

202

permanent magnet....................

202

pull-in torque............................

210

pull-out torque..........................

210

ramped step rate .......................

210

unipolar ....................................

205

variable reluctance ...................

202

StepperMotor class.......

212, 227

switch .......................................

156

syntax .....................................

4, 8, 83

T

 

text editors........................................

2

thermistor .............................

305, 324

this....................................

174, 392

throw..........................................

190

time base generation ....................

419

timer

 

clock signal ..............................

400

control register.........................

407

count value...............................

401

counter .....................................

400

counting format........................

404

gate signal ................................

401

interrupt ...................................

401

latch register.............................

402

modes of operation ..................

403

port addresses...........................

403

status ........................................

407

Timer 0 ................................

401, 402

Timer 1 ........................................

402

Timer 2 ........................................

402

transformer.....................................

36

transistor transistor logic......

See TTL

tri-state .........................................

339

true clause ....................................

152

true or false ..................................

149

try..............................................

189

TTL................................................

25

type casting ..................................

188

U

 

ULN2803A ....................................

41

unary operators ............................

150

undefined references........................

4

unipolar output.............................

114

unsigned ....................................

15

unsigned char.....................

16, 48

unsigned int .............................

16

V

 

variable names ...............................

16

VCO.............................................

304

VFC .............................................

304

Viewport.......................................

319

virtual ....................................

212

virtual functions.....65, 134, 212, 233

virtual ground.......................

108, 111

void..........................................

9, 48

voltage buffer...............................

115

voltage comparator ......................

109

voltage controlled oscillatorSee VCO

voltage inverter ............................

116

voltage regulator ............................

37

voltage ripple .................................

37