(:    WELCOME    :)

 

TO

 

"PLC with PIC16F648A Microcontroller"

 

This page explains and provides you with all necessary information, tools, hardware, software, etc. for a PIC PLC project called "UZAM_PLC with PIC16F648A".

 

 

 

Abstract: Programmable Logic Controllers (PLC) have been extensively used in industry for the past five-six decades. PLC manufacturers offer different PLCs in terms of functions, program memories, and the number of inputs/outputs (I/O), ranging from a few to thousands of I/Os. The design and implementation of PLCs have long been a secret of the PLC manufacturers. As a microprocessor based technology, the functionality of a PLC is well-known from the end-user (programmer) point of view, but by now no serious work has been reported to describe a microprocessor/microcontroller based implementation of a PLC. With a series of articles, to be published in "ELECTRONICS WORLD" magazine we aim at describing a PIC microcontroller based design and implementation of a PLC, called UZAM_PLC with PIC16F648A.

 

 

This project has been completed in search for the answer to the question “how one could design and implement a PLC?”. The answer to this question was partially found by the author in the freely available PLC project called “PICBIT” about 10 years ago. The reader could make an internet search for the keyword “PICBIT” and could find this project. PICBIT describes a PIC16F84 microcontroller based PLC with five discrete inputs and eight discrete outputs. The file called “picbit.inc” of PICBIT contains the basic PLC macro definitions. UZAM_PLC project has been completed by the inspiration of these macros. Of course so many new features have been included within UZAM_PLC project to make it almost a perfect PLC. The reader should be aware of the fact that this project does not include graphical interface PC software as in PICBIT or in other PLCs for developing PLC programs. Rather, PLC programs are developed by using macros as done in the Instruction List (IL) PLC programming language. An interested and skilled reader could well (and encouraged to) develop graphical interface PC software for easy use of UZAM_PLC.

 

The reader is expected to be familiar with PLCs, PIC microcontrollers and PIC Assembly language. UZAM_PLC macros are developed by using PIC Assembly language. The program development environment used is that of MPLAB IDE (www.microchip.com).

 

 

Some Photos of UZAM_PLC with PIC16F648A "main board" and "I/O Extension Board"

 

 

UZAM_PLC with PIC16F648A "main board" and "I/O Extension Board" SCHEMATICS

 

 

UZAM_PLC with PIC16F648A "main board" and "I/O Extension Board" PCB FILES

 

 

PIC Programmer hardwares and Softwares together with PCB files for "UZAM_PLC with PIC16F648A"

 

 

To obtain a copy of the MPLAB IDE click here (www.microchip.com) 

 

 

For technical data about the utilized ICs click here 

 

 

 

All 22 articles and files related to these articles:

   22 articles :

 

  files related to these articles :

     UZAM_PLC_EW_22_articles.zip

     UZAM_PLC_with_PIC16F648A_EW_ALL_Article_files.zip   

 

 

The articles published are as follows: The files for the articles
1. The Hardware: This is the first article explaining the hardware of the UZAM_PLC with PIC16F648A:

M. Uzam, PLC with PIC16F648A Microcontroller (Part 1),”

Electronics World

Volume 114, Issue 1871, November 2008, pp. 21-25.

  ew_part1_2008.zip

2. The Basic Software: This article explains the basic software structure of the UZAM_PLC. A PLC scan cycle includes the following: 1. obtain the inputs, 2. run the user program, 3. update the outputs. In addition it is also necessary to define and initialize all variables used within a PLC. Necessary functions are all described as PIC Assembly macros to be used in UZAM_PLC. The macros described in this article could be summarized as follows: “HC165” (for handling the inputs), “HC595” (for sending the outputs), “dbncr” (for debouncing the inputs), “initialize”, “get_inputs”, “send_outputs”.

   M. Uzam, PLC with PIC16F648A Microcontroller Part 2,”

   Electronics World

   Volume 114, Issue 1872, December 2008, pp. 29-35.           

  ew_part2_2008.zip

  article_2_files.zip

3. Contact and Relay Based Macros: The following contact and relay based macros are described in this article: ld (load), ld_not (load_not), not, or, or_not, nor, and, and_not, nand, xor, xor_not, xnor, out, out_not, in_out, inv_out, set, reset. These macros are defined to operate on one bit variables.

M. Uzam, PLC with PIC16F648A Microcontroller Part 3,”

Electronics World

Volume 115, Issue 1873, January 2009, pp. 30-34.           

  ew_part3_2009.zip

  article_3_files.zip

4. Flip-Flop Based Macros: The following flip-flop based macros are described in this article: r_edge (rising_edge), f_edge (falling_edge), latch0, latch1, dff_r (rising edge triggered D flip-flop), dff_f (falling edge triggered D flip-flop), tff_r (rising edge triggered T flip-flop), tff_f (falling edge triggered T flip-flop), jkff_r (rising edge triggered JK flip-flop), jkff_f (falling edge triggered JK flip-flop).

   M. Uzam, PLC with PIC16F648A Microcontroller Part 4,”

    Electronics World

    Volume 115, Issue 1874, February 2009, pp. 34-40.

  ew_part4_2009.zip

  article_4_files.zip

5. Timer Macros: The following timer macros are described in this article: TON_8 (ON delay timer), TOF_8 (OFF delay timer), TEP_8 (Extended Puls timer), TOS_8 (Oscillator timer).

    M. Uzam, PLC with PIC16F648A Microcontroller - Part 5,”

    Electronics World, Volume 115, Issue 1875, March 2009, pp. 30-33.

 ew_part5_2009.zip

  article_5_files.zip 

    M. Uzam, PLC with PIC16F648A Microcontroller - Part 6,”

    Electronics World, Volume 115, Issue 1876, April 2009, pp. 26-30.

 ew_part6_2009.zip

 article_6_files.zip

6. Counter Macros: The following counter macros are described in this article: CTU_8 (Up Counter), CTD_8 (Down Counter), CTUD_8 (Up/Down Counter).

    M. Uzam, PLC with PIC16F648A Microcontroller - Part 7,”

    Electronics World, Volume 115, Issue 1877, May 2009, pp. 30-32.  

 ew_part7_2009.zip

 article_7_files.zip

    M. Uzam, PLC with PIC16F648A Microcontroller - Part 8,”

    Electronics World, Volume 115, Issue 1878, June 2009, pp. 30-32.

 ew_part8_2009.zip

 article_8_files.zip

7. Comparison Macros: The following comparison macros are described in this article: The contents of two registers (R1 and R2) are compared according to the following: GT (Greater Than – “>”), GE (Greater than or Equal to – “”), EQ (EQual to – “=”), LT (Less Than – “<”), LE (Less than or Equal to – “”), NE (Not Equal to – “”). Similar comparison macros are also described for comparing the contents of an 8 bit register (R) with an 8 bit constant (K).

M. Uzam, PLC with PIC16F648A Microcontroller - Part 9,”          

Electronics World, Volume 115, Issue 1879, July 2009, pp. 29-34. 

 ew_part9_2009.zip

 article_9_files.zip 

8. Arithmetical Macros: The following arithmetical macros are described in this article: The following operators are applied to the contents of two registers (R1 and R2): ADD, SUB (subtract), INC (increment), DEC (decrement). Similar arithmetical macros are also described to be used with the contents of an 8 bit register (R) and an 8 bit constant (K).

   M. Uzam, PLC with PIC16F648A Microcontroller - Part 10,”

   Electronics WorldVolume 115, Issue 1880, August 2009, pp. 29-34. 

 ew_part10_2009.zip

 article_10_files.zip  

9. Logical Macros: The following logical macros are described in this article: inv_R, AND, NAND, OR, NOR, XOR, XNOR. These macros are applied to an 8 bit register (R1) with another register (R2) or an 8 bit constant (K).

   M. Uzam, PLC with PIC16F648A Microcontroller - Part 11,”

   Electronics WorldVolume 115, Issue 1881, September 2009, pp. 38-42.

 ew_part11_2009.zip

 article_11_files.zip   

10. Shift & Rotate Macros: The following Shift & Rotate macros are described in this article: SHIFT_R (shift right the contents of register R), SHIFT_L (shift left the contents of register R), ROTATE_R (rotate right the contents of register R), ROTATE_L (rotate left the contents of register R), SWAP (swap the nibbles of the register).

   M. Uzam, PLC with PIC16F648A Microcontroller - Part 12,”

   Electronics World Volume 115, Issue 1882, October 2009, pp. 36-41.

 ew_part12_2009.zip

 article_12_files.zip   

11. Multiplexer Macros: The following multiplexer macros are described in this article: mux_2_1 (2x1 MUX), mux_2_1_E (2x1 MUX with Enable input), mux_4_1 (4x1 MUX), mux_4_1_E (4x1 MUX with Enable input), mux_8_1 (8x1 MUX), mux_8_1_E (8x1 MUX with Enable input).

   M. Uzam, PLC with PIC16F648A Microcontroller - Part 13,”

   Electronics World, Volume 115, Issue 1883, November 2009, pp. 42-44.

 ew_part13_2009.zip

 article_13_files.zip   

   M. Uzam, PLC with PIC16F648A Microcontroller  - Part 14,”

   Electronics World, Volume 115, Issue 1884, December 2009, pp. 40-42.

 ew_part14_2009.zip

 article_14_files.zip 

12. DeMultiplexer Macros: The following demultiplexer macros are described in this article: Dmux_1_2 (1x2 DMUX), Dmux_1_2_E (1x2 DMUX with Enable input), Dmux_1_4 (1x4 DMUX), Dmux_1_4_E (1x4 DMUX with Enable input), Dmux_1_8 (1x8 DMUX), Dmux_1_8_E (1x8 DMUX with Enable input).

   M. Uzam, PLC with PIC16F648A Microcontroller  - Part 15,”

   Electronics WorldVolume 116, Issue 1885, January 2010, pp. 35-39.

 ew_part15_2010.zip

 article_15_files.zip 

   M. Uzam, PLC with PIC16F648A Microcontroller Part 16,”                  

   Electronics World, Volume 116, Issue 1886, February 2010, pp. 41-42. 

 ew_part16_2010.zip

 article_16_files.zip 

13. Decoder Macros: The following decoder macros are described in this article: decod_1_2 (1x2 decoder), decod_1_2_E (1x2 decoder with Enable input), decod_2_4 (2x4 decoder), decod_2_4_E (2x4 decoder with Enable input), decod_3_8 (3x8 decoder), decod_3_8_E (3x8 decoder with Enable input).

   M. Uzam, PLC with PIC16F648A Microcontroller Part 17,”

   Electronics WorldVolume 116, Issue 1887, March 2010, pp. 41-43. 

 ew_part17_2010.zip

 article_17_files.zip 

   M. Uzam, PLC with PIC16F648A Microcontroller Part 18,”

   Electronics World, Volume 116, Issue 1888, April 2010, pp. 41-43. 

 ew_part18_2010.zip

 article_18_files.zip

14. Priority Encoder Macros: The following priority encoder macros are described in this article: encod_4_2_p (4x2 priority encoder), encod_4_2_p_E (4x2 priority encoder with Enable input), encod_8_3_p (8x3 priority encoder), encod_8_3_p_E (8x3 priority encoder with Enable input), encod_dec_bcd_p {decimal to BCD(Binary Coded Decimal) priority encoder}, encod_dec_bcd_p_E (decimal to BCD priority encoder with Enable input).

   M. Uzam, PLC with PIC16F648A Microcontroller  Part 19,”

   Electronics WorldVolume 116, Issue 1889, May 2010, pp. 39-43.

 ew_part19_2010.zip

 article_19_files.zip

   M. Uzam, PLC with PIC16F648A Microcontroller  Part 20,”    

   Electronics World, Volume 116, Issue 1890, June 2010, pp. 38, 40.

 ew_part20_2010.zip

 article_20_files.zip

15. An Example: This article describes an example remotely controlled model gate system and makes use of UZAM_PLC to control it for different control scenarios.

   M. Uzam, PLC with PIC16F648A Microcontroller  Part 21,”

   Electronics WorldVolume 116, Issue 1891, July 2010, pp. 40-41.

 ew_part21_2010.zip

   M. Uzam, PLC with PIC16F648A Microcontroller  Part 22,”

   Electronics World, Volume 116, Issue 1892, August 2010, pp. 40-42.

 ew_part22_2010.zip

 article_22_files.zip

 

NOTE THAT Electronics World is indexed in Science Citation Index Expanded (SCIE).

 

ACKNOWLEDGEMENT

I am grateful to Mr. Gökhan GELEN (http://host.nigde.edu.tr/ggelen/ ; ggelen@nigde.edu.tr) for his great effort for drawing the PCBs and for producing the prototypes of the “main board”, “I/O extension board”, “BRENNER programmer” and “JDM programmer”. Without his help this project could have delayed for years.