pake 1 MC saja pak attiny 2313 atau atmega8 (nanti bisa ditambah code ADC mixing)
- 3 input (aileron-elevator-throttle) - 3 output (CCPM) seperti ini pak a = cc * ( elevator * cos (alpha + 0) + aileron * cos (alpha + 90) ) + pc * pitch b = cc * ( elevator * cos (alpha + 120) + aileron * cos (alpha + 210) ) + pc * pitch c = cc * ( elevator * cos (alpha + 240) + aileron * cos (alpha + 330) ) + pc * pitch
Project : Version : Date : 7/21/2009 Author : F4CG Company : F4CG Comments:
Chip type : ATmega8515 Program type : Application Clock frequency : 11.059200 MHz Memory model : Small External SRAM size : 0 Data Stack size : 128 *****************************************************/
int ram_aileron,ram_elevator,ram_pitch; // Declare your global variables here
long cc,a,b,c,pc,alpha;
void kirim_servo(long nilai,char port){
switch (port){ case 0: out1=1;out2=0;out3=0; case 1: out1=0;out2=1;out3=0; case 2: out1=0;out2=0;out3=1; } while (nilai--){ delay_us(1); } out1=0;out2=0;out3=0; } void main(void) { // Declare your local variables here
// Analog Comparator initialization // Analog Comparator: Off // Analog Comparator Input Capture by Timer/Counter 1: Off ACSR=0x80;
DDRC=0; PORTC=0xFF;
/* #define aileron PINC.0 #define elevator PINC.1 #define pitch PINC.1
*/
DDRC.2=1; DDRC.3=1; DDRC.4=1;
cc=0;//nilai ini coba dirubah2 pc=0;//nilai ini coba dirubah2
while (1) { while (!aileron){;ram_aileron=0;}
while (aileron){ram_aileron++;delay_us(1);}
while (!elevator){ram_elevator=0;}
while (elevator){ram_elevator++;delay_us(1);}
while (!pitch){;ram_pitch=0;}
while (pitch){ram_pitch++;delay_us(1);}
a = cc * ( ram_elevator * cos (alpha + 0) + ram_aileron * cos (alpha + 90) ) + pc * ram_pitch; b = cc * ( ram_elevator * cos (alpha + 120) + ram_aileron * cos (alpha + 210) ) + pc * ram_pitch; c = cc * ( ram_elevator * cos (alpha + 240) + ram_aileron * cos (alpha + 330) ) + pc * ram_pitch ;
dino wrote:#-o manthap tenan.....sdh bkn sy puyeng lihat tulisan2 diatas.... so ditunggu maidenya sekalian mnt ijin menyimak
jangan lupa ikutan bikin juga yg jelas lebih hemat dari helicopter lebih bandel kalau crash lebih stabil dan bisa membawa kamera mudah membuatnya frame bisa buat sendiri