Hallo
Warum kompilierst du das nicht selbst? Die einfache RC-Steuerung aus dem Dominoday-Thread [Link] sieht so aus:
Die RC-Kanäle kommen an den XBUS-Stecker, links/rechts an Pin10 (SCL), vor/zurück an Pin12 (SDA). RC-Empfänger + und - an VCC und GND des RP6. Die Hex-Datei dazu ist im Anhang.Code:// RC-RP6 erster Versuch 18.11.07 mic #include "rblib.h" #include "rblib.c" uint8_t y, z; uint8_t rc_input_pwr, rc_input_dir; uint8_t rc_pwr, rc_dir; ISR(TIMER0_COMP_vect) { //static uint16_t count=0; static uint16_t rc_temp_pwr=0; static uint16_t rc_temp_dir=0; //if(count>x) PORTA &= ~16; else PORTA |= 16; // E_INT1 (Pin8) //if(count>y) PORTC &= ~1; else PORTC |= 1; // SCL (Pin10) //if(count>z) PORTC &= ~2; else PORTC |= 2; // SDA (Pin12) //if(count<1000)count++; else count=0; if (PINC & 1) rc_temp_dir++; else if (rc_temp_dir) { rc_input_dir=rc_temp_dir-1; rc_temp_dir=0; } if (PINC & 2) rc_temp_pwr++; else if (rc_temp_pwr) { rc_input_pwr=rc_temp_pwr-1; rc_temp_pwr=0; } } void servo_init(void) { //DDRA |= 16; // E_INT1 als Ausgang //DDRC |= 3; // SCL und SDA als Ausgang TCCR0 = (0 << WGM00) | (1 << WGM01); // CTC-Mode TCCR0 |= (0 << COM00) | (0 << COM01); // ohne OCR-Pin TCCR0 |= (0 << CS02) | (1 << CS01) | (0 << CS00); // prescaler /8 TIMSK = (1 << OCIE0); // Interrupt ein OCR0 = 9; // 100kHz? } int main(void) { rblib_init(); servo_init(); setLEDs(0b1001); setMotorDir(FWD,FWD); setMotorPWM(0,0); while(1) { rc_pwr=0; rc_dir=0; if (rc_input_dir<120) { rc_dir=150-rc_input_dir; setMotorDir(BWD,FWD); } if (rc_input_dir>140) { rc_dir=rc_input_dir-110; setMotorDir(FWD,BWD); } if (rc_input_pwr<120) { rc_pwr=150-rc_input_pwr; setMotorDir(FWD,FWD); } if (rc_input_pwr>140) { rc_pwr=rc_input_pwr-110; setMotorDir(BWD,BWD); } rc_pwr*=3; if (rc_pwr) { if (rc_input_dir<120) setMotorPWM(rc_pwr-rc_dir,rc_pwr+rc_dir); else if (rc_input_dir>140) setMotorPWM(rc_pwr+rc_dir,rc_pwr-rc_dir); else setMotorPWM(rc_pwr,rc_pwr); } else { setMotorPWM(rc_dir*3, rc_dir*3); } } return 0; }
Gruß
mic






Zitieren

Lesezeichen