Belajar PLC dan SCADA

Just another Blog about Programmable Logic Controller & SCADA.

PLC programming languages – Ladder Logic and Advanced Functions

Written by Kang Abu on 9:24 AM

In our last article I mentioned Sequential Function Charts SFC programming language. In this post I will cover advanced functions of ladder logic which allow storage and recovery of bits and words and are useful when implementing buffered and queued systems.

Advanced function are:

  • Arrays
  • Shift registers
  • Stacks
  • Sequencers
  • Branching, looping, subroutines,
  • Temporary ends and one shots
  • Block Transfers
  • Interrupts; timed, fault and input driven
Examples are based on Allen Bradley RSLogix5000

Arrays Functions
Arrays allow us to store multiple data values in sequential series of numbers.
For example, we want to measure average temperature and store it in floating point memory starting at temp[0]. Data will be store in temp[0],temp[1] …[9] because we want to calculate an average of 10 measures
RSLogix5000 average instruction

Array array tag name[]
Dimension to vary [0,1,2] DINT which dimension to use array[0,1,2]
Destination tag result of the operation
Control tag control structure for the operation
Length Number of elements of the array to average
Position Current element in the array initial value is typically 0

Shift Registers

Shift registers are oriented to single data bits. A shift register can only hold so many bits, so when a new bit is put in, one must be removed. In CompactLogix PLC we have BSLbit shift left and BSRbit shift right
When enabled, the BSL instruction starts at bit 0 in array_dint[0]. The instruction unloads array_dint[0].9 into the .UL bit, shifts the remaining bits, and loads input_1 into array_dint[0].0. The remaining bits (10-31) are invalid.
RSLogix5000 shift registers

Stacks FIFO and LIFO

There are two types of stacks; first-on-first-out (FIFO) and last-in-first-out (LIFO). Stacks store integer words in a two ended buffer. As words are pushed on the stack it gets larger, when words are pulled off it gets smaller. When you retrieve a word from a LIFO stack you get the word that is the entry end of the stack. But, when you get a word from a FIFO stack you get the word from the exit end of the stack.
FIFO first in First Out


A sequencer in PLC controller uses a list of words in memory. It recalls the words one at a time and moves the words to another memory location or to outputs. When the end of the list is reached the sequencer will return to the first word and the process begins again.
Allen Bradley RSLogix5000 SQO sequencer

Above we have SQO Output Sequencer which can be used to control traffic lights. Pattern is stored in switch_pattern[0] array. Mask in hex 16#003F allows only to change first 6 bits ( 0000 0011 1111 ) so our pattern looks like this one below:
SQO sequencer pattern

This pattern will be moved to PLC Outputs for traffic light control Lights_ON_Outputs[0] when next_step_bit is executed.

Related Posts by Categories

Widget by Hoctro | Jack Book
Related Posts with Thumbnails

Our Advertising

Bantuan Pencarian

Jika anda seorang pemula dan tertarik untuk belajar PLC silahkan cek artikel di arsip artikel atau gunakan bantuan pencarian artikel di bawah ini. TQ Bro..

Email Subscribe

Dapatkan informasi dan artikel yang update dari situs ini. Jika anda barminat silahkan masukan email address anda di bawah ini. Terimakasih! (Please write email to subscribe our news).

Enter your email address:

Delivered by FeedBurner

Disclaimer (Privacy Policy)

No PDF Files stored in this site. are not responsible if you download and distribute files or links. Noted that not related in any way with upload files with a copyright material that available for download. Just we collects the information using google search and other search engines links hosted or posted by other website. The link Free Book Download available here are for EDUCATIONAL PURPOSES ONLY... and its recommended to buy the products from the original Owner or Publisher.

For Detail Please Click Here!

Jika anda mempunyai artikel sepurtar dunia automation (PLC dan SCADA) dan ingin sharing buat teman-teman blogger silahkan kirim ke

Jika anda menginginkan semua berita yang ada disitus dan links yang ada di situs ini menjadi bagian dari situs yang anda punyai silahkan masukan address ini (copy & paste): di fungsi RSS Feeder situs anda.