Prologue |
|
xiii | |
Preface |
|
xv | |
About the Author |
|
xvii | |
Background and Use of the Book |
|
xix | |
|
Chapter 1 Hardware of the PIC16F1847-Based PLC |
|
|
1 | (12) |
|
|
13 | (92) |
|
|
13 | (1) |
|
2.1 Definition and Allocation of Variables |
|
|
14 | (15) |
|
2.2 Contents of the File "PICPLC_PIC16F1847_memory.inc" |
|
|
29 | (1) |
|
2.3 Contents of the File "PICPLC_PIC16F1847_main.asm" |
|
|
30 | (8) |
|
2.4 Contents of the File "PICPLC_PIC16F1847_user_Bsc.inc" |
|
|
38 | (1) |
|
2.5 Contents of the File "PICPLC_PIC16F1847_subr.inc" |
|
|
38 | (3) |
|
2.6 Contents of the File "PICPLC_PIC16F1847_macros_Bsc.inc" |
|
|
41 | (46) |
|
|
43 | (3) |
|
|
46 | (1) |
|
2.6.3 Elimination of Contact Bouncing Problem in the PIC16F1847-Based PLC |
|
|
47 | (1) |
|
2.6.3.1 Contact Bouncing Problem |
|
|
47 | (1) |
|
2.6.3.2 Understanding a Generic Single I/O Contact Debouncer |
|
|
48 | (4) |
|
2.6.3.3 Debouncer Macro "dbncrN" |
|
|
52 | (3) |
|
|
55 | (15) |
|
2.6.5 Low-Pass Digital Filter Macro "lpf_progs" |
|
|
70 | (7) |
|
2.6.6 Macro "send_outputs" |
|
|
77 | (10) |
|
|
87 | (17) |
|
|
88 | (1) |
|
|
89 | (1) |
|
|
90 | (2) |
|
|
92 | (3) |
|
|
95 | (4) |
|
|
99 | (5) |
|
|
104 | (1) |
|
Chapter 3 Contact and Relay-Based Macros |
|
|
105 | (66) |
|
|
105 | (1) |
|
|
106 | (1) |
|
3.2 Macro "Id_not" (load_not) |
|
|
107 | (1) |
|
|
108 | (1) |
|
|
108 | (1) |
|
|
109 | (2) |
|
|
111 | (1) |
|
|
111 | (2) |
|
|
113 | (2) |
|
|
115 | (1) |
|
|
116 | (1) |
|
|
116 | (2) |
|
|
118 | (1) |
|
|
118 | (1) |
|
|
119 | (3) |
|
3.15 Macro "mid_out" (Midline Output) |
|
|
122 | (1) |
|
3.16 Macro "mid_out_not" (Inverted Midline Output) |
|
|
122 | (1) |
|
|
123 | (2) |
|
|
125 | (1) |
|
|
126 | (1) |
|
|
127 | (1) |
|
3.21 Macro "SR." (Set-Reset) |
|
|
128 | (1) |
|
3.22 Macro "RS" (Reset-Set) |
|
|
128 | (2) |
|
3.23 Macro "r_edge" (Rising Edge Detector) |
|
|
130 | (2) |
|
3.24 Macro "f_edge" (Falling Edge Detector) |
|
|
132 | (1) |
|
3.25 Macro "r_toggle" (Output Toggle with Rising Edge Detector) |
|
|
132 | (1) |
|
3.26 Macro "f_toggle" (Output Toggle with Falling Edge Detector) |
|
|
133 | (1) |
|
3.27 Macro "adrs_re" (Address Rising Edge Detector) |
|
|
134 | (1) |
|
3.28 Macro "adrs_fe" (Address Falling Edge Detector) |
|
|
135 | (1) |
|
3.29 Macro "setBF" (Set Bit Field) |
|
|
136 | (13) |
|
3.30 Macro "resetBF" (Reset Bit Field) |
|
|
149 | (1) |
|
3.31 Examples for Contact and Relay-Based Macros |
|
|
149 | (22) |
|
|
156 | (1) |
|
|
157 | (2) |
|
|
159 | (1) |
|
|
160 | (5) |
|
|
165 | (1) |
|
|
165 | (1) |
|
|
165 | (2) |
|
|
167 | (4) |
|
Chapter 4 Flip-Flop Macros |
|
|
171 | (116) |
|
|
171 | (1) |
|
4.1 Macro "latch1" (D Latch with Active High Enable) |
|
|
171 | (1) |
|
4.2 Macro "latch0" (D Latch with Active Low Enable) |
|
|
172 | (1) |
|
4.3 Macro "dff_r" (Rising Edge-Triggered D Flip-Flop) |
|
|
173 | (1) |
|
4.4 Macro "dff_r_SR" (Rising Edge-Triggered D Flip-Flop with Active High Preset [ S] and Clear [ R] Inputs) |
|
|
174 | (3) |
|
4.5 Macro "dff_f" (Falling Edge-Triggered D Flip-Flop) |
|
|
177 | (2) |
|
4.6 Macro "dff_f_SR" (Falling Edge-Triggered D Flip-Flop with Active High Preset [ S] and Clear [ R] Inputs) |
|
|
179 | (3) |
|
4.7 Macro "tff_r" (Rising Edge-Triggered T Flip-Flop) |
|
|
182 | (1) |
|
4.8 Macro "tff_r_SR" (Rising Edge-Triggered T Flip-Flop with Active High Preset [ S] and Clear [ R] Inputs) |
|
|
182 | (3) |
|
4.9 Macro "tff_f" (Falling Edge-Triggered T Flip-Flop) |
|
|
185 | (2) |
|
4.10 Macro "tff_f_SR" (Falling Edge-Triggered T Flip-Flop with Active High Preset [ S] and Clear [ R] Inputs) |
|
|
187 | (1) |
|
4.11 Macro "jkff_r" (Rising Edge-Triggered JK Flip-Flop) |
|
|
188 | (3) |
|
4.12 Macro "jkff_r_SR" (Rising Edge-Triggered JK Flip-Flop with Active High Preset [ S] and Clear [ R] Inputs) |
|
|
191 | (2) |
|
4.13 Macro "jkff_f" (Falling Edge-Triggered JK Flip-Flop) |
|
|
193 | (1) |
|
4.14 Macro "jkff_f_SR" (Falling Edge-Triggered JK Flip-Flop with Active High Preset [ S] and Clear [ R] Inputs) |
|
|
194 | (3) |
|
4.15 Examples for Flip-Flop Macros |
|
|
197 | (90) |
|
|
203 | (3) |
|
|
206 | (3) |
|
|
209 | (2) |
|
|
211 | (1) |
|
4.15.5 Example 4.5: 4-Bit Asynchronous Up Counter |
|
|
212 | (5) |
|
4.15.6 Example 4.6: 4-Bit Asynchronous Down Counter |
|
|
217 | (3) |
|
4.15.7 Example 4.7: Asynchronous Decade Counter |
|
|
220 | (2) |
|
4.15.8 Example 4.8: 4-Bit Asynchronous Up/Down Counter |
|
|
222 | (5) |
|
4.15.9 Example 4.9: Synchronous Decade Counter |
|
|
227 | (5) |
|
4.15.10 Example 4.10: 4-Bit Synchronous Up/Down Counter |
|
|
232 | (4) |
|
4.15.11 Example 4.11: 4-Bit Serial-in, Parallel-out Shift Right Register |
|
|
236 | (6) |
|
4.15.12 Example 4.12: 4-Bit Serial-in, Serial-out Shift Right Register |
|
|
242 | (3) |
|
4.15.13 Example 4.13: 4-Bit Serial-In, Parallel-Out Shift Right or Shift Left Register |
|
|
245 | (4) |
|
4.15.14 Example 4.14: 4-Bit Parallel-in, Serial-out Shift Right Register |
|
|
249 | (2) |
|
4.15.15 Example 4.15: 4-Bit Parallel-in, Parallel-out Register |
|
|
251 | (1) |
|
4.15.16 Example 4.16: 74164 8-Bit Serial-in, Parallel-out Shift Register |
|
|
252 | (5) |
|
4.15.17 Example 4.17: 74165 8-Bit Parallel-in, Serial-out Shift Register |
|
|
257 | (4) |
|
4.15.18 Example 4.18: 74194 4-Bit Bidirectional Universal Shift Register |
|
|
261 | (5) |
|
4.15.19 Example 4.19: 74595 8-Bit Serial-in, Serial- or Parallel-out Shift Register |
|
|
266 | (5) |
|
4.15.20 Example 4.20: 4-Bit Johnson Counter |
|
|
271 | (7) |
|
4.15.21 Example 4.21: 8-Bit Ring Counter |
|
|
278 | (9) |
|
|
287 | (100) |
|
|
287 | (1) |
|
|
288 | (1) |
|
5.2 Macro "TON_8" (8-Bit On-Delay Timer) |
|
|
288 | (8) |
|
5.3 Macro "TON_16" (16-Bit On-Delay Timer) |
|
|
296 | (5) |
|
5.4 Retentive On-Delay Timer (RTO) |
|
|
301 | (1) |
|
5.5 Macro "RTO_8" (8-Bit Retentive On-Delay Timer) |
|
|
302 | (4) |
|
5.6 Macro "RTO_16" (16-Bit Retentive On-Delay Timer) |
|
|
306 | (5) |
|
5.7 Off-Delay Timer (TOF) |
|
|
311 | (1) |
|
5.8 Macro "TOF_8" (8-Bit Off-Delay Timer) |
|
|
311 | (5) |
|
5.9 Macro "TOF_16" (16-Bit Off-Delay Timer) |
|
|
316 | (5) |
|
|
321 | (1) |
|
5.11 Macro "TP_8" (8-Bit Pulse Timer) |
|
|
321 | (5) |
|
5.12 Macro "TP_16" (16-Bit Pulse Timer) |
|
|
326 | (5) |
|
5.13 Extended Pulse Timer (TEP) |
|
|
331 | (1) |
|
5.14 Macro "TEP_8" (8-Bit Extended Pulse Timer) |
|
|
332 | (4) |
|
5.15 Macro "TEP_16" (16-Bit Extended Pulse Timer) |
|
|
336 | (5) |
|
5.16 Oscillator Timer (TOS) |
|
|
341 | (1) |
|
5.17 Macro "TOS_8" (8-Bit Oscillator Timer) |
|
|
342 | (5) |
|
5.18 Macro "TOS_16" (16-Bit Oscillator Timer) |
|
|
347 | (6) |
|
5.19 Examples for Timer Macros |
|
|
353 | (34) |
|
|
353 | (6) |
|
|
359 | (5) |
|
|
364 | (6) |
|
|
370 | (5) |
|
|
375 | (6) |
|
|
381 | (6) |
|
|
387 | (98) |
|
|
387 | (3) |
|
|
390 | (5) |
|
6.2 Macro "CTU_8" (8 Bit Up Counter) |
|
|
395 | (7) |
|
6.3 Macro "CTU_16" (16 Bit Up Counter) |
|
|
402 | (5) |
|
|
407 | (1) |
|
6.5 Macro "CTD_8" (8 Bit Down Counter) |
|
|
407 | (6) |
|
6.6 Macro "CTD_16" (16 Bit Down Counter) |
|
|
413 | (4) |
|
6.7 Up/Down Counter (CTUD) |
|
|
417 | (1) |
|
6.8 Macro "CTUD_8" (8 Bit Up/Down Counter) |
|
|
418 | (8) |
|
6.9 Macro "CTUD_16" (16 Bit Up/Down Counter) |
|
|
426 | (9) |
|
6.10 Generalized Up/Down Counter (GCTUD) |
|
|
435 | (2) |
|
6.11 Macro "GCTUD_8" (Generalized 8 Bit Up/Down Counter) |
|
|
437 | (7) |
|
6.12 Macro "GCTUD.16" (Generalized 16 Bit Up/Down Counter) |
|
|
444 | (9) |
|
6.13 Examples for Counter Macros |
|
|
453 | (32) |
|
|
454 | (6) |
|
|
460 | (6) |
|
|
466 | (5) |
|
|
471 | (5) |
|
|
476 | (3) |
|
|
479 | (6) |
About the Downloadable Files for Hardware and Basic Concepts |
|
485 | (2) |
Index |
|
487 | |