Prologue |
|
xiii | |
Preface |
|
xv | |
Author |
|
xvii | |
Background and Use of the Book |
|
xix | |
|
Chapter 1 Program Control Macros |
|
|
1 | (40) |
|
|
1 | (1) |
|
|
1 | (1) |
|
1.2 Macro "jump" (Jump to Label) |
|
|
2 | (1) |
|
1.3 Macro "jumpN" (Jump to Label) |
|
|
3 | (1) |
|
1.4 Macro "jmp_1st_2" (Jump to One of Two Labels) |
|
|
3 | (1) |
|
1.5 Macro "jmp_1st_4" (Jump to One of Four Labels) |
|
|
4 | (2) |
|
1.6 Macro "jmp_1st_8" (Jump to One of Eight Labels) |
|
|
6 | (2) |
|
1.7 Macro "call_SR" (Call Subroutine) |
|
|
8 | (3) |
|
1.8 Macro "return_SR" (Return from Subroutine) |
|
|
11 | (1) |
|
1.9 Macro "FOR" (Beginning of FOR-NEXT Loop) |
|
|
12 | (3) |
|
1.10 Macro "NEXT" (End of FOR-NEXT Loop) |
|
|
15 | (1) |
|
1.11 Macro "clear_WDT" (Clear the Watchdog Timer) |
|
|
16 | (1) |
|
1.12 Implementation of Master Control Relay (MCR) |
|
|
17 | (1) |
|
1.13 Examples for Program Control Macros |
|
|
18 | (22) |
|
|
19 | (1) |
|
|
20 | (1) |
|
|
21 | (2) |
|
|
23 | (2) |
|
|
25 | (1) |
|
|
26 | (2) |
|
|
28 | (3) |
|
|
31 | (3) |
|
|
34 | (2) |
|
|
36 | (3) |
|
|
39 | (1) |
|
|
40 | (1) |
|
Chapter 2 High Speed Counter and PWM Macros |
|
|
41 | (110) |
|
|
41 | (1) |
|
2.1 High Speed Counter (HSC) Instruction |
|
|
41 | (9) |
|
|
50 | (1) |
|
2.3 Using Standard PWM Functions |
|
|
51 | (2) |
|
2.3.1 Timer2/4/6 Timer Resource |
|
|
51 | (1) |
|
|
51 | (1) |
|
|
52 | (1) |
|
|
52 | (1) |
|
2.4 Macro "PWM_RA4v" (A Standard PWM Operation with a Variable Duty Cycle Using the RA4 Pin) |
|
|
53 | (2) |
|
2.5 Macro "PWM_RA4c" (A Standard PWM Operation with a Fixed Duty Cycle Using the RA4 Pin) |
|
|
55 | (6) |
|
2.6 Macro "PWM_RA7v" (A Standard PWM Operation with a Variable Duty Cycle Using the RA7 Pin) |
|
|
61 | (3) |
|
2.7 Macro "PWM_RA7c" (A Standard PWM Operation with a Fixed Duty Cycle Using the RA7 Pin) |
|
|
64 | (8) |
|
2.8 Some Control Circuits for the Brushed DC Motor |
|
|
72 | (23) |
|
2.8.1 Basic Control of the Brushed DC Motor |
|
|
74 | (1) |
|
2.8.2 Implementation of ON--OFF or PWM Control for a Brushed DC Motor |
|
|
74 | (4) |
|
2.8.3 Control of the Brushed DC Motor in Both Forward and Reverse Directions with an H-Bridge Circuit |
|
|
78 | (5) |
|
2.8.4 Speed Control of Brushed DC Motors in an H-Bridge with PWM |
|
|
83 | (1) |
|
2.8.5 A Relay-Based H-Bridge Circuit for the Control of Brushed DC Motors |
|
|
84 | (11) |
|
2.9 Examples for High Speed Counter and PWM Macros |
|
|
95 | (54) |
|
|
101 | (2) |
|
|
103 | (2) |
|
|
105 | (6) |
|
|
111 | (2) |
|
|
113 | (6) |
|
|
119 | (2) |
|
|
121 | (8) |
|
|
129 | (3) |
|
|
132 | (4) |
|
|
136 | (7) |
|
|
143 | (6) |
|
|
149 | (2) |
|
Chapter 3 Memory-Related Macros |
|
|
151 | (112) |
|
|
151 | (1) |
|
3.1 Memory Organization of the PIC16F1847 Microcontroller |
|
|
152 | (3) |
|
3.1.1 Flash Program Memory Organization |
|
|
152 | (1) |
|
3.1.2 Data SRAM Organization |
|
|
153 | (2) |
|
3.2 Introduction to Memory Read/Write Operations |
|
|
155 | (4) |
|
3.3 Macro "sram_read" (Read 1 Byte from SRAM) |
|
|
159 | (5) |
|
3.4 Macro "eeprom_read" (Read One Byte from EEPROM to SRAM) |
|
|
164 | (2) |
|
3.5 Macro "copy_eeprom_to_sram" (Copy N Bytes from EEPROM to SRAM) |
|
|
166 | (1) |
|
3.6 Macro "eeprom_write" (Write 1 Byte from SRAM to EEPROM) |
|
|
167 | (4) |
|
3.7 Macro "write_sram_to_eeprom" (Write N Bytes from SRAM to EEPROM) |
|
|
171 | (2) |
|
3.8 Macro "prg_mem_read" (Read 1 Word from Flash Program Memory) |
|
|
173 | (2) |
|
3.9 Macro "copy_prgmem_to_sram" (Copy N Bytes from Flash Program Memory to SRAM) |
|
|
175 | (4) |
|
3.10 Macro "prg_mem_erase" (Erase N Rows of Flash Program Memory) |
|
|
179 | (1) |
|
3.11 Macro "write_B_sram_to_prgmem" (Write Bytes from SRAM to Flash Program Memory) |
|
|
180 | (2) |
|
3.12 Macro "write_W_sram_to_prgmem" (Write Words from SRAM to Flash Program Memory) |
|
|
182 | (3) |
|
3.13 Macro "fill_sram_N80" (Fill up to 80 Variables with Values in a Bank) |
|
|
185 | (1) |
|
3.14 Macro "fill_sram_N255" (Fill up to 255 Variables with Values in SRAM) |
|
|
186 | (4) |
|
3.15 Examples for Memory-Related Macros |
|
|
190 | (71) |
|
|
197 | (1) |
|
|
198 | (4) |
|
|
202 | (3) |
|
|
205 | (2) |
|
|
207 | (3) |
|
|
210 | (4) |
|
|
214 | (6) |
|
|
220 | (6) |
|
|
226 | (3) |
|
|
229 | (2) |
|
|
231 | (12) |
|
|
243 | (6) |
|
|
249 | (5) |
|
|
254 | (7) |
|
|
261 | (2) |
|
Chapter 4 Drum Sequencer Instruction |
|
|
263 | (106) |
|
|
263 | (1) |
|
4.1 Implementation of the Drum Sequencer Instruction |
|
|
264 | (13) |
|
4.2 Examples for the Drum Sequencer Instruction |
|
|
277 | (90) |
|
|
280 | (16) |
|
|
296 | (13) |
|
|
309 | (13) |
|
|
322 | (19) |
|
|
341 | (17) |
|
|
358 | (9) |
|
|
367 | (2) |
|
Chapter 5 Sequential Function Charts |
|
|
369 | (184) |
|
|
369 | (1) |
|
|
369 | (18) |
|
|
370 | (1) |
|
|
370 | (3) |
|
5.1.3 SFC Evolution Rules |
|
|
373 | (9) |
|
|
382 | (1) |
|
|
383 | (1) |
|
|
383 | (4) |
|
5.2 Implementation of SFC Elements |
|
|
387 | (164) |
|
|
393 | (3) |
|
5.2.2 Sequence Evolution Examples |
|
|
396 | (1) |
|
5.2.2.1 Example 5.1---Single-Sequence SFC Example |
|
|
397 | (11) |
|
5.2.2.2 Example 5.2---Divergence of Sequence with Left to Right Priority and Convergence of Sequence Example |
|
|
408 | (5) |
|
5.2.2.3 Example 5.3---Divergence of Sequence with Numbered Branches and Convergence of Sequence Example |
|
|
413 | (4) |
|
5.2.2.4 Example 5.4---Divergence of Sequence with Mutual Exclusion and Convergence of Sequence Example |
|
|
417 | (7) |
|
5.2.2.5 Example 5.5---Simultaneous Divergence after a Single Transition and Simultaneous Convergence before a Single Transition Example |
|
|
424 | (5) |
|
5.2.2.6 Example 5.6---Sequence Loop and Sequence Skip Example |
|
|
429 | (4) |
|
5.2.2.7 Example 5.7---Simultaneous Divergence after a Sequence Selection Convergence and Simultaneous Convergence before a Sequence Selection Divergence Example |
|
|
433 | (6) |
|
5.2.3 Actions and Their Implementation |
|
|
439 | (1) |
|
5.2.3.1 Example 5.8---An SFC Example Used in the Explanation of Actions |
|
|
439 | (7) |
|
5.2.3.2 Macro "action_N" (Non-Stored Action) |
|
|
446 | (2) |
|
5.2.3.3 Example 5.9---An SFC Example with Non-Stored Actions |
|
|
448 | (3) |
|
5.2.3.4 Macro "action_S" (Stored Action) |
|
|
451 | (3) |
|
5.2.3.5 Example 5.10---An SFC Example with Stored and Reset Actions |
|
|
454 | (2) |
|
5.2.3.6 Macro "action_L" (Time-Limited Action) |
|
|
456 | (5) |
|
5.2.3.7 Example 5.11---An SFC Example with Time-Limited Actions |
|
|
461 | (4) |
|
5.2.3.8 Macro "action_D" (Time-Delayed Action) |
|
|
465 | (4) |
|
5.2.3.9 Example 5.12---An SFC Example with Time-Delayed Actions |
|
|
469 | (4) |
|
5.2.3.10 Macro "action.SD" (Stored and Time-Delayed Action) |
|
|
473 | (5) |
|
5.2.3.11 Example 5.13---An SFC Example with Stored and Time-Delayed Actions |
|
|
478 | (4) |
|
5.2.3.12 Macro "action_DS" (Time-Delayed and Stored Action) |
|
|
482 | (6) |
|
5.2.3.13 Example 5.14---An SFC Example with Time-Delayed and Stored Actions |
|
|
488 | (2) |
|
5.2.3.14 Macro "action_SL" (Stored and Time-Limited Action) |
|
|
490 | (7) |
|
5.2.3.15 Example 5.15---An SFC Example with Stored and Time-Limited Actions |
|
|
497 | (2) |
|
5.2.3.16 Macro "action_Pl" (Pulse [ Rising Edge] Action) |
|
|
499 | (2) |
|
5.2.3.17 Example 5.16---An SFC Example with Pulse (Rising Edge) Actions |
|
|
501 | (2) |
|
5.2.3.18 Macro "action_P0" (Pulse [ Falling Edge] Action) |
|
|
503 | (1) |
|
5.2.3.19 Example 5.17---An SFC Example with Pulse (Falling Edge) Actions |
|
|
503 | (4) |
|
5.2.3.20 Macro "ACTION_CONTROL" (Action Control Function Block) |
|
|
507 | (5) |
|
5.2.3.21 Example 5.18---An Example with ACTION_CONTROL Function Blocks... |
|
|
512 | (5) |
|
5.2.3.22 Macro "F_5_in_MTOAI" (More Than One Active Input Function with Five Inputs) |
|
|
517 | (1) |
|
5.2.3.23 Example 5.19---An Example with the F_5_in_MTOAI Macro |
|
|
517 | (1) |
|
5.2.3.24 Macro "ACTION_CONTROL_w_Error" (Action Control with Error Output Function Block) |
|
|
517 | (8) |
|
5.2.3.25 Example 5.20---An Example with ACTION_CONTROL_w_Error Function Block |
|
|
525 | (4) |
|
5.2.3.26 Example 5.21---Direct Implementation of Action Control Function Block with Error Output |
|
|
529 | (5) |
|
5.2.3.27 Example 5.22---Direct Implementation of Action Control with a Few Action Qualifiers |
|
|
534 | (3) |
|
5.2.3.28 Example 5.23---An SFC Example with Direct Implementation of Action Control |
|
|
537 | (8) |
|
5.2.3.29 Example 5.24---An SFC Example Consisting of an Action with a Sequence of Instructions |
|
|
545 | (6) |
|
|
551 | (2) |
About the Downloadable Files for Advanced Concepts |
|
553 | (2) |
Index |
|
555 | |