RE: Motorola Programmiermodus von Lokpilot auslösen

#1 von Blacksky , 04.03.2010 20:35

Hallo.

Weis jemand, wie ich via DDW oder von mir aus auch Märklin Interface aus Softwae herreus den Programmiermodus für das 6021 auslösen kann?

Bei Hand mache ich es mit 6021 so:

Reset, Strom aus, 80 eingeben, Richtungsänderungsbefehln auslösen und halten, Strom einschlaten, Richtungsänderungsbfehl aufheben.

Lok ist dann im Programmiermodus, Leuchten blinken.


Genau das möchte ich in Software machen.


Gruß,
Blacky

P.S.: Ich weis, man kann die Dekoder auch anders Programmieren, aber darum geht es mir nicht.


Ich bin zu allem fähig, aber zu nichts zu gebrauchen.


Blacksky  
Blacksky
InterRegio (IR)
Beiträge: 156
Registriert am: 13.12.2008


RE: Motorola Programmiermodus von Lokpilot auslösen

#2 von DiegoGarcia , 04.03.2010 20:52

Hallo Blacky,

dann lass ich mir mal ein bisschen in die Karten gucken:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
 

Function SetMfxRegValue6021(thisPort As Integer, thisRegister As Integer, thisNewValue As Integer) : Boolean
 
begin
 
// (c) DiegoGarcia and Family, Germany
// 19.04.2007
// RealBasic 2007-02 subroutine (Mac, Lin & Win)
// Purpose: write "thisNewValue" into "thisRegister"-RegV of any FX-/MFX-decoder
// through the serial port indicated by "thisPort", where a mae6021/mae6051 is connected
// Assuming: "Serial1 As Serial" defined in calling window or global "App"

const ckue = "ü" // for German message text
const ckea = "é" // for French message text
const ckag = "à"

const Vturn = 15 //mae6021 / P50 syntax = change direction; apply only on non-moving locos!
const Vstop = 0 // mae6021 / P50 syntax = speed 0, no loco moving
const DefaultMFXLocoAdr = 80 // address 80 is used to access any FX/MFX decoder, no matter what address it has
dim oldCTS As Boolean // to store existing status
dim myGoOn As Boolean

myGoOn = TRUE

if (thisPort >= 0) and (thisPort < System.SerialPortCount) then // check bounds

Serial1.SerialPort = System.SerialPort(thisPort)

Serial1.Baud = GetActualBaud // this MUST be done before Serial1.Open !!!!!!!
Serial1.Parity = GetActualParity
Serial1.Bits = GetActualDataBits
Serial1.Stop = GetActualStoppBits
Serial1.CTS = GetActualCTSflowcontrol

// try to open the serial port
if not Serial1.Open then
// we failed to open the port, quit this subroutine
MsgBox "Could not open " + System.SerialPort( thisPort ).Name
// perhaps another application is using this port or access rights are missing
myGoOn = FALSE
else

// 0) instruction to the user: reset the mae6021 manually, sorry, no command for this task
ShowProgrammingMode(TRUE)
DisplayInfoText(0)
select case App.gLanguage
case 1
myGoOn = App.MessageWithCancel("Pressez simultan" + ckea + "ment les touches GO et STOP jusqu'" + ckag + " ce que le num" + ckea + "ro '99' clignote sur l'" + ckea + "cran.")
case 2
myGoOn = App.MessageWithCancel("Bitte die Mrkl6021 zur" + ckue + "cksetzen durch gleichzeitiges Dr" + ckue + "cken der GO und STOP Tasten, bis '99' in der Anzeige aufblinkt.")
else
myGoOn = App.MessageWithCancel("Please reset the mrkl6021 by pressing GO and STOP simultaneously for several seconds until '99' blinks in the display.")
end select

if myGoOn then

// 1) sending STOP command
DisplayInfoText(1)
WriteByte(97) // Nothalt / STOP
Wait150miliseconds // sending twice, to compensate a wrong byte order of preceeding commands
WriteByte(97)
WaitSeconds(1)

// 2) disable CTS, because the 6050/6051 interface should tell CTS=FALSE after STOP command
oldCTS = Serial1.CTS
Serial1.CTS = FALSE // to enable data sending in any case

// 3) send message to turn any FX/MFX decoder into programming mode
DisplayInfoText(2)
WriteByte( Vstop ) // send speed = 0 to stop motor
Wait150miliseconds
WriteByte( DefaultMFXLocoAdr ) // addr = 80
Wait150miliseconds

WriteByte( Vturn ) // send speed = 15 to turn direction
Wait150miliseconds
WriteByte( DefaultMFXLocoAdr ) // addr = 80
Wait150miliseconds

DisplayInfoText(3)
WriteByte(96) // Freigabe / GO
WaitSeconds(1)
// now the mae6021 will fire always "turning" command to loco addr 80
// and the head-lights of the MFX-/FX-loco should blink continously on both sides

// 4) re-eanable CTS
Serial1.CTS = oldCTS

// 5) write RegV-entry address
// sequence doesn't matter, you can turn off DefaultMFXLocoAdr's turning command before adressing thisRegister
DisplayInfoText(4)
WriteByte( Vstop ) // send speed = 0 to stop mae6021 firing "turning" command
Wait150miliseconds
WriteByte( DefaultMFXLocoAdr ) // addr = 80
Wait150miliseconds

WriteByte( Vstop ) // send speed = 0 to stop motor, preparing RegV to receive data
Wait150miliseconds
WriteByte( thisRegister ) // addr = RegV address range 1..79
Wait150miliseconds

WriteByte( Vturn ) // send speed = 15 to indicate RegV to receive data
Wait150miliseconds
WriteByte( thisRegister ) // addr = RegV address range 1..79
WaitSeconds(2) // wait a little bit longer

// now the head-lights of the loco should blink in a faster scheme

// 6) write new value to this RegV
DisplayInfoText(5)
WriteByte( Vstop ) // send speed = 0 to stop mae6021 firing "turning" command
Wait150miliseconds
WriteByte( thisRegister ) // addr = RegV address range 1..79
Wait150miliseconds

WriteByte( Vturn ) // send speed = 15 to indicate the data
Wait150miliseconds
WriteByte( thisNewValue ) // addr = value range 1..80, depending on RegV's definition of the decoder
Wait150miliseconds

// now the head-lights of the loco should blink in the slower scheme

WriteByte( Vstop ) // send speed = 0 to stop mae6021 firing "turning" command
Wait150miliseconds
WriteByte( thisNewValue ) // addr = RegV address range 1..79
WaitSeconds(2) // wait a little bit longer

// 7) terminate decoder programming mode
DisplayInfoText(6)
WriteByte(97) // Nothalt / STOP

// now the loco's head-lights should be off

WaitSeconds(1)
Serial1.CTS = FALSE // to enable data sending in any case
WriteByte(96) // Freigabe / GO
Wait150miliseconds
Serial1.CTS = oldCTS

// done, now the mae6021 should be again in normal operation mode
// and the loco's decoder should have the new value "thisNewValue" entered in its RegV "thisRegister"
// sorry to say that there is now way to read RegVs using a mae6021/mae6051 combination.

end
ShowProgrammingMode(FALSE)

end
else
myGoOn = FALSE
end

Return myGoOn
 
end function

 



RealBasic 2007-02 und neuer.

Ciao
Diego


EDIT: update source code here: http://www.marklin-users.net/forum/defau...g=posts&t=17631


talks are cheap, and they don't mean much .…


 
DiegoGarcia
Metropolitan (MET)
Beiträge: 2.797
Registriert am: 15.04.2007
Steuerung mfx


RE: Motorola Programmiermodus von Lokpilot auslösen

#3 von Blacksky , 05.03.2010 00:56

Hallo Diego.

Dass ist sehr interessant, ich werde das dann ausprobieren. Ich werde es dann auch erst mit dem Interface versuchen. Wenn das dann geht, versuche ich ob es mit DDW auch klappt.


Gruß,
Blacky


Ich bin zu allem fähig, aber zu nichts zu gebrauchen.


Blacksky  
Blacksky
InterRegio (IR)
Beiträge: 156
Registriert am: 13.12.2008


RE: Motorola Programmiermodus von Lokpilot auslösen

#4 von Pudels Kern , 09.03.2010 11:06

Hallo Blacky,

halt uns dann bitte auf dem Laufenden . Obs mit DDW funktioniert würde mich auch interessieren.


Gruss
Martin


 
Pudels Kern
InterRegioExpress (IRE)
Beiträge: 318
Registriert am: 04.09.2007
Spurweite H0
Stromart DC, Digital


   


  • Ähnliche Themen
    Antworten
    Zugriffe
    Letzter Beitrag
Xobor Einfach ein eigenes Forum erstellen
Datenschutz