Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara menggunakan sebuah sensor OTOT ( EMG ) untuk menggerakkan tangan robot, jadi alat ini berfungsi untuk menggerakkan tangan robot menggunakan intensitas ketegangan / kontraksi dari otor tangan, alat ini menggunakan microcontroller ATMega8535 dengan bahasa CV AVR. prinsip kerja tangan robot ini sangatlah mudah yaitu hanya berpedoman dari koordinat servo yang akan menggerakkan jari--jari tangan. untuk lebih jelasnya berikut program dan skemanya.
a. Minimum System ATMega
b. Sensor EMG / OTOT
c. Program CV AVR ( Code Vision AVR )
/*****************************************************
This program was produced by the
CodeWizardAVR V2.04.4a Advanced
Automatic Program Generator
© Copyright 1998-2009 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project :
Version :
Date : 3/4/2016
Author : NeVaDa
Company :
Comments: anak jalanan yang ingin alay
Chip type : ATmega8535
Program type : Application
AVR Core Clock frequency: 8.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 128
*****************************************************/
#include <mega8535.h>
#include <delay.h>
#include <stdio.h>
#define servo_1 PORTB.0
#define servo_2 PORTB.1
#define servo_3 PORTB.2
#define servo_4 PORTB.3
#define servo_5 PORTB.4
#define PB_ok PIND.6
#define PB_plus PIND.4
#define PB_minus PIND.5
#define PB_start PIND.3
#define on 0
#define off 1
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x15 ;PORTC
#endasm
#include <lcd.h>
#define ADC_VREF_TYPE 0x40
// Read the AD conversion result
unsigned int read_adc(unsigned char adc_input)
{
ADMUX=adc_input | (ADC_VREF_TYPE & 0xff);
// Delay needed for the stabilization of the ADC input voltage
delay_us(10);
// Start the AD conversion
ADCSRA|=0x40;
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCW;
}
char buff[32];
int j=0,a=0,servo1=0,servo2=0,servo3=0,servo4=0,servo5=0,x_plus=0;
//SETTING SARVO
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
if(j>312)
{
j=0;}
else {j++; }
//delay_us(500);}
if(j<servo1)
{
servo_1=1;
}//delay_us(1500);
else{
servo_1=0;
}
if(j<servo2)
{
servo_2=1;
}//delay_us(1500);
else{
servo_2=0;
}
if(j<servo3)
{
servo_3=1;
}//delay_us(1500);
else{
servo_3=0;
}
if(j<servo4)
{
servo_4=1;
}//delay_us(1500);
else{
servo_4=0;
}
if(j<servo5)
{
servo_5=1;
}//delay_us(1500);
else{
servo_5=0;
}
}
//POSISI SERVO NETRAL
void servo_netral1()
{
servo1=23;
}
void servo_netral2()
{
servo2=68;
}void servo_netral3()
{
servo3=68;
}void servo_netral4()
{
servo4=68;
}
void servo_netral5()
{
servo5=68;
}
//POSISI SERVO NEGATIF(CW 90)
void servo_neg1()
{
servo1=40;
}
void servo_neg2()
{
servo2=35;
}
void servo_neg3()
{
servo3=35;
}
void servo_neg4()
{
servo4=35;
}
void servo_neg5()
{
servo5=35;
//servo2=40;
}
void genggam()
{
servo_neg1();
servo_neg2();
servo_neg3();
servo_neg4();
servo_neg5();
}
void lepas()
{
servo_netral1();
servo_netral2();
servo_netral3();
servo_netral4();
servo_netral5();
}
// CODING RUNNING
void test()
{
a=read_adc(0);
if(a<110)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("lepas");
lepas();
}
if(a>110 && a <130)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu jari");
servo_neg1();
//servo_netral2();
}
if(a>130 && a <170)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+telunjuk");
servo_neg1();
delay_ms(70);
servo_neg2();
servo_netral3();
servo_netral4();
}
if(a>170 && a <210)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+telu+teng");
servo_neg1();
delay_ms(70);
servo_neg2();
delay_ms(70);
servo_neg3();
servo_netral4();
servo_netral5();
}
if(a>210 && a <240)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+4");
servo_neg1();
delay_ms(70);
servo_neg2();
delay_ms(70);
servo_neg3();
delay_ms(70);
servo_neg4();
servo_netral5();
//servo_netral(4);
}
if(a>240 && a <300)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("5 jari");
servo_neg1();
delay_ms(100);
servo_neg2();
delay_ms(100);
servo_neg3();
delay_ms(100);
servo_neg4();
delay_ms(100);
servo_neg5();
}
if(a>310)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("genggam");
genggam();
}
}
//CODDING TEST LENGAN
void test2()
{
a=read_adc(0);
if(a<110)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("lepas");
lepas();
}
if(a>110 && a <130)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu jari");
servo_neg1();
//servo_netral2();
}
if(a>130 && a <170)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+telunjuk");
servo_neg1();
delay_ms(70);
servo_neg2();
//servo_netral3();
//servo_netral4();
}
if(a>170 && a <210)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+telu+teng");
servo_neg1();
delay_ms(70);
servo_neg2();
delay_ms(70);
servo_neg3();
//servo_netral4();
//servo_netral5();
}
if(a>210 && a <240)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+4");
servo_neg1();
delay_ms(70);
servo_neg2();
delay_ms(70);
servo_neg3();
delay_ms(70);
servo_neg4();
//servo_netral5();
//servo_netral(4);
}
if(a>240 && a <300)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("5 jari");
servo_neg1();
delay_ms(100);
servo_neg2();
delay_ms(100);
servo_neg3();
delay_ms(100);
servo_neg4();
delay_ms(100);
servo_neg5();
}
if(a>310)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("genggam");
genggam();
}
}
//COODING KALIBRASI SENSOR
void kalibrasi()
{
a=read_adc(0);
lcd_gotoxy(0,0);
sprintf(buff,"nilai=%4d",a);
lcd_puts(buff);
delay_ms(300);
if(a<110)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("lepas");
//lepas();
}
if(a>110 && a <130)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu jari");
//servo_neg1();
//servo_netral2();
}
if(a>130 && a <170)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+telunjuk");
//servo_neg1();
delay_ms(70);
}
if(a>170 && a <210)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+telu+teng");
if(a>210 && a <240)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+4");
}
if(a>240 && a <300)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("5 jari");
}
if(a>310)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("genggam");
}
}
}
//CODDING TAMPILAN MENU
void menu()
{
PORTD.7=0;
//lcd_clear();
lcd_gotoxy(0,0);
sprintf(buff,"menu = %2d",x_plus);
lcd_puts(buff);
if(PB_plus==on)
{
x_plus++; delay_ms(200);
delay_ms(10);
}
else if(PB_minus==on)
{
x_plus--; delay_ms(200);
delay_ms(10);
}
else if(x_plus==1)
{
//lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("1. Running ");
if(PB_ok==on)
{
lcd_clear();
while(PB_start=off)
{
test();
PORTD.7=1;}
}
}
else if(x_plus==2)
{
//lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("2.Kalibrasi sens");
if(PB_ok==on)
{
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("Kalibrasi Sense");
delay_ms(2000);
lcd_clear();
while(PB_start=off)
{
kalibrasi();
PORTD.7=0;
}
}
}
else if(x_plus==3)
{
//lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("3.TES LENGAN");
if(PB_ok==on)
{
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("TES LENGAN");
delay_ms(2000);
lcd_clear();
while(PB_start=off)
{
test2();
PORTD.7=0;
}
}
}
else if(x_plus>4)
{x_plus=1;}
else if(x_plus<1)
{x_plus=1;}
}
// Declare your global variables here
void main(void)
{
// Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State7=T State6=T State5=T State4=0 State3=0 State2=0 State1=0 State0=0
PORTB=0x00;
DDRB=0x1F;
// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=P State6=P State5=P State4=P State3=P State2=P State1=P State0=P
PORTD=0xFF;
DDRD=0x80;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: 8000.000 kHz
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x01;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 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;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
// ADC initialization
// ADC Clock frequency: 1000.000 kHz
// ADC Voltage Reference: AVCC pin
// ADC High Speed Mode: Off
// ADC Auto Trigger Source: None
ADMUX=ADC_VREF_TYPE & 0xff;
ADCSRA=0x83;
SFIOR&=0xEF;
// LCD module initialization
#asm("sei");
lcd_init(16);
lcd_gotoxy(0,0);
lcd_putsf("BISMILLAH");
delay_ms(1000);
lcd_clear();
lepas();
while (1)
{
menu();
// genggam();
// delay_ms(2000);
// lepas();
// delay_ms(2000);
// Place your code here
// test();
// a=read_adc(0);
// lcd_gotoxy(0,0);
// sprintf(buff,"nilai=%4d",a);
// lcd_puts(buff);
// delay_ms(300);
};
}
This program was produced by the
CodeWizardAVR V2.04.4a Advanced
Automatic Program Generator
© Copyright 1998-2009 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project :
Version :
Date : 3/4/2016
Author : NeVaDa
Company :
Comments: anak jalanan yang ingin alay
Chip type : ATmega8535
Program type : Application
AVR Core Clock frequency: 8.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 128
*****************************************************/
#include <mega8535.h>
#include <delay.h>
#include <stdio.h>
#define servo_1 PORTB.0
#define servo_2 PORTB.1
#define servo_3 PORTB.2
#define servo_4 PORTB.3
#define servo_5 PORTB.4
#define PB_ok PIND.6
#define PB_plus PIND.4
#define PB_minus PIND.5
#define PB_start PIND.3
#define on 0
#define off 1
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x15 ;PORTC
#endasm
#include <lcd.h>
#define ADC_VREF_TYPE 0x40
// Read the AD conversion result
unsigned int read_adc(unsigned char adc_input)
{
ADMUX=adc_input | (ADC_VREF_TYPE & 0xff);
// Delay needed for the stabilization of the ADC input voltage
delay_us(10);
// Start the AD conversion
ADCSRA|=0x40;
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCW;
}
char buff[32];
int j=0,a=0,servo1=0,servo2=0,servo3=0,servo4=0,servo5=0,x_plus=0;
//SETTING SARVO
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
if(j>312)
{
j=0;}
else {j++; }
//delay_us(500);}
if(j<servo1)
{
servo_1=1;
}//delay_us(1500);
else{
servo_1=0;
}
if(j<servo2)
{
servo_2=1;
}//delay_us(1500);
else{
servo_2=0;
}
if(j<servo3)
{
servo_3=1;
}//delay_us(1500);
else{
servo_3=0;
}
if(j<servo4)
{
servo_4=1;
}//delay_us(1500);
else{
servo_4=0;
}
if(j<servo5)
{
servo_5=1;
}//delay_us(1500);
else{
servo_5=0;
}
}
//POSISI SERVO NETRAL
void servo_netral1()
{
servo1=23;
}
void servo_netral2()
{
servo2=68;
}void servo_netral3()
{
servo3=68;
}void servo_netral4()
{
servo4=68;
}
void servo_netral5()
{
servo5=68;
}
//POSISI SERVO NEGATIF(CW 90)
void servo_neg1()
{
servo1=40;
}
void servo_neg2()
{
servo2=35;
}
void servo_neg3()
{
servo3=35;
}
void servo_neg4()
{
servo4=35;
}
void servo_neg5()
{
servo5=35;
//servo2=40;
}
void genggam()
{
servo_neg1();
servo_neg2();
servo_neg3();
servo_neg4();
servo_neg5();
}
void lepas()
{
servo_netral1();
servo_netral2();
servo_netral3();
servo_netral4();
servo_netral5();
}
// CODING RUNNING
void test()
{
a=read_adc(0);
if(a<110)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("lepas");
lepas();
}
if(a>110 && a <130)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu jari");
servo_neg1();
//servo_netral2();
}
if(a>130 && a <170)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+telunjuk");
servo_neg1();
delay_ms(70);
servo_neg2();
servo_netral3();
servo_netral4();
}
if(a>170 && a <210)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+telu+teng");
servo_neg1();
delay_ms(70);
servo_neg2();
delay_ms(70);
servo_neg3();
servo_netral4();
servo_netral5();
}
if(a>210 && a <240)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+4");
servo_neg1();
delay_ms(70);
servo_neg2();
delay_ms(70);
servo_neg3();
delay_ms(70);
servo_neg4();
servo_netral5();
//servo_netral(4);
}
if(a>240 && a <300)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("5 jari");
servo_neg1();
delay_ms(100);
servo_neg2();
delay_ms(100);
servo_neg3();
delay_ms(100);
servo_neg4();
delay_ms(100);
servo_neg5();
}
if(a>310)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("genggam");
genggam();
}
}
//CODDING TEST LENGAN
void test2()
{
a=read_adc(0);
if(a<110)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("lepas");
lepas();
}
if(a>110 && a <130)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu jari");
servo_neg1();
//servo_netral2();
}
if(a>130 && a <170)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+telunjuk");
servo_neg1();
delay_ms(70);
servo_neg2();
//servo_netral3();
//servo_netral4();
}
if(a>170 && a <210)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+telu+teng");
servo_neg1();
delay_ms(70);
servo_neg2();
delay_ms(70);
servo_neg3();
//servo_netral4();
//servo_netral5();
}
if(a>210 && a <240)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+4");
servo_neg1();
delay_ms(70);
servo_neg2();
delay_ms(70);
servo_neg3();
delay_ms(70);
servo_neg4();
//servo_netral5();
//servo_netral(4);
}
if(a>240 && a <300)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("5 jari");
servo_neg1();
delay_ms(100);
servo_neg2();
delay_ms(100);
servo_neg3();
delay_ms(100);
servo_neg4();
delay_ms(100);
servo_neg5();
}
if(a>310)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("genggam");
genggam();
}
}
//COODING KALIBRASI SENSOR
void kalibrasi()
{
a=read_adc(0);
lcd_gotoxy(0,0);
sprintf(buff,"nilai=%4d",a);
lcd_puts(buff);
delay_ms(300);
if(a<110)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("lepas");
//lepas();
}
if(a>110 && a <130)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu jari");
//servo_neg1();
//servo_netral2();
}
if(a>130 && a <170)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+telunjuk");
//servo_neg1();
delay_ms(70);
}
if(a>170 && a <210)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+telu+teng");
if(a>210 && a <240)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("ibu+4");
}
if(a>240 && a <300)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("5 jari");
}
if(a>310)
{
lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("genggam");
}
}
}
//CODDING TAMPILAN MENU
void menu()
{
PORTD.7=0;
//lcd_clear();
lcd_gotoxy(0,0);
sprintf(buff,"menu = %2d",x_plus);
lcd_puts(buff);
if(PB_plus==on)
{
x_plus++; delay_ms(200);
delay_ms(10);
}
else if(PB_minus==on)
{
x_plus--; delay_ms(200);
delay_ms(10);
}
else if(x_plus==1)
{
//lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("1. Running ");
if(PB_ok==on)
{
lcd_clear();
while(PB_start=off)
{
test();
PORTD.7=1;}
}
}
else if(x_plus==2)
{
//lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("2.Kalibrasi sens");
if(PB_ok==on)
{
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("Kalibrasi Sense");
delay_ms(2000);
lcd_clear();
while(PB_start=off)
{
kalibrasi();
PORTD.7=0;
}
}
}
else if(x_plus==3)
{
//lcd_clear();
lcd_gotoxy(0,1);
lcd_putsf("3.TES LENGAN");
if(PB_ok==on)
{
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("TES LENGAN");
delay_ms(2000);
lcd_clear();
while(PB_start=off)
{
test2();
PORTD.7=0;
}
}
}
else if(x_plus>4)
{x_plus=1;}
else if(x_plus<1)
{x_plus=1;}
}
// Declare your global variables here
void main(void)
{
// Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State7=T State6=T State5=T State4=0 State3=0 State2=0 State1=0 State0=0
PORTB=0x00;
DDRB=0x1F;
// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=P State6=P State5=P State4=P State3=P State2=P State1=P State0=P
PORTD=0xFF;
DDRD=0x80;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: 8000.000 kHz
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x01;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 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;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
// ADC initialization
// ADC Clock frequency: 1000.000 kHz
// ADC Voltage Reference: AVCC pin
// ADC High Speed Mode: Off
// ADC Auto Trigger Source: None
ADMUX=ADC_VREF_TYPE & 0xff;
ADCSRA=0x83;
SFIOR&=0xEF;
// LCD module initialization
#asm("sei");
lcd_init(16);
lcd_gotoxy(0,0);
lcd_putsf("BISMILLAH");
delay_ms(1000);
lcd_clear();
lepas();
while (1)
{
menu();
// genggam();
// delay_ms(2000);
// lepas();
// delay_ms(2000);
// Place your code here
// test();
// a=read_adc(0);
// lcd_gotoxy(0,0);
// sprintf(buff,"nilai=%4d",a);
// lcd_puts(buff);
// delay_ms(300);
};
}
d. Foto Pengujian Alat
No comments:
Post a Comment