AVR KeyPad 3×4

March 3rd, 2010 nashrul 1 comment


#include <mega324.h>
#include <delay.h>
#include <stdio.h>
//mulai inisialisai PIN Key Pad
#define kolom1    PORTA.0              // out      1
#define kolom2    PORTA.1
#define kolom3    PORTA.2

#define baris1    PINA.4               // in       Pull
#define baris2    PINA.5
#define baris3    PINA.6
#define baris4    PINA.7

unsigned char tombol,kolom,x;        // variabel tombol u/ simpan hasil yg ditekan (dalam kode Ascii)
void cek_baris()                     // 48 adalah konversi tampilan charakter
{
if  (baris1 == 0)
{
tombol = kolom + 48;
x=1;
}
else if (baris2==0)
{
tombol=kolom+3+48;
x=1;
}
else if (baris3==0)
{
tombol=kolom+6+48;
x=1;
}
else if  (baris4==0)
{
tombol=kolom+9+48;
x=1;
}
else
{
tombol=0;
x=0;
}
if (tombol==58) tombol=42; //*
if (tombol==59) tombol=48; //0
if (tombol==60) tombol=35; //#
}

Read more…

AVR Half Duplex Software UART (9600 bps, 8N1)

February 23rd, 2010 nashrul 1 comment


/*********************************************
This program was produced using
CodeVision AVR V1.23.6b Standard
© Copyright 1998-2002 HP InfoTech s.r.l.

http://www.hpinfotech.ro

e-mail:office@hpinfotech.ro , hpinfotech@xnet.ro

Project : UART3: Half Duplex Software UART (9600 bps, 8N1)
Version : 1.3
Date : October 2002
Author : Radu Hristea (radu.hristea@aptrans-group.com; transeast@programmer.net)
Company : TransEast s.r.l.
Comments: Total size = 321 words (including the demo program)
The receive line is buffered (the user can modify the buffer size).
The receive routine detects and rejects the frame errors.

Chip type : ATmega128
Program type : Application
Clock frequency : 4.000000 MHz
Memory model : Small
Internal SRAM size : 4096
External SRAM size : 0
Data Stack size : 1024
*********************************************/
#include
#include "defs.h "
// UART3 Global Registers
byte u3_buffer ; // serial buffer
byte u3_bit_nbr; // bit counter
byte u3_status ; // status register
// UART3 Receiver buffer
byte rx_buffer3[RX_BUFFER_SIZE3];
byte rx_wr_index3, rx_rd_index3, rx_counter3;
// This flag is set on UART3 Receiver buffer overflow
bit rx_buffer_overflow3;

Read more...

AVR SHT 11 (Temperature & Humidity Sensor)

February 19th, 2010 nashrul 5 comments

/***************************************************************************

File : sht-11.c

Description : Main module

Project : SHT 11 Temperature & Humidity Sensor

Version : 2.0.1

Author : nashrul@nashrul.co.cc

Date : 2010

***************************************************************************/

#include

#include

#include

#include

#asm

.equ __lcd_port=0×15 ;PORTC

#endasm

#define io DDRB.1

#define sda_out PORTB.1

#define sda_in PINB.1

#define sck PORTB.0

#define temp 0b00000011

#define humi 0b00000101

#define read_reg 0b00000111

#define write_reg 0b00000110

union data_int{unsigned char c[sizeof unsigned int];unsigned int t;}sht;

unsigned char lcd[20],msbt,lsbt,msbh,lsbh,value;

unsigned int temperatur,humidity;

Read more…

Brisingr

February 15th, 2010 nashrul 1 comment

Eragon dan naganya, Saphira, berhasil bertahan hidup setelah pertempuran kolosal melawan para prajurit Kekaisaran di Dataran Membara. Namun masih banyak yang harus dihadapi sang Penunggang dan naganya ini.

Read more…

Eldest

February 14th, 2010 nashrul 1 comment

Kegelapan turun…

Pedang-pedang beradu…

Kejahatan menang.

Read more…

Switch to our mobile site