mal ein motortest gemacht mit Bascom und rp6.
auch die print-daten werden im terminal vom rp6loader empfangen.
habe in der m32def.dat die neuen namen beigefügt ("neu") wie sie auch in winavr-c sind bzw bei atmel neu sind :

;TCCR1A
COM1A1 =7
COM1A0 =6
COM1B1 =5
COM1B0 =4
FOC1A =3
FOC1B =2
PWM11 =1
WGM11 =1 ; neu
PWM10 =0
WGM10 =0 ; neu

;TCCR1B
ICNC1 =7
ICES1 =6
CTC11 =4
WGM13 =4 ; neu
CTC10 =3
WGM12 =3 ; neu
CS12 =2
CS11 =1
CS10 =0
so sehen die pwm-werte in winavr-c aus :

// Initialize Timer1 - PWM:
// PWM, phase correct with ICR1 as top value.
TCCR1A = (0 << WGM10) | (1 << WGM11) | (1 << COM1A1) | (1 << COM1B1);
TCCR1B = (1 << WGM13) | (0 << WGM12) | (1 << CS10);
ICR1 = 210; // Phase corret PWM top value - 210 results in
// about 19 kHz PWM.
// ICR1 is the maximum (=100% duty cycle) PWM value!
// This means that the PWM resolution is a bit lower, but
// if the frequency is lower than 19 kHz you may hear very
// annoying high pitch noises from the motors!
// 19 kHz is a bit over the maximum frequency most people can
// hear!

hier das kleine bascomprogramm mit encoder rechts und links :

Code:
$regfile = "M32def.dat"
$crystal = 8000000
$hwstack = 32
$swstack = 32
$framesize = 64
$baud = 38400

Dim Tccr1a_set As Byte
Dim Tccr1b_set As Byte
Dim Wert As Byte
Dim Zaehler As Word
Dim Zaehler1 As Word

Config Pinc.2 = Output
Config Pinc.3 = Output
Config Pinb.4 = Output

On Int0 Int0_int
On Int1 Int1_int

Enable Interrupts

Config Int0 = Falling
Config Int1 = Falling

Enable Int0
Enable Int1

Tccr1a_set = 0
Tccr1b_set = 0

Reset Tccr1a_set .wgm10
Set Tccr1a_set .wgm11
Set Tccr1a_set .com1a1
Set Tccr1a_set .com1b1
Tccr1a = Tccr1a Or Tccr1a_set

Reset Tccr1b_set .wgm12
Set Tccr1b_set .wgm13
Set Tccr1b_set .cs10
Tccr1b = Tccr1b Or Tccr1b_set

Icr1h = 0
Icr1l = 210

Set Portb.4

Reset Portc.2
Reset Portc.3

Wait 1

For Wert = 0 To 150
   Waitms 50
   Pwm1a = Wert - 3 ' für meinen geradeauslauf
   Pwm1b = Wert
Next

Wait 4

Pwm1a = 0 ' wenn rückwärts gefahren werden soll, muss man langsam die pwm... auf "0" runterfahren und nicht sofort auf "0" und gleich rückwärts
Pwm1b = 0

Reset Portb.4

Print "links  " + Str(zaehler) + Chr(13)
Print "rechts  " + Str(zaehler1) + Chr(13)

End

Int0_int:
   Disable Int0
   Zaehler = Zaehler + 1
   Enable Int0
Return

Int1_int:
   Disable Int1
   Zaehler1 = Zaehler1 + 1
   Enable Int1
Return