Tutorial, Pendidikan, Media Pembelajaran, Ilmu Pengetahuan.

Tuesday, August 19, 2014

Dasar Pemrograman Bahasa C untuk Mikrokontroller AVR (Pengantar Praktek SKM)

Bahasa C luas digunakan untuk pemrograman berbagai jenis perangkat, termasuk mikrokontroler.
Bahasa ini sudah merupakan high level language, dimana memudahkan programmer menuliskan programnya.

1. Struktur Penulisan Program


#include ( mega16.h )   //mendefinisikan atmega16 tanda kurung ganti dengan tanda lebih kecil dan besar
#include < delay.h >  // defnisi tunda waktu
#define start PINB.1  // variable pengganti
#define stop PINB.2 // variable pengganti

//Variabel Global
Unsigned char ;

void main(void){  // Program Utama
DDRB=0x00; //Inisialisasi PORT INPUT
DDRD=0xFF; //Inisialisasi PORT OUTPUT
While(1)
{
...... //isi program
.... };   }


2. Type Data

char : 1 byte ( -128 s/d 127 )
unsigned char : 1 byte ( 0 s/d 255 )
int : 2 byte ( -32768 s/d 32767 )
unsigned int : 2 byte ( 0 s/d 65535 )
Long : 4 byte ( -2147483648 s/d 2147483647 )
unsigned long : 4 byte ( 0 s/d 4294967295 )
float : bilangan desimal
array : kumpulan data-data yang sama tipenya.

3. Deklarasi Variabel dan Konstanta

Variabel adalah memori penyimpanan data yang nilainya dapat diubah-ubah.
Penulisan : [tipe data] [nama] = [nilai] ;

Konstanta adalah memori penyimpanan data yang nilainya tidak dapat diubah.
Penulisan : const [nama] = [nilai] ;

Tambahan:
Global variabel/konstanta yang dapat diakses di seluruh bagian program.
Local variabel/konstanta yang hanya dapat diakses oleh fungsi tempat dideklarasikannya.

4. Statment

Statement adalah setiap operasi dalam pemrograman, harus diakhiri dengan    ;  atau    }

Statement tidak akan dieksekusi bila diawali dengan tanda  //
untuk satu baris.
Lebih dari 1 baris gunakan pasangan  /* dan  */

Statement yang tidak dieksekusi disebut juga comments atau komentar.


5. Operator Logika


















Share:

11 comments:

Chris Hemsworth said...

The article is so informative. This is more helpful for our
software testing training institute in chennai with placement I software testing class
selenium training in chennai
software testing course in chennai with placement
magento training course in chennai
Thanks for sharing.

cathrine juliet said...

I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..

Big Data Hadoop Training In Chennai | Big Data Hadoop Training In anna nagar | Big Data Hadoop Training In omr | Big Data Hadoop Training In porur | Big Data Hadoop Training In tambaram | Big Data Hadoop Training In velachery





Pathway for German Language said...
This comment has been removed by the author.
Banumadhu said...

Excellent blog thanks for sharing the valuable information..it becomes easy to read and easily understand the information.
Useful article which was very helpful. also interesting and contains good information.
to know about python training course , use the below link.

Python Training in chennai

Python Course in chennai




rajmohan1140 said...

Great information. I will check out the rest of your blog.

Java Training in Chennai

Java Course in Chennai

donaldrsimonn said...
This comment has been removed by a blog administrator.
donaldrsimonn said...
This comment has been removed by a blog administrator.
cyber pc said...

You there, that is totally wonderful declare here. gratitude for taking the term to call such snappish data. outstanding substance material generally gets the site guests coming. Cracked Whatsapp

Silent Girl said...

I needed to gratitude for this outstanding legitimate to apply!! I truly adored all little piece of it. I have you bookmarked your site to try out the presented effects you articulate.. Grammarly Cracked APK

Let2know said...

this is a particularly charming helpful asset which you are offering and you find the money for it away for reasonable. I truly like seeing website that arrangement the charge of providing an energies valuable asset for excuse. Good Morning Sweet Message

Maya said...

That's good news. Thanks, and best of luck.
mIRC

www.rokhmad.com

Blog edukasi Tutorial, Pendidikan, Media Pembelajaran, Ilmu Pengetahuan.

toko Online

SKETCH JWSD ESP

VIDEO PERAKITAN JWSD WIFI

Unduh Library Project jws 1000m

kumpulan sketch JWSD 1000 M

kumpulan sketch JWSD 1000 M
kumpulan sketch JWSD 1000 M

Kumpulan Sketch JWSD

JWSD 2 Panel Full Bluetooth

JWSD 2 Panel Full Bluetooth
JWSD 2 Panel Bluetooth

JWSD 3 panel Bluetooth

JWSD 3 panel Bluetooth
JWSD 3 panel Bluetooth

Sketch JWS 4 Panel, Bluetooth Kontrolled

Sketch JWS 4 Panel, Bluetooth Kontrolled
JWSD- 2019 NEW ! !

Sketch Jam Sholat 1 Panel

Sketch Jam Sholat 1 Panel
Jam sholat 1 Panel

Sketch Jam Sholat 2 Panel

Sketch Jam Sholat 2 Panel
Jam dua panel

Sketch Jam Sholat 3 Panel

Sketch Jam Sholat 3 Panel
Sketch Jam Sholat 3 Panel

Sketch Jam Sholat 5 Panel

Sketch Jam Sholat 5 Panel
Jam Sholat 5 Panel

Toko Kami

Daftar isi

Blog Archive

Tryout UNBK

e-learning

e-learning
Belajar mudah, dimana saja

my Edmodo

Buku Digital

Buku Tamu

Komentar Terkini

Live Traffic

Donasi

Donasi
Donasi

Total Pengunjung