- Akku Tests und Balkonkraftwerk Speicher         
Seite 3 von 7 ErsteErste 12345 ... LetzteLetzte
Ergebnis 21 bis 30 von 64

Thema: Anschluss von Infrarotsensoren

  1. #21
    Erfahrener Benutzer Roboter-Spezialist
    Registriert seit
    26.01.2008
    Ort
    Allgäu
    Alter
    37
    Beiträge
    220
    Anzeige

    Praxistest und DIY Projekte
    also dirk, jetzt habe ich mich mal an das abändern deiner servolib für die M32 gemacht.
    als erstes war mein ziel, dass mein ir system nach wie vor funktioniert, nach dem ich es in deine isr eingebunden habe.
    allerdings habe ich da festgestellt, dass in task_SERVO() dein interrupt aus- und eingeschaltet wird.
    darum habe ich das abschalten aus der lib rausgeworfen, damit der Interrupt immer ausgelöst wird und mein ir system dauerhaft arbeitet.

    darum habe ich deinen wert der PULS_REPETITION auf 20 abgeändert und das mSleep(3) im demoprogramm weggelassen.
    mein IR system arbeitet nun wieder so wie früher.

    dann habe ich die werte von LEFT_TOUCH auf 50 und RIGHT_TOUCH auf 116 abgeändert.

    anschließend habe ich an PC4 noch einen Servo zum testen angeschlossen.

    das ganze schaut nun so aus:

    Code:
     /* ****************************************************************************
     *                           _______________________
     *                           \| RP6  ROBOT SYSTEM |/
     *                            \_-_-_-_-_-_-_-_-_-_/             >>> RP6 CONTROL
     * ----------------------------------------------------------------------------
     * ------------------------ [c]2008 - Dirk ------------------------------------
     * ****************************************************************************
     * File: RP6ControlServoLib.h
     * Version: 1.0
     * Target: RP6 CONTROL - ATMEGA32 @16.00MHz
     * Author(s): Dirk
     * ****************************************************************************
     * Description:
     * This is the RP6ControlServoLib header file.
     * You have to include this file, if you want to use the library
     * RP6ControlServoLib.c in your own projects.
     *
     * ****************************************************************************
     * THE CHANGELOG CAN BE FOUND AT THE END OF THIS FILE!
     * ****************************************************************************
     */
     
    /*****************************************************************************/
    // Includes:
    
    #include "RP6ControlLib.h"       // The RP6 Control Library.
                            // Always needs to be included!
    
    /*****************************************************************************/
    // Defines:
    
    // Servo constants:
    #define SERVO1            0b00000001
    #define SERVO2            0b00000010
    #define SERVO3            0b00000100
    #define SERVO4            0b00001000
    #define SERVO5            0b00010000
    #define SERVO6            0b00100000
    #define SERVO7            0b01000000
    
    
    // Servo movement limits (depending on servo type):
    // Standard Servos need an impulse every 20ms (50Hz). This impulse must have
    // a length of 1ms (0.7 .. 1ms) to move the servo lever to the left touch
    // and a length of 2ms (2 .. 2.3ms) for moving it to the right touch. In the
    // middle position the servo needs an impulse length of 1.5ms (1.3 .. 1.6ms).
    // If you want to modify the following constants for a certain servo type,
    // you must adapt the LEFT_TOUCH constant first (values ~70 .. 100 = ~0.7 ..
    // 1ms at 100kHz) by using a servo position value (servoX_position) of zero.
    // After that you have two "screws" to adjust the servo movement limits:
    // First you may change the RIGHT_TOUCH constant. If you choose a higher
    // value than 255, you will use 16-bit values. Higher values mean a longer
    // impulse length, but longer impulses than 2.3ms do not make sense.
    // Second you may alter the Timer 1 frequency constant (F_TIMER1).
    // A higher frequency leads to smaller steps of the servo movement. This of
    // course reduces the impulse length and may be compensated again by a higher
    // RIGHT_TOUCH constant. As a possible range of Timer 1 frequency values you
    // may use 50kHz (20us) .. 105.263kHz (9.5us).
    // HINT: If you alter F_TIMER1, you'll have to adapt LEFT_TOUCH and
    //       RIGHT_TOUCH again as you can see in the following table!
    //     Steps ->      9.5      10      12.5   15      17.5   20    [us]
    //  ------------------------------------------------------------------
    //  LEFT_TOUCH      74      71      57      47      41      35
    //  RIGHT_TOUCH      169      162      129      107      92      80
    //  F_TIMER1      105263   100000   80000   66667   57143   50000 [Hz]
    #define LEFT_TOUCH         50         // Left servo touch      abgeändert
    #define RIGHT_TOUCH         116         // Right servo touch     abgeändert
    #define MIDDLE_POSITION      (RIGHT_TOUCH / 2) // Middle position (~1.5ms)
    #define PULSE_REPETITION   20         // Pulse repetition freq. (~50Hz)
    #define F_TIMER1         72000      // abgeändert auf 72khz
    
    // Servo ports:
    #define SERVO1_PULSE_ON      (PORTC |= IO_PC2)   // PC2
    #define SERVO1_PULSE_OFF   (PORTC &= ~IO_PC2)
    #define SERVO2_PULSE_ON      (PORTC |= IO_PC3)   // PC3
    #define SERVO2_PULSE_OFF   (PORTC &= ~IO_PC3)
    #define SERVO3_PULSE_ON      (PORTC |= IO_PC4)   // PC4
    #define SERVO3_PULSE_OFF   (PORTC &= ~IO_PC4)
    #define SERVO4_PULSE_ON      (PORTC |= IO_PC5)   // PC5
    #define SERVO4_PULSE_OFF   (PORTC &= ~IO_PC5)
    #define SERVO5_PULSE_ON      (PORTC |= IO_PC6)   // PC6
    #define SERVO5_PULSE_OFF   (PORTC &= ~IO_PC6)
    #define SERVO6_PULSE_ON      (PORTC |= IO_PC7)   // PC7
    #define SERVO6_PULSE_OFF   (PORTC &= ~IO_PC7)
    #define SERVO7_PULSE_ON      (PORTD |= IO_PD5)   // PD5
    #define SERVO7_PULSE_OFF   (PORTD &= ~IO_PD5)
    
    // -----------------------------------------------------------
    // Other possible ports for connecting Servos to RP6Control:
    //#define SERVOx_PULSE_ON      (PORTA |= ADC6)      // PA6
    //#define SERVOx_PULSE_OFF   (PORTA &= ~ADC6)
    //#define SERVOx_PULSE_ON      (PORTA |= ADC7)      // PA7
    //#define SERVOx_PULSE_OFF   (PORTA &= ~ADC7)
    // -----------------------------------------------------------
    
    /*****************************************************************************/
    // Variables:
    
    uint16_t servo1_position;      // Servo 1 position [0..RIGHT_TOUCH]
    uint16_t servo2_position;      // Servo 2 position [0..RIGHT_TOUCH]
    uint16_t servo3_position;      // Servo 3 position [0..RIGHT_TOUCH]
    uint16_t servo4_position;      // Servo 4 position [0..RIGHT_TOUCH]
    uint16_t servo5_position;      // Servo 5 position [0..RIGHT_TOUCH]
    uint16_t servo6_position;      // Servo 6 position [0..RIGHT_TOUCH]
    uint16_t servo7_position;      // Servo 7 position [0..RIGHT_TOUCH]
    
    
    /*****************************************************************************/
    // Functions:
    
    void initSERVO(uint8_t servos);
    void startSERVO(void);
    void stopSERVO(void);
    void pulseSERVO(void);
    void task_SERVO(void);
    
    /******************************************************************************
     * Additional info
     * ****************************************************************************
     * Changelog:
     * - v. 1.0 (initial release) 31.12.2008 by Dirk
     *
     * ****************************************************************************
     */
    
    /*****************************************************************************/
    // EOF
    Code:
     /* ****************************************************************************
     *                           _______________________
     *                           \| RP6  ROBOT SYSTEM |/
     *                            \_-_-_-_-_-_-_-_-_-_/             >>> RP6 CONTROL
     * ----------------------------------------------------------------------------
     * ------------------------ [c]2008 - Dirk ------------------------------------
     * ****************************************************************************
     * File: RP6ControlServoLib.c
     * Version: 1.0
     * Target: RP6 CONTROL - ATMEGA32 @16.00MHz
     * Author(s): Dirk
     * ****************************************************************************
     * Description:
     * This is my simple RP6 Control Servo Library for up to 8 Servos.
     *
     * COMMENT: It is a good idea to use a separate power supply for the servos!
     *
     * Servo connections:
     *         SERVO1 -> I/O Pin 7 (IO_PC2)      SERVO5 -> I/O Pin 4 (IO_PC6)
     *         SERVO2 -> I/O Pin 5 (IO_PC3)      SERVO6 -> I/O Pin 1 (IO_PC7)
     *         SERVO3 -> I/O Pin 6 (IO_PC4)      SERVO7 -> I/O Pin 9 (IO_PD5)
     *         SERVO4 -> I/O Pin 3 (IO_PC5)      
     *
     * ****************************************************************************
     * ATTENTION: Stopwatch 1 is used for the servo task! Please do
     *            not use this stopwatch elsewhere in your program!
     *
     * ****************************************************************************
     * THE CHANGELOG CAN BE FOUND AT THE END OF THIS FILE!
     * ****************************************************************************
     */
     
    /*****************************************************************************/
    // Includes:
    
    #include "RP6ControlServoLib.h"
    
    /*****************************************************************************/
    // Variables:
    
    uint8_t usedservos;
    uint8_t servo_on = FALSE;
    
    uint8_t interruptcounter; //abgeändert
    
    uint16_t impulselength1 = 0;
    uint16_t impulselength2 = 0;
    uint16_t impulselength3 = 0;
    uint16_t impulselength4 = 0;
    uint16_t impulselength5 = 0;
    uint16_t impulselength6 = 0;
    uint16_t impulselength7 = 0;
    
    
    volatile uint16_t intcounter = 0;
    
    /*****************************************************************************/
    // Functions:
    
    /**
     * INIT SERVO
     *
     * Call this once before using the servo function.
     * Timer 1 is configured to work in "Clear Timer On
     * Compare Match Mode" (CTC). So no PWM is generated!
     * The timer runs on a fixed frequency (100kHz).
     *
     * Input:  Servos -> Used Servos
     *         Examples:
     *         - initSERVO(SERVO1 | SERVO2) -> Use only Servos 1 and 2
     *         - initSERVO(SERVO1 | SERVO6) -> Use only Servos 1 and 6
     *         - initSERVO(SERVO1 | SERVO2 | SERVO8) -> Use Servos 1, 2 and 8
     *
     */
    void initSERVO(uint8_t servos)
    {
       usedservos = servos;            // Save used Servos
       impulselength1 = 0;
       impulselength2 = 0;
       impulselength3 = 0;
       impulselength4 = 0;
       impulselength5 = 0;
       impulselength6 = 0;
       impulselength7 = 0;
       
       if (servos & SERVO1) {DDRC |= IO_PC2; PORTC &= ~IO_PC2;}
       if (servos & SERVO2) {DDRC |= IO_PC3; PORTC &= ~IO_PC3;}
       if (servos & SERVO3) {DDRC |= IO_PC4; PORTC &= ~IO_PC4;}
       if (servos & SERVO4) {DDRC |= IO_PC5; PORTC &= ~IO_PC5;}
       if (servos & SERVO5) {DDRC |= IO_PC6; PORTC &= ~IO_PC6;}
       if (servos & SERVO6) {DDRC |= IO_PC7; PORTC &= ~IO_PC7;}
       if (servos & SERVO7) {DDRD |= IO_PD5; PORTD &= ~IO_PD5;}
       
    // -----------------------------------------------------------
    // Other possible ports for connecting Servos to RP6Control:
    //   if (servos & SERVOx) {DDRA |= ADC6; PORTA &= ~ADC6;}
    //   if (servos & SERVOx) {DDRA |= ADC7; PORTA &= ~ADC7;}
    // -----------------------------------------------------------
       cli();
       // Timer 1: Normal port operation, mode 4 (CTC), clk/8
       TCCR1A =  (0 << COM1A1)
             | (0 << COM1A0)
             | (0 << COM1B1)
             | (0 << COM1B0)
             | (0 << FOC1A)
             | (0 << FOC1B)
             | (0 << WGM11)
             | (0 << WGM10);
       TCCR1B =  (0 << ICNC1)
             | (0 << ICES1)
             | (0 << WGM13)
             | (1 << WGM12)
             | (0 << CS12)
             | (1 << CS11)
             | (0 << CS10);
       OCR1A = ((F_CPU/8/F_TIMER1)-1);   // abgeändert auf 26,777 
    // ------------------------------------------------------
    // Possible OCR1A values (F_CPU = 16000000):
    //   OCR1A = 2000000 / F_TIMER1 - 1   // F_TIMER1  (Steps)
    //   OCR1A = 18;                  // 105263Hz  (9.5us)
    //   OCR1A = 19;                  // 100000Hz   (10us)
    //   OCR1A = 24;                  //  80000Hz (12.5us)
    //   OCR1A = 29;                  //  66667Hz   (15us)
    //   OCR1A = 34;                  //  57143Hz (17.5us)
    //   OCR1A = 39;                  //  50000Hz   (20us)
    // ------------------------------------------------------
       // Enable output compare A match interrupts:
       startSERVO();
       sei();
       startStopwatch1();               // Needed for 20ms pulse repetition
    }
    
    /**
     * START SERVO
     *
     * If the servo function was stopped with the
     * function stopSERVO() before, it can be
     * started again with this function.
     *
     */
    void startSERVO(void)
    {
       TIMSK |= (1 << OCIE1A);
       servo_on = TRUE;
    }
    
    /**
     * STOP SERVO
     *
     * The servo function uses a certain amount of the
     * processor's calculating time. If the Servos are
     * not moving for a while, the Timer 1 interrupt
     * can be stopped with this function.
     *
     */
    void stopSERVO(void)
    {
       TIMSK &= ~(1 << OCIE1A);
       servo_on = FALSE;
    }
    
    /**
     * PULSE SERVO
     *
     * This is the servo pulse generation. This function
     * must be called every 20ms (pulse repetition).
     *
     * position = 0               : Left touch
     * position = RIGHT_TOUCH     : Right touch
     * position = MIDDLE_POSITION : Middle position
     *
     * ! Please make sure in your main program, that the !
     * ! servo position values (servoX_position) don't   !
     * ! exceed RIGHT_TOUCH!!!                           !
     *
     * COMMENT: The pulses are only started here!
     *          The pulses end in the Timer 1 ISR!
     *
     */
    void pulseSERVO(void)
    {
       if (servo_on) {
          intcounter = RIGHT_TOUCH;      // Avoid interference of Timer 1 ISR!
                            // (Only necessary, if pulseSERVO() is called
                            //  from outside of this library!)
          if (usedservos & SERVO1) {
             SERVO1_PULSE_ON; impulselength1 = LEFT_TOUCH + servo1_position;}
          if (usedservos & SERVO2) {
             SERVO2_PULSE_ON; impulselength2 = LEFT_TOUCH + servo2_position;}
          if (usedservos & SERVO3) {
             SERVO3_PULSE_ON; impulselength3 = LEFT_TOUCH + servo3_position;}
          if (usedservos & SERVO4) {
             SERVO4_PULSE_ON; impulselength4 = LEFT_TOUCH + servo4_position;}
          if (usedservos & SERVO5) {
             SERVO5_PULSE_ON; impulselength5 = LEFT_TOUCH + servo5_position;}
          if (usedservos & SERVO6) {
             SERVO6_PULSE_ON; impulselength6 = LEFT_TOUCH + servo6_position;}
          if (usedservos & SERVO7) {
             SERVO7_PULSE_ON; impulselength7 = LEFT_TOUCH + servo7_position;}
          
          intcounter = 0;
       }
    }
    
    /**
     * TIMER1 ISR
     *
     * In this ISR the servo pulses are finished, if the
     * correct pulse length of each servo is reached.
     *
     */
    ISR (TIMER1_COMPA_vect)
    {interruptcounter++;		//abgeändert
      
    if(interruptcounter <21)
      {DDRD |= (1<<PD5);  //PD5 als Ausgang
      PORTD ^= (1<<PD5);
    
    }
    
    if(interruptcounter > 20 && interruptcounter <41)
      {DDRD &=~ (1<<PD5);
    }
    
    if(interruptcounter == 41)
      {interruptcounter =0;}
    
       intcounter++;
       if (intcounter == impulselength1) {SERVO1_PULSE_OFF;}
       if (intcounter == impulselength2) {SERVO2_PULSE_OFF;}
       if (intcounter == impulselength3) {SERVO3_PULSE_OFF;}
       if (intcounter == impulselength4) {SERVO4_PULSE_OFF;}
       if (intcounter == impulselength5) {SERVO5_PULSE_OFF;}
       if (intcounter == impulselength6) {SERVO6_PULSE_OFF;}
       if (intcounter == impulselength7) {SERVO7_PULSE_OFF;}
       
    }
    
    /**
     * SERVO TASK
     *
     * This is the servo task. The task performes the pulse repetition
     * with the help of a stopwatch.
     * At the next call of the servo task (earliest about 3ms after the
     * last servo pulse generation) the compare A match interrupt will
     * be disabled to reduce the interrupt load. It will be enabled
     * again after the next pulseSERVO() function call.
     *
     */
    void task_SERVO(void)
    {
       
       if (getStopwatch1() > PULSE_REPETITION) { // Pulse every ~20ms
          pulseSERVO();               // Servo pulse generation
         
          setStopwatch1(0);
       }
    }
    
    /******************************************************************************
     * Additional info
     * ****************************************************************************
     * Changelog:
     * - v. 1.0 (initial release) 31.12.2008 by Dirk
     *
     * ****************************************************************************
     */
    
    /*****************************************************************************/
    // EOF
    mein demoprogramm:
    Code:
     // Uncommented Version of RP6ControlServo.c
    
    // ------------------------------------------------------------------------------------------
    
    #include "RP6ControlLib.h"
    #include "RP6ControlServoLib.h"
    #include "RP6I2CmasterTWI.h"
    #include "RP6Control_I2CMasterLib.h"
    
    //Servo 1 => PC2
    //Servo 2 => PC3
    //Servo 3=> PC4 
    //Servo 4=> PC5 
    //Servo 5=> PC6
    
    
    uint16_t a;
    uint8_t b;
    
    
    void infrarotempfang(void)
    {if(b==0)
    {
    if (!(PINC & (1<<PC3)))
     {writeString_P("Infrarotempfang ein\n");
     writeStringLCD("a=:");
     writeString("a=:");
    writeInteger(a,DEC);
    
     writeIntegerLCD(a, DEC);
     writeChar('\n');
     
     a++;  //infrarot empfangen
     }}
    }
    
    
    
    
    
    void RP6_Bewegung(void)
    {if(a<50)
      {changeDirection(BWD);
      moveAtSpeed(50,50); //Roboter fährt
      }
    
    if(a==50)
      {moveAtSpeed(0,0);
    	startStopwatch2();
    	b=1;
      
    }
    
    if (getStopwatch2() >0 && getStopwatch2()<2000)
    {moveAtSpeed(0,0);
    }
    
    if (getStopwatch2()>2000)
    {a=0;
    b=0;
    stopStopwatch2();
    setStopwatch2(0);
    writeString_P("stopwatch auf 0\n");}
    }
    	
    void servoansteuerung(void)
    {if (getStopwatch3() <1000)
    	{servo3_position = LEFT_TOUCH;
    	writeString_P("LEFT Touch\n");}
    
    
    if (getStopwatch3() >1000 && getStopwatch3() <2000)
    	{servo3_position = 30;
    	writeString_P("servo position 30\n");}
    
    if (getStopwatch3() >2000 && getStopwatch3() <3000)
    		{servo3_position = RIGHT_TOUCH;
    		writeString_P("Servo Right touch\n");}
    		
    if (getStopwatch3() ==3000)
    	{stopStopwatch3();
    	setStopwatch3(0);
    	writeString_P("stopwatch3 auf 0 zurück\n");}
    }	
    	
    	
    int main(void)
    { 
       initRP6Control();
       
       I2CTWI_initMaster(100);  
    	
    	DDRC &=~ (1<<PC3);    //PC3 als Eingang infrarotempfänger
     
    a=0;        // a anfangs auf 0 setzen
    b=0;
     initSERVO(SERVO3); 
    startStopwatch3(); 
       
       while(true) 
       {infrarotempfang();
    RP6_Bewegung();
    servoansteuerung();
          task_SERVO();
    
       }
       return 0;
    }
    irgendwas größeres muss aber immer noch falsch sein, denn seit ich das initSERVO(SERVO3) im Demoprogramm habe geht das programm nach dem einschalten sofort wieder in den standby modus, d.h. es lässt sich gar nicht mehr richtig starten.

    vielleicht kannst du mir sagen, was ich noch falsch gemacht habe, mit deiner servolib bist du ja bestens vertraut.

    danke auf jeden fall schon mal im voraus.

    mfg andi

  2. #22
    Erfahrener Benutzer Robotik Einstein Avatar von Dirk
    Registriert seit
    30.04.2004
    Ort
    NRW
    Beiträge
    3.803
    Hallo proevofreak,

    ich habe nicht das ganze Programm angesehen.

    Wichtig ist auf jeden Fall, die Variable interruptcounter anders zu deklarieren:
    volatile uint8_t interruptcounter; //abgeändert

    Die task_SERVO muss wahrscheinlich auch öfter aufgerufen werden, weil deine Unterprogramme doch viel Zeit brauchen, bis die Hauptschleife wieder dran kommt.

    Gruß Dirk

  3. #23
    Erfahrener Benutzer Roboter-Spezialist
    Registriert seit
    26.01.2008
    Ort
    Allgäu
    Alter
    37
    Beiträge
    220
    danke dirk für deine hilfe,
    jetzt hab ich das mit dem volatile noch abgeändert und jetzt funktioniert alles.
    das zuletzt gepostete problem, dass das programm gar nicht erst startet lag allerdings an etwas anderem, nämlich an dem, dass die akkuspannung nur noch 4,8V betrug.
    wenn alles ferig ist, werde ich noch mit bildern und ein video posten.

    mfg

  4. #24
    Erfahrener Benutzer Roboter-Spezialist
    Registriert seit
    26.01.2008
    Ort
    Allgäu
    Alter
    37
    Beiträge
    220
    so, mein problem mit der gleichzeitigen servosteuerung und ir- empfang habe ich ja nun gelöst.
    da ich aber das ir antikollissionssystem als makro in dirks servolib (M32) einbinden will, bin ich heute auf ein neues problem gestoßen.

    und zwar habe ich mein bisheriges ir programm überwiegend unverändert in dirks servolib eingebunden.

    dazu habe ich in die header datei void infrarotkollission(void) eingefügt.

    das infrarotkollission() programm habe ich in die .c datei eingefügt und dazu noch

    uint16_t ir_counter; //abgeändert
    uint8_t ir_hindernis;
    uint8_t ir_erweiterung;

    eingefügt:

    Code:
     /* ****************************************************************************
     *                           _______________________
     *                           \| RP6  ROBOT SYSTEM |/
     *                            \_-_-_-_-_-_-_-_-_-_/             >>> RP6 CONTROL
     * ----------------------------------------------------------------------------
     * ------------------------ [c]2008 - Dirk ------------------------------------
     * ****************************************************************************
     * File: RP6ControlServoLib.c
     * Version: 1.0
     * Target: RP6 CONTROL - ATMEGA32 @16.00MHz
     * Author(s): Dirk
     * ****************************************************************************
     * Description:
     * This is my simple RP6 Control Servo Library for up to 8 Servos.
     *
     * COMMENT: It is a good idea to use a separate power supply for the servos!
     *
     * Servo connections:
     *         SERVO1 -> I/O Pin 7 (IO_PC2)      SERVO5 -> I/O Pin 4 (IO_PC6)
     *         SERVO2 -> I/O Pin 5 (IO_PC3)      SERVO6 -> I/O Pin 1 (IO_PC7)
     *         SERVO3 -> I/O Pin 6 (IO_PC4)      SERVO7 -> I/O Pin 9 (IO_PD5)
     *         SERVO4 -> I/O Pin 3 (IO_PC5)      
     *
     * ****************************************************************************
     * ATTENTION: Stopwatch 1 is used for the servo task! Please do
     *            not use this stopwatch elsewhere in your program!
     *
     * ****************************************************************************
     * THE CHANGELOG CAN BE FOUND AT THE END OF THIS FILE!
     * ****************************************************************************
     */
     
    /*****************************************************************************/
    // Includes:
    
    #include "RP6ControlServoLib.h"
    
    /*****************************************************************************/
    // Variables:
    
    uint8_t usedservos;
    uint8_t servo_on = FALSE;
    
    
    uint16_t impulselength1 = 0;
    uint16_t impulselength2 = 0;
    uint16_t impulselength3 = 0;
    uint16_t impulselength4 = 0;
    uint16_t impulselength5 = 0;
    uint16_t impulselength6 = 0;
    uint16_t impulselength7 = 0;
    
    uint16_t ir_counter;	//abgeändert
    uint8_t ir_hindernis;
    uint8_t ir_erweiterung;
    
    volatile uint8_t interruptcounter; //abgeändert
    
    volatile uint16_t intcounter = 0;
    
    /*****************************************************************************/
    // Functions:
    
    /**
     * INIT SERVO
     *
     * Call this once before using the servo function.
     * Timer 1 is configured to work in "Clear Timer On
     * Compare Match Mode" (CTC). So no PWM is generated!
     * The timer runs on a fixed frequency (100kHz).
     *
     * Input:  Servos -> Used Servos
     *         Examples:
     *         - initSERVO(SERVO1 | SERVO2) -> Use only Servos 1 and 2
     *         - initSERVO(SERVO1 | SERVO6) -> Use only Servos 1 and 6
     *         - initSERVO(SERVO1 | SERVO2 | SERVO8) -> Use Servos 1, 2 and 8
     *
     */
    void initSERVO(uint8_t servos)
    {
       usedservos = servos;            // Save used Servos
       impulselength1 = 0;
       impulselength2 = 0;
       impulselength3 = 0;
       impulselength4 = 0;
       impulselength5 = 0;
       impulselength6 = 0;
       impulselength7 = 0;
       
       if (servos & SERVO1) {DDRC |= IO_PC2; PORTC &= ~IO_PC2;}
       if (servos & SERVO2) {DDRC |= IO_PC3; PORTC &= ~IO_PC3;}
       if (servos & SERVO3) {DDRC |= IO_PC4; PORTC &= ~IO_PC4;}
       if (servos & SERVO4) {DDRC |= IO_PC5; PORTC &= ~IO_PC5;}
       if (servos & SERVO5) {DDRC |= IO_PC6; PORTC &= ~IO_PC6;}
       if (servos & SERVO6) {DDRC |= IO_PC7; PORTC &= ~IO_PC7;}
       if (servos & SERVO7) {DDRD |= IO_PD5; PORTD &= ~IO_PD5;}
       
    // -----------------------------------------------------------
    // Other possible ports for connecting Servos to RP6Control:
    //   if (servos & SERVOx) {DDRA |= ADC6; PORTA &= ~ADC6;}
    //   if (servos & SERVOx) {DDRA |= ADC7; PORTA &= ~ADC7;}
    // -----------------------------------------------------------
       cli();
       // Timer 1: Normal port operation, mode 4 (CTC), clk/8
       TCCR1A =  (0 << COM1A1)
             | (0 << COM1A0)
             | (0 << COM1B1)
             | (0 << COM1B0)
             | (0 << FOC1A)
             | (0 << FOC1B)
             | (0 << WGM11)
             | (0 << WGM10);
       TCCR1B =  (0 << ICNC1)
             | (0 << ICES1)
             | (0 << WGM13)
             | (1 << WGM12)
             | (0 << CS12)
             | (1 << CS11)
             | (0 << CS10);
       OCR1A = ((F_CPU/8/F_TIMER1)-1);   // abgeändert auf 26,777 
    // ------------------------------------------------------
    // Possible OCR1A values (F_CPU = 16000000):
    //   OCR1A = 2000000 / F_TIMER1 - 1   // F_TIMER1  (Steps)
    //   OCR1A = 18;                  // 105263Hz  (9.5us)
    //   OCR1A = 19;                  // 100000Hz   (10us)
    //   OCR1A = 24;                  //  80000Hz (12.5us)
    //   OCR1A = 29;                  //  66667Hz   (15us)
    //   OCR1A = 34;                  //  57143Hz (17.5us)
    //   OCR1A = 39;                  //  50000Hz   (20us)
    // ------------------------------------------------------
       // Enable output compare A match interrupts:
       startSERVO();
       sei();
       startStopwatch1();               // Needed for 20ms pulse repetition
    }
    
    /**
     * START SERVO
     *
     * If the servo function was stopped with the
     * function stopSERVO() before, it can be
     * started again with this function.
     *
     */
    void startSERVO(void)
    {
       TIMSK |= (1 << OCIE1A);
       servo_on = TRUE;
    }
    
    /**
     * STOP SERVO
     *
     * The servo function uses a certain amount of the
     * processor's calculating time. If the Servos are
     * not moving for a while, the Timer 1 interrupt
     * can be stopped with this function.
     *
     */
    void stopSERVO(void)
    {
       TIMSK &= ~(1 << OCIE1A);
       servo_on = FALSE;
    }
    
    /**
     * PULSE SERVO
     *
     * This is the servo pulse generation. This function
     * must be called every 20ms (pulse repetition).
     *
     * position = 0               : Left touch
     * position = RIGHT_TOUCH     : Right touch
     * position = MIDDLE_POSITION : Middle position
     *
     * ! Please make sure in your main program, that the !
     * ! servo position values (servoX_position) don't   !
     * ! exceed RIGHT_TOUCH!!!                           !
     *
     * COMMENT: The pulses are only started here!
     *          The pulses end in the Timer 1 ISR!
     *
     */
    void pulseSERVO(void)
    {
       if (servo_on) {
          intcounter = RIGHT_TOUCH;      // Avoid interference of Timer 1 ISR!
                            // (Only necessary, if pulseSERVO() is called
                            //  from outside of this library!)
          if (usedservos & SERVO1) {
             SERVO1_PULSE_ON; impulselength1 = LEFT_TOUCH + servo1_position;}
          if (usedservos & SERVO2) {
             SERVO2_PULSE_ON; impulselength2 = LEFT_TOUCH + servo2_position;}
          if (usedservos & SERVO3) {
             SERVO3_PULSE_ON; impulselength3 = LEFT_TOUCH + servo3_position;}
          if (usedservos & SERVO4) {
             SERVO4_PULSE_ON; impulselength4 = LEFT_TOUCH + servo4_position;}
          if (usedservos & SERVO5) {
             SERVO5_PULSE_ON; impulselength5 = LEFT_TOUCH + servo5_position;}
          if (usedservos & SERVO6) {
             SERVO6_PULSE_ON; impulselength6 = LEFT_TOUCH + servo6_position;}
          if (usedservos & SERVO7) {
             SERVO7_PULSE_ON; impulselength7 = LEFT_TOUCH + servo7_position;}
          
          intcounter = 0;
       }
    }
    
    /**
     * TIMER1 ISR
     *
     * In this ISR the servo pulses are finished, if the
     * correct pulse length of each servo is reached.
     *
     */
    ISR (TIMER1_COMPA_vect)
    {interruptcounter++;		//abgeändert
      
    if(interruptcounter <21)
      {DDRD |= (1<<PD5);  //PD5 als Ausgang
      PORTD ^= (1<<PD5);
    
    }
    
    if(interruptcounter > 20 && interruptcounter <41)
      {DDRD &=~ (1<<PD5);
    }
    
    if(interruptcounter == 41)
      {interruptcounter =0;}
    
       intcounter++;
       if (intcounter == impulselength1) {SERVO1_PULSE_OFF;}
       if (intcounter == impulselength2) {SERVO2_PULSE_OFF;}
       if (intcounter == impulselength3) {SERVO3_PULSE_OFF;}
       if (intcounter == impulselength4) {SERVO4_PULSE_OFF;}
       if (intcounter == impulselength5) {SERVO5_PULSE_OFF;}
       if (intcounter == impulselength6) {SERVO6_PULSE_OFF;}
       if (intcounter == impulselength7) {SERVO7_PULSE_OFF;}
       
    }
    
    /**
     * SERVO TASK
     *
     * This is the servo task. The task performes the pulse repetition
     * with the help of a stopwatch.
     * At the next call of the servo task (earliest about 3ms after the
     * last servo pulse generation) the compare A match interrupt will
     * be disabled to reduce the interrupt load. It will be enabled
     * again after the next pulseSERVO() function call.
     *
     */
    void task_SERVO(void)
    {
       
       if (getStopwatch1() > PULSE_REPETITION) { // Pulse every ~20ms
          pulseSERVO();               // Servo pulse generation
         
          setStopwatch1(0);
       }
    }
    
    
    
    void infrarotkollission(void)
    {DDRC &=~ (1<<PC3);    //PC3 als Eingang infrarotempfänger
    
    if(ir_erweiterung ==0)
    {
    if (!(PINC & (1<<PC3)))
     {writeString_P("Infrarotempfang ein\n");
     writeStringLCD("ir_counter=:");
     writeString("ir_counter=:");
    writeInteger(ir_counter,DEC);
    
     writeIntegerLCD(ir_counter, DEC);
     writeChar('\n');
     
     ir_counter++;  //infrarot empfangen
     }
    }
    
    if (ir_counter ==50)
    	{ir_hindernis = true;
    	ir_erweiterung = 1;
    	startStopwatch8();}
    
    if (getStopwatch8()>1000)
    {ir_counter =0;
    ir_erweiterung =0;
    ir_hindernis = false;
    stopStopwatch8();
    setStopwatch8(0);}
    
    }
    
    
    
    
    /******************************************************************************
     * Additional info
     * ****************************************************************************
     * Changelog:
     * - v. 1.0 (initial release) 31.12.2008 by Dirk
     *
     * ****************************************************************************
     */
    
    /*****************************************************************************/
    // EOF
    und in meinem demoprogramm das ganze aufgerufen:

    Code:
     // Uncommented Version of RP6ControlServo.c
    
    // ------------------------------------------------------------------------------------------
    
    #include "RP6ControlLib.h"
    #include "RP6ControlServoLib.h"
    #include "RP6I2CmasterTWI.h"
    #include "RP6Control_I2CMasterLib.h"
    
    //Servo 1 => PC2
    //Servo 2 => PC3
    //Servo 3=> PC4 
    //Servo 4=> PC5 
    //Servo 5=> PC6
    
    
    
    
    
    void RP6_Bewegung(void)
    {if (ir_hindernis)
    	{writeString_P("objekt erkannt\n");}
    		
    }
    
    
    
    
    
    
    	
    void servoansteuerung(void)
    {if (getStopwatch3() <1000)
    	{servo3_position = 0;
    	writeString_P("LEFT Touch\n");}
    
    
    if (getStopwatch3() >1000 && getStopwatch3() <2000)
    	{servo3_position = 40;
    	writeString_P("servo position 40\n");}
    	
    if (getStopwatch3() >2000 && getStopwatch3() <3000)
    	{servo3_position = 80;}
    
    if (getStopwatch3() >3000 && getStopwatch3() <4000)
    		{servo3_position = RIGHT_TOUCH;
    		writeString_P("Servo Right touch\n");}
    		
    if (getStopwatch3() >4000 && getStopwatch3() <5000)
    	{servo3_position = 80;}
    	
    if (getStopwatch3() >5000 && getStopwatch3() <6000)
    	{servo3_position = 40;}
    		
    if (getStopwatch3() >6000 && getStopwatch3() <7000)
    	{servo3_position = 0;
    	writeString_P("LEFT Touch\n");}
    	
    if (getStopwatch3() >7000)
    	{
    	setStopwatch3(0);
    	writeString_P("stopwatch3 auf 0 zurück\n");}
    	
    	}
    	
    int main(void)
    { 
       initRP6Control();
       
       I2CTWI_initMaster(100);  
    	
    	
     
    
     initSERVO(SERVO3); 
    startStopwatch3(); 
       
       while(true) 
       {
    servoansteuerung();
          task_SERVO();
    	  infrarotkollission();
    	  RP6_Bewegung();
    
       }
       return 0;
    }
    nun bringt der compiler aber folgende fehlermeldung:

    Code:
    In file included from IR_Radar.c:7:
    ../../RP6Lib/RP6common/RP6I2CmasterTWI.h: In function 'inrarotkollission':
    ../../RP6Lib/RP6common/RP6I2CmasterTWI.h:37: warning: empty declaration
    ../../RP6Lib/RP6common/RP6I2CmasterTWI.h:45: error: storage class specified for parameter 'TWI_statusReg'
    ../../RP6Lib/RP6common/RP6I2CmasterTWI.h:47: error: storage class specified for parameter 'i2c_req_adr'
    ../../RP6Lib/RP6common/RP6I2CmasterTWI.h:48: error: storage class specified for parameter 'TWI_operation'
    In file included from IR_Radar.c:8:
    RP6Control_I2CMasterLib.h:126: error: storage class specified for parameter 'mleft_speed'
    RP6Control_I2CMasterLib.h:127: error: storage class specified for parameter 'mright_speed'
    RP6Control_I2CMasterLib.h:130: error: storage class specified for parameter 'mleft_dist'
    RP6Control_I2CMasterLib.h:131: error: storage class specified for parameter 'mright_dist'
    RP6Control_I2CMasterLib.h:134: error: storage class specified for parameter 'mleft_des_speed'
    RP6Control_I2CMasterLib.h:135: error: storage class specified for parameter 'mright_des_speed'
    RP6Control_I2CMasterLib.h:138: error: storage class specified for parameter 'mleft_power'
    RP6Control_I2CMasterLib.h:139: error: storage class specified for parameter 'mright_power'
    RP6Control_I2CMasterLib.h:184: error: storage class specified for parameter 'bumper_left'
    RP6Control_I2CMasterLib.h:185: error: storage class specified for parameter 'bumper_right'
    RP6Control_I2CMasterLib.h:187: error: storage class specified for parameter 'obstacle_left'
    RP6Control_I2CMasterLib.h:188: error: storage class specified for parameter 'obstacle_right'
    RP6Control_I2CMasterLib.h:192: error: storage class specified for parameter 'adcBat'
    RP6Control_I2CMasterLib.h:193: error: storage class specified for parameter 'adcMotorCurrentLeft'
    RP6Control_I2CMasterLib.h:194: error: storage class specified for parameter 'adcMotorCurrentRight'
    RP6Control_I2CMasterLib.h:195: error: storage class specified for parameter 'adcLSL'
    RP6Control_I2CMasterLib.h:196: error: storage class specified for parameter 'adcLSR'
    RP6Control_I2CMasterLib.h:197: error: storage class specified for parameter 'adc0'
    RP6Control_I2CMasterLib.h:198: error: storage class specified for parameter 'adc1'
    RP6Control_I2CMasterLib.h:210: error: storage class specified for parameter 'RC5data_t'
    RP6Control_I2CMasterLib.h:215: warning: parameter names (without types) in function declaration
    IR_Radar.c:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    IR_Radar.c:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    IR_Radar.c:67: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    IR_Radar.c:88: error: old-style parameter declarations in prototyped function definition
    IR_Radar.c:87: error: expected '{' at end of input
    make.exe: *** [IR_Radar.o] Error 1
    
    > Process Exit Code: 2
    > Time Taken: 00:01
    leider kann ich mit dieser fehlermeldung nicht all zu viel anfangen, da sie etliche meldungen bringt, die mir komplett fremd sind und dazu sehr viele fehlermeldungen in der I2C_Masterlib bringt, obwohl ich diese gar nicht verändert habe.

    kann mir jemand sagen, was ich genau beim lib abändern falsch gemacht habe?
    leider habe ich bisher noch nie großartig eine lib abgeändert und stehe darum ziemlich auf der leitung

    mfg

  5. #25
    Erfahrener Benutzer Roboter-Spezialist
    Registriert seit
    26.01.2008
    Ort
    Allgäu
    Alter
    37
    Beiträge
    220
    so, also den großen fehler hab ich nun gefunden. in der headerdatei habe ich hinter infrarotkollission() das ; vergessen.

    aber irgendwas passt immer noch nicht. jetzt bringt der compiler folgende fehlermeldung:
    Code:
    R_Radar.c: In function 'RP6_Bewegung':
    IR_Radar.c:21: error: 'ir_hindernis' undeclared (first use in this function)
    IR_Radar.c:21: error: (Each undeclared identifier is reported only once
    IR_Radar.c:21: error: for each function it appears in.)
    make.exe: *** [IR_Radar.o] Error 1
    das heißt, dass er mein ir_hindernis noch nicht findet. kann mir jemand sagen, ob ich das mit ir_hindernis = true bzw. ir_hindernis = false in der .c datei der servolib und das

    if (ir_hindernis)
    {writeString_P("objekt erkannt\n");}

    so machen darf?
    ich muss zugeben, dass ich es mir in der original robotBaseLib abgeschaut habe, und bisher noch nicht so 100%ig genau verstanden habe, was es damit auf sich hat.

    mfg andi

  6. #26
    Erfahrener Benutzer Begeisterter Techniker
    Registriert seit
    09.04.2008
    Beiträge
    384
    ir_hindernis ist eine globale variabele. Dazu muss du das auch declareren mit "extern uint8_t ir_hindernis". Stichwort ist hier extern. So weiss der compiler das es hier um eine globale variabele geht.
    Moglicherweise muss du auch noch in der .h datei diese variabele eintragen. Siehe auch nach bestehende globale variabele die mit "extern" declariert werden.

  7. #27
    Erfahrener Benutzer Roboter-Spezialist
    Registriert seit
    26.01.2008
    Ort
    Allgäu
    Alter
    37
    Beiträge
    220
    also jetzt hab ich es mal mit dem extern ausprobiert. aber auch nachdem ich extern uint8_t ir_hindernis in der header und in der .c datei eingefügt habe, kommt immer noch die gleiche fehlermeldung wie vorher.
    das heißt das problem muss irgendwo anders liegen.

    mfg

  8. #28
    Erfahrener Benutzer Roboter-Spezialist
    Registriert seit
    26.01.2008
    Ort
    Allgäu
    Alter
    37
    Beiträge
    220
    so, jetzt habe ich mir nochmal genau angeschaut, wie das mit dem obstacle_left() bzw obstacle_right() auf der base programmiert ist.
    dabei konnte ich folgendes finden:

    in der .h lib:
    Code:
    void task_ACS(void);
    die ACS funktion wird also hier auch aus der .h lib aufgerufen.

    das habe ich bei mir mit void infrarotkollission(void); in dirks servolib.h gemacht, also genau gleich wie hier gemacht.



    in der .c lib:
    Code:
    uint8_t obstacle_left;
    uint8_t obstacle_right;
    die variablen werden hier auch nicht als externe variablen deklariert.
    also wie bei mir in servolib.c



    dann das demoprogramm (Example_04_ACS):

    Code:
    // Uncommented Version of RP6Base_Stopwatches.c
    // written by Dominik S. Herwald
    // ------------------------------------------------------------------------------------------
    // Another uncommented version - this time of RP6Base_ACS.c.
    // ------------------------------------------------------------------------------------------
    
    #include "RP6RobotBaseLib.h" 
    
    void acsStateChanged(void)
    {
    	writeString_P("ACS state changed   L: ");
    	
    	if(obstacle_left)
    		writeChar('o');
    	else
    		writeChar(' ');
    		
    	writeString_P(" | R: ");
    	
    	if(obstacle_right)
    		writeChar('o');
    	else
    		writeChar(' ');	
    		
    	if(obstacle_right && obstacle_left)
    		writeString_P("   MIDDLE!");
    		
    	writeChar('\n');
    	
    	if(obstacle_left && obstacle_right)
    		statusLEDs.byte = 0b100100;
    	else
    		statusLEDs.byte = 0b000000;
    	statusLEDs.LED5 = obstacle_left;
    	statusLEDs.LED4 = (!obstacle_left);
    	statusLEDs.LED2 = obstacle_right;
    	statusLEDs.LED1 = (!obstacle_right);
    	
    	updateStatusLEDs();	
    }
    
    void bumpersStateChanged(void)
    {
    	writeString_P("Bumpers state changed!   BPL: ");
    	
    	if(bumper_left)
    		writeChar('o');
    	else
    		writeChar(' ');
    		
    	writeString_P(" | BPR: ");
    	
    	if(bumper_right)
    		writeChar('o');
    	else
    		writeChar(' ');
    		
    	writeChar('\n');
    }
    
    int main(void)
    {
    	initRobotBase();
    	
        writeString_P("\nRP6 ACS - Testprogram\n");
    	writeString_P("_____________________\n\n");
    
    	setLEDs(0b111111);
    	mSleep(1000);
    	setLEDs(0b001001);
    
    	ACS_setStateChangedHandler(acsStateChanged);
    	
    	BUMPERS_setStateChangedHandler(bumpersStateChanged);
    
    	powerON(); 
    	setACSPwrMed();
    
    	while(true) 
    	{		
    		task_RP6System();
    	}
    	return 0;
    }
    hier mein demoprogramm zum aufrufen meiner neuen acs funktion zum vergleich:

    Code:
     // Uncommented Version of RP6ControlServo.c
    
    // ------------------------------------------------------------------------------------------
    
    #include "RP6ControlLib.h"
    #include "RP6ControlServoLib.h"
    #include "RP6I2CmasterTWI.h"
    #include "RP6Control_I2CMasterLib.h"
    
    //Servo 1 => PC2
    //Servo 2 => PC3
    //Servo 3=> PC4 
    //Servo 4=> PC5 
    //Servo 5=> PC6
    
    
    
    
    
    void RP6_Bewegung(void)
    {if (ir_hindernis)
    	{writeString_P("objekt erkannt\n");}
    		
    }
    
    
    
    
    
    
    	
    void servoansteuerung(void)
    {if (getStopwatch3() <1000)
    	{servo3_position = 0;
    	writeString_P("LEFT Touch\n");}
    
    
    if (getStopwatch3() >1000 && getStopwatch3() <2000)
    	{servo3_position = 40;
    	writeString_P("servo position 40\n");}
    	
    if (getStopwatch3() >2000 && getStopwatch3() <3000)
    	{servo3_position = 80;}
    
    if (getStopwatch3() >3000 && getStopwatch3() <4000)
    		{servo3_position = RIGHT_TOUCH;
    		writeString_P("Servo Right touch\n");}
    		
    if (getStopwatch3() >4000 && getStopwatch3() <5000)
    	{servo3_position = 80;}
    	
    if (getStopwatch3() >5000 && getStopwatch3() <6000)
    	{servo3_position = 40;}
    		
    if (getStopwatch3() >6000 && getStopwatch3() <7000)
    	{servo3_position = 0;
    	writeString_P("LEFT Touch\n");}
    	
    if (getStopwatch3() >7000)
    	{
    	setStopwatch3(0);
    	writeString_P("stopwatch3 auf 0 zurück\n");}
    	
    	}
    	
    int main(void)
    { 
       initRP6Control();
       
       I2CTWI_initMaster(100);  
    	
    	
     
    
     initSERVO(SERVO3); 
    startStopwatch3(); 
       
       while(true) 
       {
    servoansteuerung();
          task_SERVO();
    	  infrarotkollission();
    	  RP6_Bewegung();
    
       }
       return 0;
    }
    da ich keinen grundlegenden unterschied zwischen meiner programmiervariante und der von der base feststellen kann, bei mir aber immer noch die fehlermeldung
    Code:
     
    -------- begin --------
    avr-gcc (WinAVR 20090313) 4.3.2
    Copyright (C) 2008 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    
    Compiling: IR_Radar.c
    avr-gcc -c -mmcu=atmega32 -I. -gdwarf-2   -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=IR_Radar.lst -I../../RP6Lib -I../../RP6Lib/RP6control -I../../RP6Lib/RP6common -std=gnu99 -MD -MP -MF .dep/IR_Radar.o.d IR_Radar.c -o IR_Radar.o
    IR_Radar.c: In function 'RP6_Bewegung':
    IR_Radar.c:21: error: 'ir_hindernis' undeclared (first use in this function)
    IR_Radar.c:21: error: (Each undeclared identifier is reported only once
    IR_Radar.c:21: error: for each function it appears in.)
    make.exe: *** [IR_Radar.o] Error 1
    
    > Process Exit Code: 2
    > Time Taken: 00:05
    kommt, hoffe ich nun, dass mir jemand aus dem forum helfen kann.

    mfg andi

  9. #29
    Erfahrener Benutzer Roboter Genie Avatar von SlyD
    Registriert seit
    27.11.2003
    Ort
    Paderborn
    Alter
    40
    Beiträge
    1.516
    ir_hindernis <<- wird nirgends in RP6ControlServo.c oder in einem der Header deklariert. Wurde oben ja schon gesagt.


    Und nachdem Du nen Header geändert hast immer einmal make clean ausführen zur Sicherheit soweit ich mich erinnere übernimmt der Compiler sonst Änderungen nicht.

    MfG,
    SlyD

  10. #30
    Erfahrener Benutzer Roboter-Spezialist
    Registriert seit
    26.01.2008
    Ort
    Allgäu
    Alter
    37
    Beiträge
    220
    so, nach ein wenig rumprobieren funktioniert die erweiterung nun.

    allerdings funktioniert es nur, wenn man ir_hindernis in der header datei mit uint8_t ir_hindernis und in der .c datei mit extern uint8_t ir_hindernis deklariert.
    wenn ich die variable, beide male mit extern deklariere bringt der compiler eine fehlermeldung.

    danke auf jeden fall für eure hilfe

Seite 3 von 7 ErsteErste 12345 ... LetzteLetzte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

fchao-Sinus-Wechselrichter AliExpress