Hallo
Ein Blick in den Schaltplan (Seite 2) der Base offenbart es:
![]()
Die ACS-LEDs können getrennt angesteuert werden:
(Aus RP6RobotBaseLib.c)Code:/** * Disables the ACS task. * ACS and IRCOMM Transmissions/Receptions will not work anymore. */ void disableACS(void) { acs_state = ACS_STATE_IDLE; TIMSK &= ~(1 << OCIE2); IRCOMM_OFF(); PORTB |= ACS_L; PORTC |= ACS_R; obstacle_right = false; obstacle_left = false; } /** * Enables the ACS task. */ void enableACS(void) { TIMSK &= ~(1 << OCIE2); IRCOMM_OFF(); PORTB |= ACS_L; PORTC |= ACS_R; obstacle_right = false; obstacle_left = false; acs_state = ACS_STATE_IRCOMM_DELAY; } /** * Turn ACS Power off. * * Example: * * setACSPwrOff(); * */ void setACSPwrOff(void) { DDRD &= ~ACS_PWR; PORTD &= ~ACS_PWR; DDRB &= ~ACS_PWRH; PORTB &= ~ACS_PWRH; PORTB &= ~ACS_L; PORTC &= ~ACS_R; } /** * Set ACS Power low. * * Example: * * setACSPwrLow(); * */ void setACSPwrLow(void) { DDRD |= ACS_PWR; PORTD |= ACS_PWR; DDRB &= ~ACS_PWRH; PORTB &= ~ACS_PWRH; } /** * Set ACS Power medium. * * Example: * * setACSPwrMed(); * */ void setACSPwrMed(void) { DDRD &= ~ACS_PWR; PORTD &= ~ACS_PWR; DDRB |= ACS_PWRH; PORTB |= ACS_PWRH; } /** * Set ACS Power high. * * Example: * * setACSPwrHigh(); * */ void setACSPwrHigh(void) { DDRD |= ACS_PWR; PORTD |= ACS_PWR; DDRB |= ACS_PWRH; PORTB |= ACS_PWRH; }
Mit ACS_PWR und ACS_PWRH kann man R8 und R9 in unterschiedlichen Kombinationen ansteuern und so den Strom durch die ACS-LEDs und die Leuchtstärke beeinflußen.
Gruß
mic
[Edit]
Ach ja, ganz vergessen, die Kathoden liegen an ACS_L/ACS_R. Die Leds leuchten, wenn sie auf low liegen und über R8/9 ein high ausgegeben wird:
![]()
[Noch ein Edit]
Bei der Suche nach dem Urheber der 36kHz-Trägerfrequenz für das ACS habe ich die getrennte Ansteuerung der ACS-LEDs gefunden:
(Ebenfalls aus RP6RobotBaseLib.c)Code:// ------------------------------- /** * Timer 2 Compare ISR * ACS & IRCOMM * * WARNING: DO NOT CHANGE THIS! * NEVER try to control the IRCOMM by your own routines if you do not * know what you are doing! * */ ISR (TIMER2_COMP_vect) { static uint8_t ircomm_pulse; if(acs_state < 2) { // If ACS is not active, perform IRCOMM transmissions if(ircomm_pulse) { // Do we have IR pulses to send? if(ircomm_pulse < 60) { // Bi-Phase encoding... if(ircomm_data & 0x4000) // check current bit PORTD ^= (1<<PIND7); // Toggle IRCOMM port else PORTD &= ~(1<<PIND7); // deactivate IRCOMM port } else if(ircomm_data & 0x4000) // The same as above, but the other way round: PORTD &= ~(1<<PIND7); // deactivate IRCOMM port else PORTD ^= (1<<PIND7); // Toggle IRCOMM port ircomm_pulse--; } else if(ircomm_send) { // Do we still have data? PORTD &= ~(1<<PIND7); ircomm_data <<= 1; // Next Bit! ircomm_pulse = 120; ircomm_send--; } else PORTD &= ~(1<<PIND7); // no more pulses - IR LEDs off! } else if(acs_pulse) { // Send ACS IR pulses? if(sysStatACS.channel == ACS_CHANNEL_LEFT) // which channel? PORTB ^= ACS_L; else PORTC ^= ACS_R; acs_pulse--; } else { // no more pulses - IR LEDs off! PORTB |= ACS_L; PORTC |= ACS_R; } }







Zitieren
Lesezeichen