كتاب Make: AVR Programming - Learning to Write Software for Hardware
منتدى هندسة الإنتاج والتصميم الميكانيكى
بسم الله الرحمن الرحيم

أهلا وسهلاً بك زائرنا الكريم
نتمنى أن تقضوا معنا أفضل الأوقات
وتسعدونا بالأراء والمساهمات
إذا كنت أحد أعضائنا يرجى تسجيل الدخول
أو وإذا كانت هذة زيارتك الأولى للمنتدى فنتشرف بإنضمامك لأسرتنا
وهذا شرح لطريقة التسجيل فى المنتدى بالفيديو :
http://www.eng2010.yoo7.com/t5785-topic
وشرح لطريقة التنزيل من المنتدى بالفيديو:
http://www.eng2010.yoo7.com/t2065-topic
إذا واجهتك مشاكل فى التسجيل أو تفعيل حسابك
وإذا نسيت بيانات الدخول للمنتدى
يرجى مراسلتنا على البريد الإلكترونى التالى :

Deabs2010@yahoo.com


-----------------------------------
-Warning-

This website uses cookies
We inform you that this site uses own, technical and third parties cookies to make sure our web page is user-friendly and to guarantee a high functionality of the webpage.
By continuing to browse this website, you declare to accept the use of cookies.
منتدى هندسة الإنتاج والتصميم الميكانيكى
بسم الله الرحمن الرحيم

أهلا وسهلاً بك زائرنا الكريم
نتمنى أن تقضوا معنا أفضل الأوقات
وتسعدونا بالأراء والمساهمات
إذا كنت أحد أعضائنا يرجى تسجيل الدخول
أو وإذا كانت هذة زيارتك الأولى للمنتدى فنتشرف بإنضمامك لأسرتنا
وهذا شرح لطريقة التسجيل فى المنتدى بالفيديو :
http://www.eng2010.yoo7.com/t5785-topic
وشرح لطريقة التنزيل من المنتدى بالفيديو:
http://www.eng2010.yoo7.com/t2065-topic
إذا واجهتك مشاكل فى التسجيل أو تفعيل حسابك
وإذا نسيت بيانات الدخول للمنتدى
يرجى مراسلتنا على البريد الإلكترونى التالى :

Deabs2010@yahoo.com


-----------------------------------
-Warning-

This website uses cookies
We inform you that this site uses own, technical and third parties cookies to make sure our web page is user-friendly and to guarantee a high functionality of the webpage.
By continuing to browse this website, you declare to accept the use of cookies.



 
الرئيسيةالبوابةأحدث الصورالتسجيلدخولحملة فيد واستفيدجروب المنتدى

شاطر
 

 كتاب Make: AVR Programming - Learning to Write Software for Hardware

اذهب الى الأسفل 
كاتب الموضوعرسالة
Admin
مدير المنتدى
مدير المنتدى
Admin

عدد المساهمات : 18717
التقييم : 34685
تاريخ التسجيل : 01/07/2009
الدولة : مصر
العمل : مدير منتدى هندسة الإنتاج والتصميم الميكانيكى

كتاب  Make: AVR Programming - Learning to Write Software for Hardware  Empty
مُساهمةموضوع: كتاب Make: AVR Programming - Learning to Write Software for Hardware    كتاب  Make: AVR Programming - Learning to Write Software for Hardware  Emptyالإثنين 04 مارس 2024, 11:48 am

أخواني في الله
أحضرت لكم كتاب
Make: AVR Programming - Learning to Write Software for Hardware
Elliot Williams  

كتاب  Make: AVR Programming - Learning to Write Software for Hardware  M_a_v_10
و المحتوى كما يلي :

Table of Contents
The Arduino: Hardware or Software? Both! . 23
The Arduino Is an AVR . 23
The Arduino Is an AVR Programmer 25
Other Hardware Programmers . 28
Flash Programmers I Have Known and Loved . 28
Getting Started: Blinking LEDs . 29
Hookup . 30
ISP Headers . 33
AVRDUDE . 35
Configuring Your Makefile . 38
Flash 40
Troubleshooting . 40
3. Digital Output . 43
blinkLED Redux 44
The Structure of AVR C Code . 45
Hardware Registers 46
blinkLED Summary 49
POV Toy . 49
Building the Circuit 50
Pretty Patterns: The POV Toy Code . 54
Experiment! . 56
4. Bit Twiddling 59
Working Through the Code: Cylon Eyes . 60
Bit Twiddling and Cylon Eyes . 61
Bit Shifting 62
Advanced Bit Twiddling: Above and Beyond Cylon Eyes . 64
Setting Bits with OR . 67
Toggling Bits with XOR . 69
Clearing a Bit with AND and NOT . 70
Showing Off . 71
Summary 75
5. Serial I/O 77
Serial Communication . 77
Implementing Serial Communication on the AVR: Loopback Project 81
Setup: Configuring the AVR 81
Setup: Your Computer . 83
Setup: USB-Serial Adapter . 83
Putting It All Together: Test Out Your Loopback . 86
Troubleshooting Serial Connections 87
Configuring USART: The Nitty-Gritty Details 88
AVR Square-Wave Organ . 95
Making Music with Your Micro . 96
iv Make: AVR ProgrammingThe Organ Library . 98
The Code 99
Extra Goodies 102
Summary 103
6. Digital Input 105
Pushbuttons, Switches, Etc 105
Configuring Input: DDRs, PORTs, and PINs . 108
Interpreting Button Presses . 109
Changing State . 112
Debouncing . 113
Debounce Example 115
AVR Music Box . 117
The Code 117
Boss Button 119
Desktop-side Scripting . 120
Extensions . 124
7. Analog-to-Digital Conversion I . 125
ADC Hardware Overview . 126
Light Meter 129
The Circuit . 129
The Code 135
ADC Initialization . 137
Extensions . 139
Slowscope . 140
The AVR Code 141
The Desktop Code 143
Synergies 145
AVR Night Light and the Multiplexer 145
Multiplexing . 145
Setting the Mux Bits 146
The Circuit . 148
The Code 148
Summary 150
Part II. Intermediate AVR
8. Hardware Interrupts . 153
External Interrupts 101: Real-time Button Pressing Examples . 155
External Interrupt 0 Example 156
Pin-Change Interrupt Example 161
Capacitive Sensor 164
The Sensor . 165
Table of Contents vThe Code 168
Global, Volatile Variables 170
Debugging the Circuit 173
9. Introduction to the Timer/Counter Hardware 175
Timer/Counters: Why and How? . 175
Test Your Reaction Time 178
Using Timer 0 for a Better 8-Bit Organ . 182
AM Radio 186
The Circuit . 188
CPU Speed . 189
AM Radio: The Code 190
Summary 196
10. Pulse-Width Modulation . 199
Bright and Dim LEDs: PWM . 200
Brute-Force PWM Demo 202
Timers PWM Demo . 204
Initializing Timers for PWM Mode . 206
PWM on Any Pin 208
PWM on Any Pin Demo . 209
Closing: Alternatives to PWM and a Timer Checklist 211
11. Driving Servo Motors 215
Servos . 216
The Secret Life of Servos 217
The Circuit . 218
The Code 219
Servo Sundial 223
The Build . 224
Ready the Lasers! . 227
The Code 229
Servo Sundial Calibration . 236
12. Analog-to-Digital Conversion II 243
Voltage Meter 244
The Circuit . 245
The Code 248
The Footstep Detector 252
The Circuit . 253
The Theory . 258
Exponentially Weighted Moving Averages 259
The Code 262
vi Make: AVR ProgrammingSummary 266
Part III. Advanced AVR Topics
13. Advanced PWM Tricks 269
Direct-Digital Synthesis . 270
Making a Sine Wave 274
Next Steps: Mixing and Volume . 277
Mixing . 277
Dynamic Volume Control . 280
Polling USART 283
ADSR Envelope . 283
Auxiliary Files 284
14. Switches . 287
Controlling Big Loads: Switches . 288
Bipolar-Junction Transistors 290
MOSFETs . 291
Power MOSFETs 293
Relays 294
Triacs and SSRs . 295
Switches: Summary 296
DC Motors . 297
15. Advanced Motors 305
Going in Reverse: H-Bridges 306
Code: Taking Your H-Bridge Out for a Spin . 309
Experts-Only H-Bridge 312
PWM and the H-Bridge . 313
Drive Modes: Sign-Magnitude 314
Drive Modes: Locked Anti-phase 314
Drive Modes: Comparison 315
Stepper Motors 318
Kinds of Stepper Motors 319
Full Stepping and Half Stepping 320
Identification of Stepper Motor Wires . 323
Too Many Wires! 323
Dual H-Bridge Chips: The SN754410 . 325
The Code 327
Acceleration Control 331
Microstepping . 334
16. SPI . 337
How SPI Works . 338
Table of Contents viiBit Trading Example 340
Shift Registers 340
EEPROM External Memory 343
External Memory . 344
SPI Demo Hookup 347
SPI Demo Code . 348
SPI EEPROM Library Header . 350
SPI EEPROM Library C Code . 352
initSPI 354
SPI_tradeByte 355
Convenience Functions . 356
Summary 357
17. I2C . 359
How I2C Works . 360
I2C Demo Hookup 364
I2C Demo Library . 365
I2C Thermometer Demo 369
SPI and I2C Data Logger 371
Pointers in EEPROM 375
The UART Serial Menu 376
The Logger’s Event Loop 377
18. Using Flash Program Memory 379
Using Flash Program Memory . 379
Memory Addresses . 381
The Address-Of Operator: & . 382
Pointers 385
Pointers in Brief 385
Pointers as Arguments to Functions . 388
Summary 392
Optional: Dereferencing Pointers . 393
Talking Voltmeter 394
PROGMEM Data Structures and the Header File . 395
Sound Playback and Voltage Reading: The .c File 400
Generating the Audio Data . 404
Differential Pulse-Code Modulation . 404
Encoding Two-bit DPCM 405
Encoding DPCM: wave2DPCM.py . 408
19. EEPROM . 413
Using EEPROM . 414
Storing in Memory . 414
Reading from Memory . 419
Saving and Loading EEPROM . 422
viii Make: AVR ProgrammingOrganizing Data in EEPROM 423
Project: Vigenère Cipher Encoder/Decoder 426
20. Conclusion, Parting Words, and Encouragement
Learning AVR: The Missing Chapters 437
The Watchdog Timer . 437
Power Savings . 438
Crystals and Alternate Clock Sources 438
Bootloaders 438
Analog Comparator 439
Debugging . 439
Put This Book Down and Build! 440
Index 441
xbenefits of, 20
breadboard connections,
30
diagram of flash wiring, 26
drawbacks of, xii, 20
flashing as a target, 25
hardware programming in,
27
pin diagram, 21
portpins.h bug, 25
programming toolchain, 18
terminal emulator software,
84
vs. other IDEs, 23
writing C in, 23
arrays, 388
Atmel AVRISP mkII flash programmer, 28
Atmel Studio, 15
attack-decay-sustain-release
(ADSR) volume envelopes,
280, 284
ATtiny44/45, 12
attributions, xvii
averaging vs. oversampling,
246
AVR ATmega microcontrollers
benefits of, xi
built-in pull-up resistor, 107
built-in USART device, 80
C code structure in, 45
configuring serial communication in, 81
driving large loads with,
287
hardware overview, 8
hardware registers in, 47
interfacing over serial, 239
internal clock speed, 189
internal EEPROM on, 414
limited memory in, 4
naming conventions, 12
pin overview, 5
programming in Arduino,
26
(see also programming)
selection of, 12
timer/counters in, 177
voltage reference in, 248
avr-gcc code compiler, 15, 280
avr-size utility program, 385
avr/eeprom.h library, 414, 418
avr/io.h file , 91
AVRDUDE
common configurations, 38
error messages, 36
fuse-bit settings, 191, 426
options for, 36
programmers supported,
16
reading/writing to EEPROM,
417
saving/loading EEPROM,
422
starting, 35
avrMusicBox.c listing, 117
B
back voltage, 298
base resistance, 292
battery power, 57, 248
(see also DC motors)
baud rate, definition of, 78
bipolar-junction transistors
(BJTs), 290
bit trading in SPI, 340
bit twiddling
advanced application of, 64
bit shifting, 62, 181
bit-shift roll, 64
bitwise logical operators,
66
clearing bits with AND/NOT,
70
Cylon eyes project, 59, 64
overview of, 74
pin numbering and, 63
project supplies, 60
setting bits with OR, 67
toggling bits with XOR, 69
usefulness of, 59, 71
_BV() macro, 65
bitmasks, 68, 70, 110
bitwise logical operations, 59
blinkenlights, 50
blocking capacitors, 96, 97
Boss Button project
bossButton.c listing, 123
bossButton.py listing, 121
button bounce, 113
buttons, 106, 156
(see also digital input)
(see also interrupt programming)
C
C language
arrays in, 388
ASCII and, 86
AVR code structure, 45
benefits of, xii
bit shifting instructions, 62
code reuse with modules,
94, 240
coding in Arduino IDE, 24
compiler errors, 40
dereferencing operator, 393
functions in, 56
integer division in, 261
memory addresses, 381
naming conventions, 83
zero-indexing in, 63, 102
C99 integer types, ISO standard for, 419
cadmium-sulfide lightdependent resistor (LDR),
129, 140
calibrateTime.py listing, 237
capacitive sensors
circuit for, 166
code for, 168
debugging, 173
global variables and, 170
principle behind, 164
442 Indexsensor for, 165
timing of, 164
capacitors, 96
capSense.c listing, 168
Central Limit Theorem, 246
central processing unit (CPU)
basics of, 8
CPU clock, 8, 189, 191, 237
noise reduction, 245, 251
setting speed in code, 190
character-to-ASCII converter,
87
clearing bits, 70
cli() function, 161
CLKPR (Clock Prescale Register), 192
clocks
accuracy of, 237, 241
alternate sources for, 438
as timebase, 176
double-speed mode, 92
enabling high-speed, 191
noise reduction and, 245,
251
prescalers for, 8, 137, 185,
189
types of, 8
code editors, 14
code examples, permission to
use, xvii
comparators, 217, 439
compare events, 177
compiler errors, 40, 46, 386
computer-side scripting, 121
configuration registers, inputoutput, 48
const keyword, 384
constants, human-friendly
synonyms for, 62
control pulse frequency, 222
cross-platform compatibility,
16, 84
crystal radios, 187
crystals, 438
CTC waveform mode, 178, 184
Cylon eyes project, 59, 64
D
Darlington transistors, 291
data
organization in EEPROM,
423
serial vs. parallel, 340
types of, 419
data framing, 338
data logging, 371, 377
data smoothing, 244
data-direction register (DDR),
47
Data-Direction Register (DDR),
108
datasheets
accessing, 7
External Interrupts section,
161
macro definitions, 90
Power Management and
Sleep Modes, 252
Power Management section, 438
Register Description section, 92
System Control and Reset
section, 438
UCSR0B functions, 90
DC motors
back voltage in, 298
basics of, 297
dcMotorWorkout.c listing,
300
diagram of beadboard, 298
diagram of circuit, 297
flyback diode in, 300
running in reverse, 305
specification for, 303
torque in, 303
vs. stepper motors, 318
DDRx (see data-direction register)
dead band in servo motor, 218
debouncer.c listing, 115
debouncing, 113
debugging
ADC code, 137, 145
ADC output, 139
basic steps to, 439
button press interpretation,
112
capacitive sensors, 173
EEPROM chip installation,
348
global variables, 173
hardware registers, 49, 91
I2C initialization, 368
pin output, 49
pointer initialization, 386
portpins.h bug, 25
programmer-to-AVR communication, 52
sampling frequency, 280
serial port loopback testing,
86
with USART, 95
decomposing-to-pointer rule,
388
# define statements, 62, 376
dependencies, keeping track
of, 19
dereferencing operator, 393
desktop-side scripting, 121
differential pulse-code modulation (DPCM)
basics of, 405
encoding two-bit data, 405
wave2DPCM.py encoding,
408
digital input
Boss Button project, 119
button presses, 110
configuration of, 108
debouncing, 113
music box project, 117
project supplies, 105
pushbutton checklist, 120
pushbuttons/switches, 106
state change indicators,
112
Index 443digital library, access to, xvii
digital output
AVR C code structure, 45
blinking LED project, 44, 49
configuration of, 48
hardware registers, 46
POV pattern generator, 43
POV toy, 49
project supplies, 43
digital signal processing (DSP)
chip, 280
digital thermometer project,
361, 369
(see also I2C protocol)
digital-to-analog converters
(DACs), 127, 211
direct digital synthesis (DDS)
accumulators, 273
ADSR envelopes, 284
auxiliary files for, 284
basics of, 270
code for, 274
debugging for speed, 280
digital signal processing
chip and, 280
dynamic volume control,
280
fatSaw.c listing, 277
lowpass filter and, 276
mixing, 277
project overview, 269
project supplies, 269
pseudocode for, 271
PWM frequency and, 270
sample rate and, 276
sine wave creation, 274
summary of, 273
DRAM (dynamic random access memory), 344
drive modes, h-bridge
coasting, 316
comparison of, 315
locked anti-phase, 314
sign-magnitude, 314
states available, 313
drivers, for Windows, 35
duty cycles, 201
dynamic volume control, 280
E
EEPROM (electrically erasable
programmable read-only
memory)
automatic erase settings,
426
AVRDUDE terminal mode,
417
benefits of external, 344
block update command,
415
convenience functions, 356
data organization in, 423
defining memory locations,
375
detecting a write completion, 418
float type variables and,
415
hookup of external, 347
initialization of, 425
initSPI function, 354
internal size limits, 376, 414
lifespan of, 415
quickDemo.c listing, 416
reading from, 419
saving and loading, 422
utility functions for, 414
write cycle limits, 414
electro-motive force (EMF),
298
encryption/decryption project
encryption used in, 427
vigenereCipher.h listing,
428
vigenereCipher_outline.c
listing, 431
errors
AVRDUDE errors, 36
compiler errors, 40, 386
I2C error codes, 368
PB1 undeclared, 25
programming errors, 40
(see also debugging)
event loops, 46, 56, 154, 377,
437
exponentially weighted moving averages (EWMA), 259
F
fatSaw.c listing, 277
fixed-width variable type
names, 419
flash memory
basics of, 345
determining file size, 385
memory addresses, 381
overview of, 392
pointers and, 384
PROGMEM variables, 384
progmemDemo1.c listing,
382
talking voltmeter project,
394
flash programmers, 16, 25, 28
floating-point math, 249, 415
flyback diodes, 300
footstep detector project
bias voltage in, 259
circuit for, 254
code for, 262
components used, 252
exponentially weighted
moving averages and,
259
integer division in, 261
overview of, 266
theory behind, 258
for() loops, 73, 172
free-running ADC mode, 136,
143
frequency
control pulse frequency,
222
cutoff frequency, 276
444 IndexPWM voltage level and, 270
sampling frequency, 280
selection of in PWM, 201
FTDI cables, pinout summary,
83
functions
in C language, 56
naming conventions for, 83
pointers as arguments to,
388
prototyping of, 94
scope of, 56
fuse bits, 190, 426
G
GCC code compiler, 15, 46, 110
gearmotors, 303
gedit text editor, 14
global variables, 170
H
H-bridges
alternatives to, 324
avoiding shoot-through in,
308, 316
avoiding short-circuit
mode, 309, 316
chip for dual, 325
chip selection, 317
coasting mode, 316
diagrams of, 308, 309, 312
digital logic control in, 310
DIY vs. ready-made, 306
drive state comparison, 315
drive states available, 313
four-wire control of, 312
hBridgeWorout.c listing,
310
locked anti-phase drive
mode, 314
project supplies, 306
sign-magnitude drive
mode, 314
stepper motors and, 318
hardware flash programmers
Arduino, 27
Atmel AVRISP mkII, 28
LadyAda’s USBTinyISP, 29
Parallel Port, 28
USBTiny/USBasp, 29
hardware peripherals
analog/digital converters
(ADCs), 10
benefits of, xiii, 5
clocks for, 8
configuration of, 89
interrupt service routines,
10
interrupt system, 153
power saving and, 438
serial communication with,
9
timer/counters, 11, 22, 175
hardware registers, 46, 48, 62,
63, 91
helloInterrupt.c listing, 157
human-readable code, 62, 83,
181
I
I/O registers, 7
I2C protocol
addressing scheme in, 361
benefits of, 359
bus speeds in, 368
byte acknowledgement,
362
code for, 366
data logging in, 371
data timing in, 361
demo hookup, 364
demo library, 365
EEPROM configuration, 375
error codes in, 368
event loops in, 377
function of, 361
initialization of, 367
overview of, 364
project supplies, 359
speed limits in, 364
thermometer project, 369
UART serial menu and, 376
vs. two-wire interface, 360
initI2C function, 366
initInterrupt0() function, 158
initSPI function, 354
initTimers() function, 206
initUSART() function, 82, 88
input-output configuration
registers, 48
inputs, 9
(see also digital input)
INT0/INT1 external interrupts,
156
integers
division in C language, 261
floating-point math, 249,
415
pre-C99 types, 419
signed, 275
unsigned, 74
using 32-bit, 4
integrated development environment (IDE), 15
internally triggered interrupts,
155
interrupt programming
AVR pinouts/PCINT names,
163
capacitive sensors, 164
externally triggered, 155
function of, 159
INT0/INT1 external interrupts, 156
internally triggered, 155
interrupt vector names, 159
ISR() function, 158, 251
pin-change interrupts, 161
polling-style programming,
154
real-time response, 156
Index 445sleep-mode interrupts, 438
turning interrupts on/off,
161
usefulness of, 153, 155
Interrupt Service Routines
(ISRs), 10, 155, 251
interrupt vector names, 159,
160
ISP headers, 33
ISR() function, 158, 170, 251
L
LadyAda’s USBTinyISP flash
programmer, 29
LDR (see cadmium-sulfide
light-dependent resistor)
LEDs
connection of, 31
current-limiting resistors
for, 50
dimming with PWM, 200
naming with zero-indexing,
63
less-than-or-equal-to construction, 102
light meter project
ADC initialization, 137
ADC power pins, 133
circuit for, 129
code for, 135
potentiometer, 134
uses for, 129, 139
lightSensor.c listing, 135
Linux
AVRDUDE errors, 38
programming toolchain, 16
Python installation, 121
terminal emulator software,
84
locked anti-phase drive mode,
314
logging digital thermometer
project, 361, 369
lowpass filters, 276
M
Mac OS
programming toolchain, 18
Python installation, 121
terminal emulator software,
84
macros
datasheet definitions of, 90
GCC convenience macros,
110
power minimizing with, 190
PROGMEM macro, 381
_BV() macro, 65
main loop, 46
main() function, 45, 55
make/makefiles
configuration of, 38
dependency tracking, 19
determining file size, 385
function of, 16
master SPI device, 339
math coprocessors, 4
memory
chip selection and, 12
flash memory, 379
interfacing with external,
337
memory addresses, 381
types of, 8
types of external, 344
waveform storage and, 285
microcontroller projects
AM radio, 186
basic kit for, xiv
blinking LEDs, 29, 44, 49
Boss Button, 119
capacitive sensor, 164
Cylon eyes, 59
footstep detector, 252
light meter, 129
logging accelerometer, 156
logging digital thermometer, 361
loopbacks, 81
music box, 117
night light, 145
oscilloscope project, 140
permission for code use,
xvii
servo sundial, 224
software vs. hardware approach to, xii
square-wave organ, 95, 182
talking voltmeter, 394
Vigenère cipher encoder/
decoder, 427
voltage meter, 244
microcontroller-controlled resistance, 140
microcontroller-specific library
routines, 61
microcontrollers
basics of, 3
built-in peripherals for, 5
function of, xi, 5
interfacing with desktop
computer, 77, 124
limitations on, 4
similarities among brands,
xii, xiii
user interaction with, 106
uses for, xi, 5
microstepping, 334
mixing digital audio, 277
modules, 94, 240
MOSFETs (metal oxide silicon
field-effect) transistors
2N7000, 53, 291
gate charge, 295
gate driver chips, 294
motion detector (see footstep
detector project)
motors
back voltage in, 298
DC motors, 297
H-bridges for, 305
project supplies, 306
stepper motors, 305, 318
unipolar, 324
446 Indexmoving averages
EWMA implementation,
259
usefulness of, 244
multiplexing
analog comparator and,
439
multiplexer (mux) switch,
128
nightlight project and, 145
setting mux bits, 146
music (see direct digital synthesis; music box project;
square-wave organ project)
music box project, 117
N
negative numbers, 419
night light project
circuit for, 148
code for, 148
multiplexing and, 145
noise reduction, 245, 251, 252
NOT operator, 70
Notepad text editor, 14
O
OCRn (Output Compare Register), 177
OR operator, 67
oscilloscope project
AVR code for, 141
desktop code for, 143
synergies and, 145
uses for, 140
outputs, 8
(see also digital output)
oversampling
basics of, 245
practical limit on, 251
usefulness of, 243
vs. averaging, 246
P
Parallel Port flash programmer,
28
PCINT (pin-change interrupts),
161
persistence-of-vision (POV)
toy
basis of, 49
building the circuit, 50
code for, 54
creating patterns, 56
POVDisplay function, 55
simplest version of, 51
switch for, 53
persistence-of-vision (POV),
pattern generation with, 43
phase, SPI protocol, 355
photocells/photoresistors, 130
piezoelectric disks, 252
pinout diagram, 6
pins
accessing with I/O registers,
7
ADC power pins, 133
analog output from, 208
arrangement of, 6
dedicated to PWM, 204
default state of, 48
define statements for, 62
diagram of, 5
diagram of Arduino labels,
21
diagram of ISP connectors,
30
diagram of PCINT names,
163
diagram of SN754410, 325
digital inputs of, 9, 108
digital outputs of, 8, 46
FTD cable pinout summary,
83
function of, 5
naming conventions, 6, 85
pin masks, 161
pin-change interrupts, 161
RESET pin, 53
serial pin connection, 85
zero-indexing and, 63
PINx hardware register, 48
playNote() function, 98, 117,
175
pointers
address storage in, 388
address-of operator, 382
arrays and, 388
as arguments to functions,
388
basics of, 385
dereferencing operator, 393
progmemDemo2.c listing,
386
polarity, SPI protocol, 355
polling-style program, 154,
283
port x data registers, 48
port x input pins address, 48
portpins.h bug, 25
potentiometers (pots), 134,
140
POVDisplay function, 55
power down mode, 252
power management, 438
power supply
ADC power pins, 133
battery power, 57, 248
connection of, 30
LED indicator for, 31
minimizing use with macros, 190
printBinaryByte() function, 87,
93
printByte() function, 93
printString() function, 82, 93
PROGMEM macro
data structures, 395
data variables, 384
function of, 381
pointer arrays, 398
progmemDemo1.c listing,
382
Index 447program memory, size limitations on, 4
(see also flash memory)
Programmer’s Notepad, 14
programming
Arduino environment, 20
basic steps of, 16
basic supplies needed, 14
checking installation with
AVRDUDE, 35
flashing, 40
hookup, 30
ISP headers, 33
overview of, 13
software toolchain, 16
toolchain overview, 14
troubleshooting, 40
pull-up resistors, 107, 348
pulse-code modulation, 405
pulse-width modulation
(PWM)
advanced techniques using
(see direct digital synthesis)
alternatives to, 211
average value control, 200
basics of, 199
differential pulse-code
modulation, 405
duty cycle specification,
201
fast mode, 206
frequency selection, 201
H-bridges and, 313
LED dimming with, 200
manual routine for, 202
on non-dedicated pins, 208
overview of, 211
project supplies, 199
pwm.c listing, 202
pwmOnAnyPin.c listing,
209
pwmTimers.c listing, 204
ripple tolerance, 201
timer initialization, 206
timers demo, 204
Vactrols and, 140
pushbuttons, 105, 120, 156
(see also digital input)
(see also interrupt programming)
Python
benefits of, 102
code modules, 240
debugging with serialScope.py, 137, 330
DPCM encoding with, 408
installation of, 121
pyserial library, 144
readTime() function, 239
terminal emulator software,
84
wavetable pre-calculation
with, 285
Q
quickDemo.c listing, 416
R
RAM
limitations on, 4
single-bit memory networks in, 47
random toggling, 75
rated voltage, 303
RC oscillators, 438
reactance, 132
reaction time, testing, 178
readTime() function, 239
real-time responses, 156
receiveByte() function, 82
Register Description section,
91
relays, 294
RESET pin, 53
resistance, microcontrollercontrolled, 140
resistor tolerance, 247
return(0), 46
ripple voltage, 201
RX-TX hookup, 85
S
Safari Books Online, access to,
xvii
sample and hold circuit, 128
sample rate, 276
scope, of variables in C language, 56
SD/MMC cards, 345
sei() function, 161
sensors
analog, 126
capacitive touch, 164
voltage, 126
serial communication
AVR configuration, 81
built-in peripherals for, 9
computer setup, 83
implementation of, 81
local echo, 86
loopback testing, 86
project supplies, 77
servo motor I/O, 235
SPI protocol for, 337
square-wave organ project,
95
synchronous vs. asynchronous, 81, 338, 361
terminal emulator software,
84
troubleshooting, 87
USART basics, 78
USART overview, 103
USB-serial adapter, 83
serial communications
USART polling, 283
serial library, installation of,
121
serial pins, connection of, 85
serial protocols, 78
serial-to-TCP/IP bridge, 124
448 IndexserialLoopback.c listing, 82
serialOrgan.c listing, 99
serialScope.py listing, 143
servo motors
code for, 219
connecting to AVR, 218
control pulse frequency,
222
control signal in, 217
function of, 217
position controls in, 216
project supplies, 216
servoWorkout.c listing, 219
sundial project, 224
uses for, 216
servoClockFunctions.c listing,
233
servoSerialHelpers.c listing,
235
servoSundial.c listing, 229
servoSundial.h listing, 232
setting bits, 78
shift registers, 340
shoot-through, in H-bridges,
308, 316
sign-magnitude H-bridge
drive mode, 314
simpleButton.c listing, 111
sine waves, using DDS (directdigital synthesis), 274
single-conversion triggering,
136
sizeof(), 392
slave devices, in SPI protocol,
339
slave-select pin, in SPI protocol, 354
sleep mode, 251, 438
(see also noise reduction)
slowscope, 140
slowScope.c listing, 141
SN754410 dual H-bridge chips,
325
software toolchain
Arduino setup, 18
Linux setup, 16
Mac setup, 18
make/makefiles, 19
Windows setup, 18
solid state relays (SSRs), 296
sound (see direct digital synthesis) (see square-wave organ project) (see talking
voltmeter project)
speech playback (see talking
voltmeter project)
speed
debugging high-speed issues, 280
limitations on, 4
setting in code, 190
speed profiles, 332
SPI (serial peripheral interface)
benefits of, 337
bit trading in, 340
bus setup, 339
clock phase/polarity, 355
configuration overview, 357
convenience functions, 356
data framing in, 338
data logging in, 371
EEPROM hookup, 347
EEPROM library C code, 352
EEPROM memory chip and,
344
function of, 338
initSPI function, 354
output pins and, 354
shift registers in, 340
SPI demo code, 348
SPI library header, 350
SPI_tradeByte function, 355
square-wave organ project
additional files for, 102
amplification for, 97
code for, 99
keyboard for, 95
keypress conversion, 102
library for, 98
speaker capacitor, 96
timer/counters and, 182
SRAM (static random access
memory), 344
stall current, 303
start bits, UART serial, 78
state change, testing for, 112
stepper motors
acceleration control, 331
basics of, 318
bifilar stepper motors, 324
code for, 328
diagrams of, 319, 323, 334
dual H-bridge chip, 325
full/half stepping, 320
H-bridges for, 318
half-stepping coil currents,
322
kinds of, 319
microstepping, 334
project supplies, 306
trapezoid speed profile, 332
usefulness of, 305
vs. brushed DC motors, 318
wire identification, 323
stop bits, USART serial, 78
successive approximation
DAC, 128
sundial project
calibrateTime.py listing, 237
calibration, 237
circuit for, 228
clock for, 233
code for, 229
laser attachment, 224
laser preparation, 227
positioning, 226
range of motion for, 226
serial I/O for, 235
servoClockFunctions.c listing, 233
servoSerialHelpers.c listing,
235
servoSundial.c listing, 229
servoSundial.h listing, 232
Index 449T
talking voltmeter project
audio data generation, 404
diagram of flash memory
pointers, 399
differential pulse-code
modulation, 405
ISR() function, 402
main() function, 403
overview of, 394
pointer arrays, 398
sound playback, 400
speech generation for, 395
talkingVoltmeter.c listing,
400
talkingVoltmeter.h listing,
395
TCNTn (timer/counter register), 176
terminal emulator software,
83, 84
text editors, 14
TextMate, 14
thermometer project, 361, 369
timebases, 438
timer/counters
AM radio project, 186
basics of, 11
block diagram, 176
clock prescaler settings, 185
configuration checklist, 213
overview of, 196
project supplies, 175
PWM demo, 204
PWM initialization, 206
reaction time testing, 178
servo motor configuration,
221
square-wave organ, 182
timerAudio.c listing, 182
types included, 177
usefulness of, 175
watchdog timer, 22, 437
waveform generation
modes, 178
toggleButton.c listing, 112
toggling bits, 69
torque, 303
touch sensors, 164
transistor switches
bipolar-junction transistors,
290
Darlington transistors, 291
driving large loads with,
288
high- vs. low-side, 289
metal oxide silicon fieldeffect transistors (MOSFETs), 291
overview of, 296
project supplies, 288
relays, 294
summary of, 296
triacs/SSRs, 296
transistors
bipolar-junction transistors,
290
Darlington transistors, 291
driving large loads with,
287
selecting base resistor, 292
transmitByte() function, 82
trapezoid speed profile, 332
triacs, 296
troubleshooting, 40, 87
(see also debugging)
(see also errors)
TWI (two-wire interface) protocol, 360
two’s complement order, 419
U
UART/USART serial
additional uses for, 95
configuration of, 81, 88
data logging with, 371
difference between, 81
I2C protocol, 376
overview of, 103
polled serial input, 283
synchronous vs. asynchronous communication,
338
transmitting/receiving with,
92
UART serial basics, 78
UART.c file, 88
UCSR0B register, 90
UDRE0 (USART0 Data Register
Empty), 92
USB-serial adapter, setup of, 83
USBTiny/USBasp flash programmers, 29
V
Vactrols, 140
variables
definition of, 56
float-type, 415
global variables, 170
naming conventions, 83
pointers and, 385
PROGMEM variables, 384
variable types, 381
Vigenère cipher, 427
volatile keyword, 171
voltage dividers, 129, 211, 245
voltage meter project
circuit for, 245
code for, 249
design specifications, 244
oversampling in, 245
overview of, 266
resistor tolerance, 247
sleep modes, 251
supplies needed, 244
voltage scaling in, 247
voltage sensors, 126
voltmeter.c listing, 249
volume control, 280
450 IndexW
watchdog timer, 22, 437
wave2DPCM.py program, 408
waveform modes, PWM hardware, 177, 206, 285
wear leveling, 415
while() loops, 46, 65
Windows
drivers for, 35
programming toolchain, 18
Python installation, 121
terminal emulator software,
84
X
XOR operator, 69
Z
zero-indexing, 63, 102


كلمة سر فك الضغط : books-world.net
The Unzip Password : books-world.net
أتمنى أن تستفيدوا من محتوى الموضوع وأن ينال إعجابكم

رابط من موقع عالم الكتب لتنزيل كتاب  Make: AVR Programming - Learning to Write Software for Hardware
رابط مباشر لتنزيل كتاب  Make: AVR Programming - Learning to Write Software for Hardware
الرجوع الى أعلى الصفحة اذهب الى الأسفل
 
كتاب Make: AVR Programming - Learning to Write Software for Hardware
الرجوع الى أعلى الصفحة 
صفحة 2 من اصل 1
 مواضيع مماثلة
-
» كتاب Make - FPGAs - Turning Software into Hardware with Eight Fun & Easy DIY Projects
» كورس برمجة ماكينات التحكم الرقمي - CNC CNC Programming - Write G-Code and M-Code Course
» كتاب Software Metrics and Software Metrology
» كتاب How to Write a Lot
» كتاب How to Write a Thesis

صلاحيات هذا المنتدى:لاتستطيع الرد على المواضيع في هذا المنتدى
منتدى هندسة الإنتاج والتصميم الميكانيكى :: المنتديات الهندسية :: منتدى الكتب والمحاضرات الهندسية :: منتدى الكتب والمحاضرات الهندسية الأجنبية-
انتقل الى: