/*********************************************
This program was produced by the
CodeWizardAVR V1.24.0 Standard
Automatic Program Generator
© Copyright 1998-2003 HP InfoTech s.r.l.
http://www.hpinfotech.ro
e-mail:office@hpinfotech.ro
Project :
Version :
Date : 1/9/2009
Author : boodeee 2009
Company :
Comments:
Chip type : ATmega16
Program type : Application
Clock frequency : 11.059200 MHz
Memory model : Small
External SRAM size : 0
Data Stack size : 256
*********************************************/
#include
#include
#include
#include
#define bawah PORTC.1
#define atas PORTC.2
#define buka PORTC.3
#define tutup PORTC.4
#define kiri PORTC.5
#define kanan PORTC.6
#define maju PORTC.0
#define mundur PORTD.7
#define puter PORTA.6
#define lim_ki PINA.2
#define lim_teng PINA.1
#define lim_ka PINA.0
#define lim_jepit PINA.3
unsigned int i;
unsigned char count,xcount,rcount;
// awal
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
TCNT0=200;
count++;
}
void counter(unsigned char xcount)
{
TCCR0=0x06;
TCNT0=0;
while(count
TCCR0=0;
}
void up()
{
bawah=1;
atas=0;
}
void down()
{
bawah=0;
atas=1;
}
void stop_lift()
{
bawah=1;
atas=1;
}
void right()
{ kiri=1;
kanan=0;
}
void left ()
{ kiri=0;
kanan=1;
}
void stop_slide()
{ kiri=1;
kanan=1;
}
void go()
{ maju=0;
mundur=1;
}
void back()
{ maju=1;
mundur=0;
}
void stop_run()
{ maju=1;
mundur=1;
}
void open()
{
buka=0;
tutup=1;
}
void close()
{
buka=1;
tutup=0;
}
void stop_jepit()
{
buka=1;
tutup=1;
}
void stop_all()
{
stop_lift();
stop_jepit();
stop_slide();
// stop_lift();
}
void puter_cw(unsigned char g)
{
PORTA.6=0;PORTA.7=1;
TCCR0=0x06;
TCNT0=0;
while(count
TCCR0=0;
PORTA.6=1;PORTA.7=1;
}
void puter_ccw(unsigned char g)
{
PORTA.6=1;PORTA.7=0;
TCCR0=0x06;
TCNT0=0;
while(count
TCCR0=0;
PORTA.6=1;PORTA.7=1;
}
void chuck()
{
close(); delay_ms(3700);
stop_all();
delay_ms(300);
}
void chuck_lilin()
{
close(); delay_ms(4000);
stop_all();
delay_ms(300);
}
void chuck_bunga()
{
close(); delay_ms(4000);
stop_all();
delay_ms(300);
}
void ambil_boneka()
{
unsigned int i;
open(); back(); down(); delay_ms(5000);
stop_jepit(); stop_run();stop_lift();
for(i=0;i<500;i++)while(lim_ka)left();
stop_slide();
for(i=0;i<=1000;i++)while(lim_jepit)go();
chuck();
up(); delay_ms(1000);
stop_lift();
back(); delay_ms(1000);
stop_run();
left(); delay_ms(6000);
for(i=0;i<=60;i++)while(PINA.4)down(); //delay_ms(1000);
stop_lift();
open(); delay_ms(5000);
stop_jepit();delay_ms(1000);
up(); delay_ms(1000);
stop_lift();
for(i=0;i<500;i++)while(lim_ka)right();
stop_slide();
}
void ambil_lilin()
{
unsigned int i;
open(); back(); down(); delay_ms(5000);
stop_jepit(); stop_run();stop_lift();
for(i=0;i<500;i++)while(lim_teng)left();
stop_slide();
for(i=0;i<=1000;i++)while(lim_jepit)go();
chuck_lilin();
up(); delay_ms(1000);
stop_lift();
back(); delay_ms(1000);
stop_run();
left(); delay_ms(6000);
for(i=0;i<=60;i++)while(PINA.4)down(); //delay_ms(1000);
stop_lift();
open(); delay_ms(5000);
stop_jepit();delay_ms(1000);
up(); delay_ms(1000);
stop_lift();
for(i=0;i<500;i++)while(lim_ka)right();
stop_slide();
}
void ambil_bunga()
{
unsigned int i;
open(); back(); down(); delay_ms(5000);
stop_jepit(); stop_run();stop_lift();
for(i=0;i<80;i++)while(lim_ki)left();
stop_slide();
for(i=0;i<=1500;i++)while(lim_jepit)go();
chuck_bunga();
up(); delay_ms(1000);
stop_lift();
back(); delay_ms(1000);
stop_run();
left(); delay_ms(6000);
for(i=0;i<=60;i++)while(PINA.4)down(); //delay_ms(1000);
stop_lift();
open(); delay_ms(5000);
stop_jepit();delay_ms(1000);
up(); delay_ms(1000);
stop_lift();
for(i=0;i<500;i++)while(lim_ka)right();
stop_slide();;
}
void lilin_tengah()
{
unsigned int i;
open(); back(); down(); delay_ms(5000);
stop_jepit(); stop_run();stop_lift();
for(i=0;i<500;i++)while(lim_teng)left();
stop_slide();
for(i=0;i<=1000;i++)while(lim_jepit)go();
chuck_lilin();
up(); delay_ms(1000);
stop_lift();
back(); delay_ms(1000);
stop_run();
left(); delay_ms(6000);
stop_slide(); delay_ms(1000);
go(); delay_ms(1000);
for(i=0;i<=60;i++)while(PINA.4)down(); //delay_ms(1000);
stop_lift();
open(); delay_ms(5000);
stop_jepit();delay_ms(1000);
up(); delay_ms(1000);
stop_lift();
back(); delay_ms(1000);
stop_run();
for(i=0;i<500;i++)while(lim_ka)right();
stop_slide();
}
void rang_1()
{
unsigned int i;
puter_cw(10); delay_ms(500);
// chuck();
ambil_lilin(); delay_ms(500);
puter_cw(20);
// chuck(); delay_ms(500);
ambil_bunga(); delay_ms(500);
puter_cw(30);
//chuck();
ambil_boneka(); delay_ms(500);
chuck(); delay_ms(500);
}
void rang_2()
{
unsigned int i;
puter_cw(10); delay_ms(500);
// chuck();
ambil_boneka(); delay_ms(500);
puter_cw(20);
// chuck(); delay_ms(500);
ambil_lilin(); delay_ms(500);
puter_cw(30);
//chuck();
ambil_bunga(); delay_ms(500);
chuck(); delay_ms(500);
}
void centre_candle()
{
unsigned int i;
open(); back(); down(); delay_ms(5000);
stop_jepit(); stop_run();stop_lift();
for(i=0;i<500;i++)while(lim_teng)left();
stop_slide();
//for(i=0;i<=1000;i++)while(lim_jepit)go();
go(); delay_ms(1000);
stop_run(); delay_ms(100);
chuck_lilin();
up(); delay_ms(1000);
stop_lift();
back(); delay_ms(1000);
stop_run();
left(); delay_ms(6000);
stop_slide(); delay_ms(1000);
go(); delay_ms(410);
stop_run(); delay_ms(500);
for(i=0;i<=1000;i++)while(PINA.4)down(); //delay_ms(1000);
stop_lift();
stop_run(); delay_ms(500);
open(); delay_ms(5000);
stop_jepit();delay_ms(1000);
up(); delay_ms(200);
stop_lift(); delay_ms(500);
close(); delay_ms(2700);
stop_jepit();delay_ms(500);
down(); delay_ms(100);
stop_lift(); delay_ms(1000);
up(); delay_ms(1000);
back(); delay_ms(1000);
stop_lift(); stop_run();
for(i=0;i<500;i++)while(lim_ka)right();
stop_slide();
}
void main(void)
{
// Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In
// State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T
PORTA=0xff;
DDRA=0x0;
// Port B initialization
// Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In
// State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T
PORTB=0x00;
DDRB=0x00;
// Port C initialization
// Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In
// State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T
PORTC=0xff;
DDRC=0xff;
// Port D initialization
// Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In
// State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T
PORTD=0xff;
DDRD=0xff;
/*
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
*/
// Timer/Counter 0 initialization
// Clock source: T0 pin Falling Edge
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x06;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x01;
// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud rate: 9600
UCSRA=0x00;
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x47;//19
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
// Analog Comparator Output: Off
ACSR=0x80;
SFIOR=0x00;
#asm("sei");
delay_ms(500);
DDRA=0x40;
DDRD=0x80;
DDRC=0xff;
DDRB=0x00;
DDRA.2=0;
DDRA.3=0;
DDRA.0=0;
DDRA.1=0;
DDRA.5=0;
DDRA.6=1;
DDRA.7=1;
DDRD.7=1;
for(i=0;i<=1000;i++)while(lim_ki)stop_all();
//while(TCNT0<100){;;};
//for(i=0;i<=1000;i++)while(getchar!='b'){};
//for(;;){if(getchar()=='$')break;}
//open(); delay_ms(6000);
//close(); delay_ms(3000);
//for(;;){
// PORTD.7=0; delay_ms(7000);
// bfor(;;) stop_run();
//fbamcb
//for(;;)PORTA.7=0;
while (1)
{
// rang_2();
// back();
centre_candle();
// lilin_tengah();
stop_lift();
for(;;)stop_all();
};
}
Minggu, 25 Januari 2009
jajn tart
ROAD TO S.ST 2009
ABSTRAK
Teknologi di bidang robotika sekarang ini telah berkembang dengan pesat dan sangat luas. Fungsi dari robot diharapkan bermanfaat untuk segala bidang salah satunya adalah bidang rumah tangga. Pada Proyek Akhir ini akan dibuat manipulator robot yang dapat meletakkan hiasan pada kue tart. Proyek Akhir ini bertujuan untuk membuat suatu perangkat robot, baik perangkat keras, mekanik serta perangkat lunaknya. Robot ini adalah robot home industri yang dapat bergerak secara otomatis dan di batasi, robot ini menggunakan komunikasi serial dengan sebuah personal komputer untuk mengambil hiasan pada bidang dan meletakkanya pada kue tart. Hiasan yang sudah ditentukan diambil oleh robot dan diolah datanya oleh komputer menjadi data posisi dan data luasan. Data tersebut dikirimkan ke mikrokontroller ATmega16 melalui komunikasi serial RS 232. Data posisi digunakan oleh mikrokotroller sebagai referensi posisi robot terhadap hiasan untuk menggerakkan motor sedemikian rupa sehingga manipulator robot dapat bergerak menuju objek dan berada tepat didepan objek. Sedangkan data luasan digunakan sebagai data referensi mikrokontroller untuk mengetahui seberapa dekat jarak robot terhadap objek. Setelah mendapat nilai luasan yang cukup maka robot dapat melakukan proses selanjutnya, yaitu mengambil hiasan jika objek adalah boneka dan meletakkan boneka tersebut pada kue tart Untuk proses mengambil dan meletakkan hiasan, manipulator robot dilengkapi dengan lengan buatan yang mempunyai penjepit di ujungnya, semua gerakan lengan dan penjepit digerakkan dengan motor DC.
Kata kunci: Robot, kue tart, mikrokontroler, komunikasi serial, motorDC
ABSTRACT
Technology of robotika now developed fast and very wide. The function from the robot it was hoped was useful for all the fields one of them was the domestic field. In this Final Project will be made by the manipulator of the robot who could place the decoration to the cake. This Final project aimed at making an of the robot's equipment, good hardware, mechanics as well as his software. This robot was the home industry robot that could move automatically and in restricted the position and his movement, this robot used communication serial with a personal the computer to take the decoration to the field and put decoration to the cake. The decoration that has been determined was taken by the robot and was processed by his data by the computer became the position data and the area data. This data was sent to microcontroler ATmega16 through communication serial RS 232. The position data was used by mikrokotroller as the position reference of the robot towards the decoration to move the motor in such a way as the manipulator of the robot could be involved in heading the object and was exact in front of the object. Whereas the area data was used as the reference data mikrokontroller to know as close to the distance of the robot against the object. After receiving the value of the area that was enough then the robot could carry out the further process, that is taking the decoration if the object was the doll and placed this doll to the cake cake for the process of taking and placing the decoration, the manipulator of the robot was supplemented with artificial arms that had nipper on the end, all the movements of arms and nipper was moved with the DC motor.
Key Words: Robot, tart cake, mikrokontroler, serial communication, DC motor
ABSTRAK
Teknologi di bidang robotika sekarang ini telah berkembang dengan pesat dan sangat luas. Fungsi dari robot diharapkan bermanfaat untuk segala bidang salah satunya adalah bidang rumah tangga. Pada Proyek Akhir ini akan dibuat manipulator robot yang dapat meletakkan hiasan pada kue tart. Proyek Akhir ini bertujuan untuk membuat suatu perangkat robot, baik perangkat keras, mekanik serta perangkat lunaknya. Robot ini adalah robot home industri yang dapat bergerak secara otomatis dan di batasi, robot ini menggunakan komunikasi serial dengan sebuah personal komputer untuk mengambil hiasan pada bidang dan meletakkanya pada kue tart. Hiasan yang sudah ditentukan diambil oleh robot dan diolah datanya oleh komputer menjadi data posisi dan data luasan. Data tersebut dikirimkan ke mikrokontroller ATmega16 melalui komunikasi serial RS 232. Data posisi digunakan oleh mikrokotroller sebagai referensi posisi robot terhadap hiasan untuk menggerakkan motor sedemikian rupa sehingga manipulator robot dapat bergerak menuju objek dan berada tepat didepan objek. Sedangkan data luasan digunakan sebagai data referensi mikrokontroller untuk mengetahui seberapa dekat jarak robot terhadap objek. Setelah mendapat nilai luasan yang cukup maka robot dapat melakukan proses selanjutnya, yaitu mengambil hiasan jika objek adalah boneka dan meletakkan boneka tersebut pada kue tart Untuk proses mengambil dan meletakkan hiasan, manipulator robot dilengkapi dengan lengan buatan yang mempunyai penjepit di ujungnya, semua gerakan lengan dan penjepit digerakkan dengan motor DC.
Kata kunci: Robot, kue tart, mikrokontroler, komunikasi serial, motorDC
ABSTRACT
Technology of robotika now developed fast and very wide. The function from the robot it was hoped was useful for all the fields one of them was the domestic field. In this Final Project will be made by the manipulator of the robot who could place the decoration to the cake. This Final project aimed at making an of the robot's equipment, good hardware, mechanics as well as his software. This robot was the home industry robot that could move automatically and in restricted the position and his movement, this robot used communication serial with a personal the computer to take the decoration to the field and put decoration to the cake. The decoration that has been determined was taken by the robot and was processed by his data by the computer became the position data and the area data. This data was sent to microcontroler ATmega16 through communication serial RS 232. The position data was used by mikrokotroller as the position reference of the robot towards the decoration to move the motor in such a way as the manipulator of the robot could be involved in heading the object and was exact in front of the object. Whereas the area data was used as the reference data mikrokontroller to know as close to the distance of the robot against the object. After receiving the value of the area that was enough then the robot could carry out the further process, that is taking the decoration if the object was the doll and placed this doll to the cake cake for the process of taking and placing the decoration, the manipulator of the robot was supplemented with artificial arms that had nipper on the end, all the movements of arms and nipper was moved with the DC motor.
Key Words: Robot, tart cake, mikrokontroler, serial communication, DC motor
Langganan:
Postingan (Atom)