1st Edition

PIC16F1847 Microcontroller-Based Programmable Logic Controller Hardware and Basic Concepts

By Murat Uzam Copyright 2021
    520 Pages 421 B/W Illustrations
    by CRC Press

    520 Pages 421 B/W Illustrations
    by CRC Press

    Programmable logic controllers (PLCs) have been used extensively and are offered in terms of functions, program memories, and the number of inputs/outputs (I/Os), ranging from a few to thousands. With a focus on how to design and implement a PLC, this volume explains hardware and associated basic concepts of PLC. Authors have used PIC16F1847 microcontroller with: 8192 words of Flash program memory, 1024 bytes of SRAM data memory, 256 bytes of EEPROM data memory, the maximum operating speed of 32 MHz, 16-level deep hardware stack, an enhanced instruction set consisting of 49 single-word instructions. Flowcharts are provided to help the understanding of macros (instructions). Aimed at researchers and graduate students in electrical engineering, power electronics, robotics and automation, sensors, this book:

    Explains how to design and use a PIC16F1847 microcontroller-based PLC.

    Provides easy to use software structures written by using the PIC Assembly programming language.

    Describes a PLC from a designer's perspective.

    Explains the basic hardware and basic software structures of the PIC16F1847 based PLC.

    Focuses on concepts like Contact and Relay Based Macros, Flip-Flop Macros, Timer Macros, Counter Macros and Comparison Macros.

    Chapter 1 - Hardware of the PIC16F1847-Based PLC

    Chapter 2 - Basic Software
     2.1. Definition and Allocation of Variables
     2.2. Contents of the File PICPLC_PIC16F1847_memory.inc
     2.3. Contents of the File PICPLC_PIC16F1847_main.asm
     2.4. Contents of the File PICPLC_PIC16F1847_user.inc
     2.5. Contents of the File PICPLC_PIC16F1847_subr.inc
     2.6. Contents of the File PICPLC_PIC16F1847_macros.inc
     2.7. Example Programs
     2.8. Reference
     
    Chapter 3 - Contact and Relay Based Macros
     3.1. Macro “ld” (load)
     3.2. Macro “ld_not” (load_not)
     3.3. Macro “not” 
     3.4. Macro “or”
     3.5. Macro “or_not”
     3.6. Macro “nor”
     3.7. Macro “and”
     3.8. Macro “and _not”
     3.9. Macro “nand”
     3.10. Macro “xor”
     3.11. Macro “xor_not”
     3.12. Macro “xnor”
     3.13. Macro “out”
     3.14. Macro “out_not”
     3.15. Macro “mid_out” (Midline Output)
     3.16. Macro “mid_out_not” (Inverted Midline Output)
     3.17. Macro “in_out”
     3.18. Macro “inv_out”
     3.19. Macro “_set”
     3.20. Macro “_reset”
     3.21. Macro “SR” (Set-Reset)
     3.22. Macro “RS” (Reset-Set)
     3.23. Macro “r_edge” (rising edge detector)
     3.24. Macro “f_edge” (falling edge detector)
     3.25. Macro “r_toggle” (Output Toggle with Rising Edge Detector)
     3.26. Macro “f_toggle” (Output Toggle with Falling Edge Detector)
     3.27. Macro “adrs_re” (Address Rising Edge Detector)
     3.28. Macro “adrs_fe” (Address Falling Edge Detector)
     3.29. Macro “setBF” (set Bit Field)
     3.30. Macro “resetBF” (reset Bit Field)
     3.31. Examples for Contact and Relay Based Macros

    Chapter 4 - Flip-Flop Macros  
     4.1. Macro latch1 (D latch with active high enable)  
     4.2. Macro latch0 (D latch with active low enable)  
     4.3. Macro “dff_r” (rising edge triggered D flip-flop)  
     4.4. Macro dff_r_SR (rising edge triggered D flip-flop with active high preset (S) and clear (R) inputs)  
     4.5. Macro “dff_f” (falling edge triggered D flip-flop)  
     4.6. Macro dff_f_SR (falling edge triggered D flip-flop with active high preset (S) and clear (R) inputs)  
     4.7. Macro “tff_r” (rising edge triggered T flip-flop)  
     4.8. Macro tff_r_SR (rising edge triggered T flip-flop with active high preset (S) and clear (R) inputs)  
     4.9. Macro “tff_f” (falling edge triggered T flip-flop)  
     4.10. Macro tff_f_SR (falling edge triggered T flip-flop with active high preset (S) and clear (R) inputs)  
     4.11. Macro “jkff_r” (rising edge triggered JK flip-flop)  
     4.12. Macro jkff_r_SR (rising edge triggered JK flip-flop with active high preset (S) and clear (R) inputs)  
     4.13. Macro “jkff_f” (falling edge triggered JK flip-flop)  
     4.14. Macro jkff_f_SR (falling edge triggered JK flip-flop with active high preset (S) and clear (R) inputs)  
     4.15. Examples for Flip-Flop Macros  

    Chapter 5 - Timer Macros
     5.1. On Delay Timer (TON)
     5.2. Macro “TON_8” (8-Bit ON Delay Timer)
     5.3. Macro “TON_16” (16-Bit ON Delay Timer)
     5.4. Retentive On Delay Timer (RTO)
     5.5. Macro “RTO_8” (8-Bit Retentive ON Delay Timer)
     5.6. Macro “RTO_16” (16-Bit Retentive ON Delay Timer)
     5.7. Off Delay Timer  (TOF)
     5.8. Macro “TOF_8” (8-Bit OFF Delay Timer)
     5.9. Macro “TOF_16” (16-Bit OFF Delay Timer)
     5.10. Pulse Timer (TP)
     5.11. Macro “TP_8” (8-Bit Pulse Timer)
     5.12. Macro “TP_16” (16-Bit Pulse Timer)
     5.13. Extended Pulse Timer (TEP)
     5.14. Macro “TEP_8” (8-Bit Extended Pulse Timer)
     5.15. Macro “TEP_16” (16-Bit Extended Pulse Timer)
     5.16. Oscillator Timer (TOS) 
     5.17. Macro “TOS_8” (8-Bit Oscillator Timer)
     5.18. Macro “TOS_16” (16-Bit Oscillator Timer) 
     5.19. Examples for Timer Macros

    Chapter 6 - Counter Macros
     6.1. Up Counter (CTU)
     6.2. Macro “CTU_8” (8-Bit Up Counter)
     6.3. Macro “CTU_16” (16-Bit Up Counter)
     6.4. Down Counter (CTD)
     6.5. Macro “CTD_8” (8-Bit Down Counter)
     6.6. Macro “CTD_16” (16-Bit Down Counter)
     6.7. Up/Down Counter (CTUD)
     6.8. Macro CTUD_8” (8-Bit Up/Down Counter)
     6.9. Macro CTUD_16” (16-Bit Up/Down Counter)
     6.10. Generalized Up/Down Counter (GCTUD)
     6.11. Macro GCTUD_8” (8-Bit Generalized Up/Down Counter)
     6.12. Macro GCTUD_16” (16-Bit Generalized Up/Down Counter)
     6.13. Examples for Counter Macros

    Chapter 7 - Comparison Macros (Available as E-Ancillaries)
     7.1. Macro “R1_GT_R2”
     7.2. Macro “R1_GT_R2_16”
     7.3. Macro “R1_GE_R2” 
     7.4. Macro “R1_GE_R2_16” 
     7.5. Macro “R1_EQ_R2”
     7.6. Macro “R1_EQ_R2_16”
     7.7. Macro “R1_LT_R2”
     7.8. Macro “R1_LT_R2_16”
     7.9. Macro “R1_LE_R2”
     7.10. Macro “R1_LE_R2_16”
     7.11. Macro “R1_NE_R2”
     7.12. Macro “R1_NE_R2_16”
     7.13. Macro “R_GT_K”
     7.14. Macro “R_GT_K_16”
     7.15. Macro “R_GE_K”
     7.16. Macro “R_GE_K_16”
     7.17. Macro “R_EQ_K”
     7.18. Macro “R_EQ_K_16”
     7.19. Macro “R_LT_K”
     7.20. Macro “R_LT_K_16”
     7.21. Macro “R_LE_K”
     7.22. Macro “R_LE_K_16”
     7.23. Macro “R_NE_K”
     7.24. Macro “R_NE_K_16”
     7.25. Macro “in_RANGE”
     7.26. Macro “in_RANGE_16”
     7.27. Macro “out_RANGE”
     7.28. Macro “out_RANGE_16”
     7.29. Macro “Hbit_CaC” (High Bit Count and Compare)
     7.30. Macro “Lbit_CaC” (Low Bit Count and Compare)
     7.31. Examples for Comparison Macros

    Appendix A - List of Components for Boards and Modules (Available as E-Ancillaries)
     Table A.1. Some example universal double sided prototyping printed circuit boards (PCBs) that can be used for the modules developed in this book
     Table A.2. List of components for the PIC16F1847-Based PLC CPU board
     Table A.3. List of components for one I/O extension board only
     Table A.4. List of components for the 5.00V voltage reference module
     Table A.5. List of components for the RC low pass filter module
     Table A.6. List of components for the voltage regulator module

    Biography

    Murat Uzam was borned in Söke, Turkey, in 1968. He received the B.Sc. and M.Sc. degrees from Electrical Engineering Department, Yıldız Technical University, İstanbul, Turkey, 1989 and 1991, respectively, and the Ph.D. degree from University of Salford, Salford, U.K., in 1998. He was with Nigde University, Turkey, from 1993 to 2010 in the Department of Electrical and Electronics Engineering as a Research Assistant, Assistant Professor, Associate Professor and Professor. He was a Professor in the Department of Electrical and Electronics Engineering, at Melikşah University in Kayseri, Turkey from 2011 to 2016. He was a Visiting Researcher with INRIA, University of Metz and University of Rennes, France, in 1999, with University of Toronto, Toronto, ON, Canada, in 2003, and with Xidian University, Xi’an, China, in 2013, 2015 and 2019. Since 15 April 2020, he has been serving as a Professor in the Department of Electrical and Electronics Engineering, at Yozgat Bozok University in Yozgat, Turkey. He has published 50 conference papers and 85 journal and magazine papers, 70 of which are indexed by Science Citation Index Expanded (SCIE). He has published two books in Turkish and one book in English by CRC Press (Taylor & Francis Group). According to Publons, his H-Index is 15 and his papers have been cited 1269 times by the papers indexed in the SCIE. His current research interests include design and implementation of discrete event control systems modeled by Petri nets and, in particular, deadlock prevention/liveness enforcing in flexible manufacturing systems, programmable logic controllers (PLCs), microcontrollers (especially PIC microcontrollers), and design of microcontroller-based PLCs. Dr. Uzam has been serving as a reviewer for prestigious journals and conferences. According to Publons, the number of his verified reviews is 70.