Code:
Stecker IO_PWM/T2/T3
_______
Vdd <-|10 9| -> Servo8
Servo7 <-| 8 7| -> Servo6
Servo5 <-| 6 5| -> Servo4
Servo3 <-| 4 3| -> Servo2
Ground <-| 2 1| -> Servo1
-------
********* in der Lib **********
* Servo connections at IO_PWM/T2/T3:
* SERVO1 -> Pin 1 (IO_PE7_ICP3_I7) SERVO5 -> Pin 6 (IO_ADC15_PI23)
* SERVO2 -> Pin 3 (IO_PE6_T3_I6) SERVO6 -> Pin 7 (IO_PH6_OC2B)
* SERVO3 -> Pin 4 (IO_PE5_OC3C_I5) SERVO7 -> Pin 8 (IO_ADC14_PI22)
* SERVO4 -> Pin 5 (OC2A_PI4) SERVO8 -> Pin 9 (IO_PE4_OC3B_I4)
if (servos & SERVO1) {DDRE |= IO_PE7_ICP3_I7; PORTE &= ~IO_PE7_ICP3_I7;}
if (servos & SERVO2) {DDRE |= IO_PE6_T3_I6; PORTE &= ~IO_PE6_T3_I6;}
if (servos & SERVO3) {DDRE |= IO_PE5_OC3C_I5; PORTE &= ~IO_PE5_OC3C_I5;}
if (servos & SERVO4) {DDRB |= OC2A_PI4; PORTB &= ~OC2A_PI4;}
if (servos & SERVO5) {DDRK |= IO_ADC15_PI23; PORTK &= ~IO_ADC15_PI23;}
if (servos & SERVO6) {DDRH |= IO_PH6_OC2B; PORTH &= ~IO_PH6_OC2B;}
if (servos & SERVO7) {DDRK |= IO_ADC14_PI22; PORTK &= ~IO_ADC14_PI22;}
if (servos & SERVO8) {DDRE |= IO_PE4_OC3B_I4; PORTE &= ~IO_PE4_OC3B_I4;}
// -----------------------------------------------------------
// Other possible ports for connecting Servos to RP6 M256:
// At IO_PWM/T0/T1: PD4, PD6, PB7, PG5, PD7, PB5, PK5, PB6
// At UART_SPI1/T5: PL1, PL2, PD5, PL3, PD3, PL5, PD2, PL4
// At UART_SPI2/T4: PL0, PH7, PH2, PH5, PH1, PH4, PH0, PH3
// -----------------------------------------------------------
********* im Header **********
// Servo ports (at IO_PWM/T2/T3):
#define SERVO1_PULSE_ON (PORTE |= IO_PE7_ICP3_I7) // PE7
#define SERVO1_PULSE_OFF (PORTE &= ~IO_PE7_ICP3_I7)
#define SERVO2_PULSE_ON (PORTE |= IO_PE6_T3_I6) // PE6
#define SERVO2_PULSE_OFF (PORTE &= ~IO_PE6_T3_I6)
#define SERVO3_PULSE_ON (PORTE |= IO_PE5_OC3C_I5) // PE5
#define SERVO3_PULSE_OFF (PORTE &= ~IO_PE5_OC3C_I5)
#define SERVO4_PULSE_ON (PORTB |= OC2A_PI4) // PB4
#define SERVO4_PULSE_OFF (PORTB &= ~OC2A_PI4)
#define SERVO5_PULSE_ON (PORTK |= IO_ADC15_PI23) // PK7
#define SERVO5_PULSE_OFF (PORTK &= ~IO_ADC15_PI23)
#define SERVO6_PULSE_ON (PORTH |= IO_PH6_OC2B) // PH6
#define SERVO6_PULSE_OFF (PORTH &= ~IO_PH6_OC2B)
#define SERVO7_PULSE_ON (PORTK |= IO_ADC14_PI22) // PK6
#define SERVO7_PULSE_OFF (PORTK &= ~IO_ADC14_PI22)
#define SERVO8_PULSE_ON (PORTE |= IO_PE4_OC3B_I4) // PE4
#define SERVO8_PULSE_OFF (PORTE &= ~IO_PE4_OC3B_I4)
// -----------------------------------------------------------
// Other possible ports for connecting Servos to RP6 M256:
// At IO_PWM/T0/T1: PD4, PD6, PB7, PG5, PD7, PB5, PK5, PB6
// At UART_SPI1/T5: PL1, PL2, PD5, PL3, PD3, PL5, PD2, PL4
// At UART_SPI2/T4: PL0, PH7, PH2, PH5, PH1, PH4, PH0, PH3
// -----------------------------------------------------------
Lesezeichen