You are on page 1of 24

1 - PLC’s advanced

instructions
HANDY WICAKSONO
Overview
Review instruksi bit Data movement instruction
Analog system in PLC Comparison instruction
Addressing and data type in PLC Math instruction
Conversion instruction
Shift instruction
Logic instruction
Other instructions
So Machine Basic for
M221 PLC for Schneider
Review instruksi bit
Contact: NO – NC , normal – positive
transition – negative transition
Coil: Normal – Set & Reset
Timer: TON, TOF, TP
Counter: CU, CD

Please (re)learn it on your own time!


Sistem analog pada PLC (1)
Bit hanya menggunakan nilai 0/1, analog menggunakan range nilai
Sistem analog memerlukan 2 modul berikut:
◦ Modul Analog Input : Analog to Digital Converter
◦ Modul Analog Output : Digital to Analog Converter

Analog CPU Analog


Input Output
Berapa range Berapa range
tegangan/arus? tegangan/arus?
Berapa Berapa
range nilai? (Digital) range nilai?
Sistem analog pada PLC (2)
Contoh pada PLC M221 (TM221ME16T)
◦ 2 analog input (0 – 10V)
◦ Resolusi: 10 bit
◦ LSB value: 10 mV
◦ Range nilai pada PLC: 0 – 1000 (fixed)
Sistem analog pada PLC (3)
Contoh: modul analog input TM3AI2H
◦ 2 analog input
◦ Bisa memilih jenis input: 4…20 mA, 0…20mA, 0…10V, -10…10V
◦ Resolusi: 15 bits + sign, 16 bits
◦ LSB value: 3.91 A, 4.88 A, 2.44 mV, 4.88 mV
◦ Range nilai pada PLC: adjustable (antara -32768 sampai 32767)
Addressing (1)
Addressing in M221 PLC: %<Type>[<Identifier>]<Location>
Type:
Addressing (2)
Identifier:
Data type
Ukuran data: bit, byte, word, double word
Format data analog: integer, floating point
Extracting bit from analog data
Constructing analog data from several bit data
Word object (1)
Word object terdiri dari 16 bit, berisi nilai integer -32768 – 32767,
atau nilai heksadesimal 16#0000 – 16#FFFF

Dalam signed binary notation, bit ke 15 sebagai sign


◦ 0 berarti tanda + , 1 berarti tanda –
Contoh word object: %MWi, %KWi, %IWi, %QWi, %SWi
Word object (2)
Extracting bit from a word
Double word dan floating point
Double word object terdiri dari 32 bit (4 byte data), dari -
2147483648 sampai +2147483647
Floating point object ialah bilangan real (contoh: 2.3 , 3.4E+2)
Floating point format:

Note: tidak selalu didukung oleh semua PLC


Possibility of overlap between objects
Advanced instruction in
So Machine Basic
Jenis – jenis blok untuk mengakses instruksi lanjut:
◦ Operation block
◦ Assignment, math, conversion, shifting, etc.
◦ Comparison block
◦ Compare
◦ Function block
◦ Timer, counter, drum controller, RTC, etc.
◦ Other ladder items
Function block Other ladder items

Comparison block Operation block


Data movement/assignment instruction
Untuk memindahkan konstanta atau data alamat tertentu ke alamat
yang lain
◦ %MW0 := 500
◦ %MW0 := %IW0.0
◦ %Q0.0:8 :=%M64:8
Catatan: tipe data dari 2 obyek dalam operasi ini harus sama (bit,
byte, word, double word, float)

Operation block
Exercise: Penampilan kode error
• Sistem penampilan kode
error sederhana
• Jika ada error di lokasi
tertentu, operator akan
menekan tombol tertentu
• Berikut konfigurasinya
• PB1 on, kode = 1
• PB2 on, kode = 2
• PB3 on, kode = 3
• PB4 on, kode = 4
• Saat PB manapun ditekan,
alarm akan berbunyi

%QW0.0: analog
output untuk display

17
Comparison
Membandingkan dua buah obyek (konstanta atau isi suatu alamat)
Operator: = , <> , < , <= , > , >=
Catatan: tipe data dari 2 obyek dalam operasi ini harus sama (bit,
byte, word, double word, float)
Contoh:

Comparison block
Exercise (1)
Sensor suhu: %IW0.0
Alarm low: %Q0.0 , lampu normal: %Q0.1, alarm high: %Q0.2

0 200 800 1000


Exercise (2)
Start PB: %I0.0
Stop PB: %I0.1
(400) (100)
Sensor level: %IW0.0
Sensor suhu: %IW0.1
ValveA: %Q0.0
ValveB: %Q0.1 Sensor suhu 500oC
ValveC: %Q0.2
Heater: %Q0.3
- Saat STOP ditekan, Valve A
dan Valve B mati, jika tangki C
ada cairan harus dikosongkan
Math instruction (1)
Operator aritmetika pada tipe data integer
◦ + , - , * , / , REM, SQRT, INC, DEC, ABS
Contoh:
◦ %MW0 := %IW0 * 2 + 500 - %MW1

Ladder diagram:

Operation block
Exercise (1) – tempat parkir otomatis

• Kerjakan soal ini


tanpa menggunakan
counter
• Jika jumlah mobil >=
5, lampu penuh aktif

22
Exercise (2) – Cutting • Cutting machine berfungsi untuk
memotong produk A, B, atau C
machine yang datang secara acak
• Pisau harus diganti jika sudah
memotong 2 produk A, atau 5
produk B, atau 10 produk C
• Cara kerja:
• Start ditekan mesin siap
• Sensor produk akan
mendeteksi jenis produk
• Saat sensor cutter
mendeteksi produk, cutter
akan aktif selama 3 detik
• Jika pisau sudah tumpul,
buzzer aktif, mesin mati
• Pisau diganti secara manual
23
Persiapan:
◦ Gunakan analog input tambahan TUGAS 1 (REVISI)
◦ Berikan set point volume air di tangki C pada alamat %MW0
I/O List:
◦ START_PB(%I0.0), STOP_PB(%I0.1), SEN_LEV_A(%IW0.0),
SEN_LEV_B(%IW0.1), SEN_LEV_C(%IW1.0), SEN_SUHU(%IW1.1)
◦ VALVE_A_IN(%Q0.0), VALVE_B_IN(%Q0.1), VALVE_A_OUT(%Q0.2),
VALVE_B_OUT(%Q0.3), HEATER(%Q0.4)
Cara kerja:
◦ Saat START ditekan, ValveAin dan ValveBin akan menyala
◦ ValveAin mati saat air yang keluar dari tangki A: 80% dari set point.
Lalu ValveAout akan aktif sampai tangki A kosong.
◦ ValveBin mati saat air yang keluar dari tangki B: 20% dari set point.
Lalu ValveBout akan aktif sampai tangki B kosong.
◦ Setelah tangki C terisi air sebanyak set point, heater akan aktif
sampai suhu 50oC, lalu mati
◦ Setelah itu ValveC aktif sampai tangki C kosong
◦ Setelah ValveC mati, ValveAin dan ValveBin menyala lagi, siklus
berulang

You might also like