Hallo
Man kann zusätzlich noch die Stromstärke mit der die beiden IR LEDs gepulst werden in drei Stufen einstellen
Es wird hierbei der Vorwiderstand für die ACS-LEDs verändert. Entweder nur R9 (2k2) für Low, R8 (1k5) für Med oder beide zusammen für High:
Code:
/**
* 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;
}
/*****************************************************************************/
//
(Aus der Datei RP6RobotBaseLib.c)
Die Trägerfrequenz, und damit auch die ACS-Impulse, werden in der Timer2-ISR erzeugt:
Code:
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;
}
(Aus der Datei RP6RobotBaseLib.c)
Damit das ACS nicht zu empfindlich bzw. auf eventuelle Störungen reagiert, wartet die Software bis eine bestimmte Anzahl von Impulsen in einer bestimmten Zeit empfangen worden ist
In der Datei RP6Config.h kann man dann noch ein paar zusätzliche Einstellungen vornehmen:
Code:
/*****************************************************************************/
// ACS Config:
// You can only uncomment ONE of these two defines at a time.
// use ACS_CONFIG_CUSTOM for your own ACS settings!
#define ACS_CONFIG_DEFAULT
//#define ACS_CONFIG_CUSTOM
// General hints:
// Only values > 0 will work for ALL values!
// Settings with very different values from those that are in here
// by default will maybe not work! You have to do some experiments...
#ifdef ACS_CONFIG_DEFAULT // ACS General update interval:
#define ACS_UPDATE_INTERVAL 2 // ms
// ACS Wait for IRCOMM transmissions time:
#define ACS_IRCOMM_WAIT_TIME 16 // ACS_IRCOMM_WAIT_TIME * ACS_UPDATE_INTERVAL ms
// ------------------
// ACS Left Channel:
#define ACS_SEND_PULSES_LEFT 36 // Number of pulses to send must be much higher than...
#define ACS_REC_PULSES_LEFT 5 // ... number of pulses that must be received!
#define ACS_REC_PULSES_LEFT_THRESHOLD 3
// Once an object has been detected, it is
// required to get lower than this threshold value
// to turn of the "obstacle_left" flag.
// If you set this equal to ACS_REC_PULSES_LEFT
// it will have no influence on the behaviour.
#define ACS_TIMEOUT_LEFT 16 // ACS_TIMEOUT_LEFT * ACS_UPDATE_INTERVAL ms
// ------------------
// ACS Right Channel:
#define ACS_SEND_PULSES_RIGHT 36 // Number of pulses to send must be much higher than...
#define ACS_REC_PULSES_RIGHT 5 // ... number of pulses that must be received!
#define ACS_REC_PULSES_RIGHT_THRESHOLD 3
// Once an object has been detected, it is
// required to get lower than this threshold value
// to turn of the "obstacle_right" flag.
// If you set this equal to ACS_REC_PULSES_RIGHT
// it will have no influence on the behaviour.
#define ACS_TIMEOUT_RIGHT 16 // ACS_TIMEOUT_RIGHT * ACS_UPDATE_INTERVAL ms
#endif
// Use this for your own ACS settings!
#ifdef ACS_CONFIG_CUSTOM
// ACS General update interval:
#define ACS_UPDATE_INTERVAL 2 // ms
// ACS Wait for IRCOMM transmissions time:
#define ACS_IRCOMM_WAIT_TIME 20 // ACS_IRCOMM_WAIT_TIME * ACS_UPDATE_INTERVAL ms
// ------------------
// ACS Left Channel:
#define ACS_SEND_PULSES_LEFT 36 // Number of pulses to send must be much higher than...
#define ACS_REC_PULSES_LEFT 5 // ... number of pulses that must be received!
#define ACS_REC_PULSES_LEFT_THRESHOLD 1
// Once an object has been detected, it is
// required to get lower than this threshold value
// to turn of the "obstacle_left" flag.
// If you set this equal to ACS_REC_PULSES_LEFT
// it will have no influence on the behaviour.
#define ACS_TIMEOUT_LEFT 16 // ACS_TIMEOUT_LEFT * ACS_UPDATE_INTERVAL ms
// ------------------
// ACS Right Channel:
#define ACS_SEND_PULSES_RIGHT 36 // Number of pulses to send must be much higher than...
#define ACS_REC_PULSES_RIGHT 5 // ... number of pulses that must be received!
#define ACS_REC_PULSES_RIGHT_THRESHOLD 1
// Once an object has been detected, it is
// required to get lower than this threshold value
// to turn of the "obstacle_right" flag.
// If you set this equal to ACS_REC_PULSES_RIGHT
// it will have no influence on the behaviour.
#define ACS_TIMEOUT_RIGHT 16 // ACS_TIMEOUT_RIGHT * ACS_UPDATE_INTERVAL ms
#endif
https://www.roboternetz.de/phpBB2/ze...=304868#304868
https://www.roboternetz.de/phpBB2/ze...ag.php?t=50529
Gruß
mic
[Edit]
Eine vierte Stufe der Vorwiderstände könnte man vielleicht so erreichen:
Code:
void setACSPwrLow2(void) // Beide Pins Eingang mit PullUp
{
DDRD &= ~ACS_PWR;
PORTD |= ACS_PWR;
DDRB &= ~ACS_PWRH;
PORTB |= ACS_PWRH;
}
Beide Pins werden auf Eingang mit aktivem PullUp geschaltet. Ob das zu erwartende extrem geringe Strömchen überhaupt etwas bewirkt habe ich allerdings nicht getestet. Die PullUps sind mit 20-50k vielleicht etwas zu hochohmig. (Datenblatt S. 296 ganz unten)
Lesezeichen