Hi!

Auf die Gefahr hin, dass dies hier ein halbes Doppelposting wird:
Ich schaffs nicht, die Kombination RNMega128Funk und RN-VN2Dual mit PWM zu steuern.

(Zwischenfrage: Wie poste ich denn Source, damit er in so einem kleinen Scrollwindows angezeigt wird?)

Die Hardware funktioniert, wenn ich folgendes mache klappt alles.
_____________
Code:
Config Pine.3 = Output
Motor1_pwm Alias Porte.3
Config Pind.5 = Output
Motor1_in1 Alias Portd.5
Config Pind.4 = Output
Motor1_in2 Alias Portd.4
Config Pine.4 = Output
Motor2_pwm Alias Porte.4
Config Pind.6 = Output
Motor2_in1 Alias Portd.6
Config Pind.7 = Output
Motor2_in2 Alias Portd.7

Motor1_in1 = 1 'Drehrichtung Motor 1
Motor1_in2 = 0 'Drehrichtung Motor 1
Motor2_in1 = 0 'Drehrichtung Motor 2
Motor2_in2 = 1 'Drehrichtung Motor 2

Motor1_pwm = 1
Motor2_pwm = 1
Wenn ich aber den anpassten Source aus dem VN2 Dual Demo benutze klappts nicht. Hat jemand einen Tip für mich? Irgendeine Idee?

Code:
$regfile = "m128def.dat" ' Bei Mega 128 "
$framesize = 32
$swstack = 32
$hwstack = 32

$crystal = 16000000 'Quarzfrequenz
$baud = 19200 'Baudrate für Funkmodul
$baud1 = 9600 'Baudrate für MAX


Sound Portg.2 , 400 , 450 'BEEP bei RN-Mega128Funk
Sound Portg.2 , 400 , 250 'BEEP bei RN-Mega128Funk
Sound Portg.2 , 400 , 450 'BEEP bei RN-Mega128Funk

' ---------------------------------------------------
Config Pine.3 = Output
Motor1_pwm Alias Porte.3

Config Pind.5 = Output
Motor1_in1 Alias Portd.5

Config Pind.4 = Output
Motor1_in2 Alias Portd.4

Config Pine.4 = Output
Motor2_pwm Alias Porte.4

Config Pind.6 = Output
Motor2_in1 Alias Portd.6

Config Pind.7 = Output
Motor2_in2 Alias Portd.7

'PWM Frequenz Initialisieren

Tccr1a = &B10100010 '9 Bit PWM Voller Takt
Tccr1b = &B10000010 'Teiler = 8 PWM = 1951 Hz bei 9 Bit

Dim I As Word
Wait 1
Print "RESET RN-MINICONTROL"
Print "robotikhardware.de" "
Do

Print " Richtung1"
Motor1_in1 = 0 'Drehrichtung Motor 1
Motor1_in2 = 1 'Drehrichtung Motor 1
Motor2_in1 = 1 'Drehrichtung Motor 2
Motor2_in2 = 0 'Drehrichtung Motor 2

For I = 0 To 511
Pwm1a = I
Pwm1b = I
Waitms 25
Next I
Wait 120

'Bremsen
Pwm1a = 0
Pwm1b = 0
Wait 2

Motor1_in1 = 0 'Drehrichtung Motor 1
Motor1_in2 = 0 'Drehrichtung Motor 1
Motor2_in1 = 0 'Drehrichtung Motor 2
Motor2_in2 = 0

Print " Richtung2"
Motor1_in1 = 1 'Drehrichtung Motor 1
Motor1_in2 = 0 'Drehrichtung Motor 1
Motor2_in1 = 0 'Drehrichtung Motor 2
Motor2_in2 = 1 'Drehrichtung Motor 2
For I = 0 To 511
Pwm1a = I
Pwm1b = I
Waitms 25
Next I
Wait 120
'Bremsen
Pwm1a = 0
Pwm1b = 0
Wait 2
Motor1_in1 = 0 'Drehrichtung Motor 1
Motor1_in2 = 0 'Drehrichtung Motor 1
Motor2_in1 = 0 'Drehrichtung Motor 2
Motor2_in2 = 0
Loop