Forum: PC-Programmierung Programm auf RP6 abspielen


von eugen (Gast)


Lesenswert?

Guten Tag. ich beschäftige mich schon seit 2 wochen mit programmierung 
(et-tutorials.de) Daher bin voll Noob in Programmierung. ich wollte 
eigentlich ein Programm abspielen die andere Umgebung als RP6 hat. Wie 
kann ich so machen das auf RP6 (#include) auch funktioniert?
Vielen Dank.
das Programm:


// Domino Day für den RP6 16.11.07 mic

#include "rblib.h"
#include "rblib.c"

uint8_t  y, z;

ISR(TIMER0_COMP_vect)
{
  static uint16_t count=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;
}
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);
  z=225;
  y=100;
  delay(255);

while(1){
  y=161;      // hoch
  delay(100);
  z=211;      // greifen
  delay(50);
  y=45;       // runter
  delay(50);
   setMotorDir(BWD,BWD); // zurück
  setMotorPWM(50,50);
  delay(50);
  setMotorPWM(0,0);
  delay(50);
  z=202;      // loslassen
  delay(150);
  z=195;      // auf Abstand
  delay(50);
   setMotorDir(FWD,FWD); // vor
  setMotorPWM(50,50);
  delay(100);
  setMotorPWM(0,0);
}

  return 0;
}

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.