PART 4 TRAINING DELAY Dosen : Dwisnanto Putro, ST, M.Eng
LED (LIGHT EMITING DIODE) •
Untuk LED ANODA :
Logika 0 = led menyala
Logika 1 = led mati •
Untuk LED KATODA :
Logika 0 = led mati Logika 1 = led menyala
Published By Stefanikha69
Published By Stefanikha69
Published By Stefanikha69
•DELAY • Delay
= tunda
• Penundaan
terhadap kinerja mikrokontroler
Published By Stefanikha69
•DELAY • •
Menghasilkan delay dalam program-C berada pada header delay.h yang harus dimasukan (include) sebelum digunakan. Sebelum memanggil fungsi, interupsi harus dimatikan terlebih dahulu, apabila tidak maka delay akan lebih lama dari yang diharapkan. Juga sangat penting untuk menyebutkan frekuensi clock chip IC AVR yang digunakan pada menu Project – configure - C compiler - Code Generation.
Published By Stefanikha69
•DELAY •
Header delay
#include <delay.h> •
Perintah delay
delay_ms(------); Waktu tunda dalam milidetik: Misalkan: delay_ms(1000); berarti ditunda selama 1 detik
Published By Stefanikha69
•DELAY •
Dengan system delay, menciptakan system sinyal pulsa
Published By Stefanikha69
•New Project • Run
CodeVision
Published By Stefanikha69
Published By Stefanikha69
• Chip
select
Published By Stefanikha69
configuration chip select • Chip ATMEGA 8535 • Clock 8.000000 Mhz
Published By Stefanikha69
• Untuk
port gunakan PORTC untuk LED PORTC.0 – PORTC.7 = output (0)
Published By Stefanikha69
• Save
and Generate
Published By Stefanikha69
• Save
File – make folder and files
Published By Stefanikha69
• Display
Published By Stefanikha69
•Configuration ready compile
Published By Stefanikha69
Published By Stefanikha69
•CODE PROGRAM •
Untuk menyalakan led bergantian misalkan pada posisi PORTC.0, PORTC.1 dan PORTC.2 dengan masing-masing waktu tunda selama 1 detik. (jadi waktu keseluruhan yang dibutuhkan sistem yaitu 3 detik) while(1){ PORTC=0b11111110; Delay_ms(1000); PORTC=0b11111101; Delay_ms(1000); PORTC=0b11111011; Delay_ms(1000); }}
Published By Stefanikha69
SETTING USB – DOWNLOADER : • •
INSTALL DEVICE USB DOWNLOADER CONNECT USB DOWNLOADER TO PC/LAPTOP
SETTING COM PORT: • •
COMPUTER -> MANAGE -> DEVICE MANAGER PORT (COM &LPT) -> PROLIFIC USB TO SERIAL COMM PORT (COM....)
Published By Stefanikha69
•Configuration PORT Programmer
Published By Stefanikha69
Choice : • AVR Chip programmer type • COM PORT • BAUD RATE
Published By Stefanikha69
•COMPILER AND BUILD ALL PROGRAM
Or Shift F9 Published By Stefanikha69
• Connecting
USB Downloader - PC/Laptop Microcontroller, And....
Published By Stefanikha69
• Process
Downloading.........
Published By Stefanikha69
FINISH
Published By Stefanikha69
• Error
DOWNLOADING
Solution : • Check COM PORT • Check Baud Rate • Check Connection Downloader • Check Prog/Serial TTL select Published By Stefanikha69
•CV AVR WITH PROTEUS OPEN PROGRAM ISIS PROTEUS PROFESSIONAL
Published By Stefanikha69
•synchronization cv avr with proteus • Creat
Project and Design • Double click pict microcntroller
Published By Stefanikha69
•synchronization cv avr with proteus • Select
clock frequency • Select program file, (HEX file type)
Published By Stefanikha69
•synchronization cv avr with proteus
• Running
ISIS Proteus
• FINISH... Created by. Dwisnanto Putro, Manado, September 2012
Published By Stefanikha69
TASK • BUATLAH
project dengan system led berjalan pada PORTC.7, PORTC.6 dan PORTC.5 dengan masing-masing delay 250 ms
Published By Stefanikha69
TASK • BUATLAH
project dengan system led berjalan pada PORTC.0, PORTC.2, PORTC.4 dan PORTC.6 dengan sistem led menyala secara berurutan bergantian. masingmasing delay 100 ms.
Published By Stefanikha69
TASK • BUATLAH project dengan system led berjalan pada PORTC.0 s/d PORTC.3. masing-masing delay 150 ms. Misalkan: • Step 1: hanya PORTC.0 menyala • Step 2: hanya PORTC.1 menyala • Step 3: hanya PORTC.2 menyala • Step 4: hanya PORTC.3 menyala
Published By Stefanikha69
TASK BUATLAH project dengan system led berjalan pada PORTC.1 s/d PORTC.6. masing-masing delay 100 ms. Misalkan: • Step 1: hanya PORTC.1 mati • Step 2: hanya PORTC.2 mati • Step 3: hanya PORTC.3 mati • Step 4: hanya PORTC.4 mati • Step 5: hanya PORTC.5 mati • Step 6: hanya PORTC.6 mati (PORTC Yang lain menyala) •
Published By Stefanikha69
TASK • BUATLAH
project dengan system led berjalan pada PORTC.0 s/d PORTC.7. masing-masing delay 100 ms. (Secara berurutan menyala dari PORTC.0 s/d PORTC.7)
Published By Stefanikha69
TASK • BUATLAH
project dengan system led berjalan pada PORTC.0 s/d PORTC.7. masing-masing delay 100 ms. (Secara berurutan menyala dari PORTC.7 s/d PORTC.0)
Published By Stefanikha69
TASK • BUATLAH
project dengan system led berjalan pada PORTC.0 s/d PORTC.7. masing-masing delay 100 ms. Misalkan: • Step 1: PORTC.0 dan PORTC.7 ON • Step 2: PORTC.1 dan PORTC.6 ON • Step 3: PORTC.2 dan PORTC.5 ON • Step 4: PORTC.3 dan PORTC.4 ON
Published By Stefanikha69
TASK BUATLAH project dengan system led berjalan pada PORTC.0 s/d PORTC.7. masing-masing delay 100 ms. Misalkan: • Step 1: PORTC.0 dan PORTC.7 ON • Step 2: PORTC.1 dan PORTC.6 ON • Step 3: PORTC.2 dan PORTC.5 ON • Step 4: PORTC.3 dan PORTC.4 ON • Step 5: PORTC.2 dan PORTC.5 ON • Step 6: PORTC.1 dan PORTC.6 ON • Step 7: PORTC.0 dan PORTC.7 ON •
Published By Stefanikha69