Вы находитесь на странице: 1из 6

I

THE DIGITAL MODEL TRAIN


PART 10 - RS232 INTERFACE
by T. Wigmore
8""1}~\

The 9-way D-connector at the edge of the mother board offers the
possibility of controlling the model railway by computer. This
opens the way for fully automatie control of locomotives, turnouts
(points), signals, protection of selected seetions of the track,
service schedules, simulated inertia of trains, combining
locomotives for heavy goods trains, the switching of additional
functions in rolling stock, and more.

The RS232 interface is compatible with the computers that have an RS232 input. Some The gates used here may be those as yet
Märklin interface as far as standard in- computers. such as the Commodore, re- unused in IC9 on the mother board.
structions are concerned: the control of quire the signals to be in ver ted and their
turnouts (points), signals and locomotives. levels to be adapted to the TTL level; a
and the calling for monitoring infortnation. suitable cable for these is shown in Fig. 63. Baud rate and data format
However; it offers many other facili- On power-up, the interface is set for
fies as well. such as requesting the host computer 2400 baud, eight da ta bits. no parity
(OTE)
state of locomotive controllers; the bit and two stop bits. Instructions
allocation of addresses to locomo- r-;' must not be followed by a carriage
tive controllers; the disablement of
"
0 0 , MDTHER BOARD return. The baud rate may be altered
0
a _ ,eeejyed d.l. (DCE)
if needed: for instance, in noisy (elec-
keyboards and locomotive con-
trollers as desired; the possibility of
down-loading users' programs, and
0
0
o 0-'~
o 0-'
o r t,anomltted dala_
l~,
o ,
'-<> 0
0
tronically speaking) conditions or
where a very long RS232 cable is
others, If manual contral is not re-
quired, a11keyboards and locomo- "f-:
0-'
0
I '" s
00-'
0
,
used, 1200 baud (instruction <111»
is a more congeniaI operating fre-
tive controllers may be omitted: all 0
0 ~ quency. For extensive tracks, a baud
0
contral instructions are then given 0
0 _ elu, 10 .end rate of 4800 (instruction <113» is rec-
via the interface. Mixed operation is 0
as 0
0
ommended. Areset, either by S3 or
also possible. ~ instruction <98> returns the operat-
Originally, the RS232 standard 87291 -1)(·11 ing Irequency to 2400 baud.
was Intended to coupie a Data Com- host computer The processing of an instruction
mu nication Equipment (DCE, also (OTE)
MOTHER BOARD
received by the EEDTS is illustrated

l 1~'t====~"~,"~~~,,~,
called modern) and a Data Terminal (OCE) in Fig. 64. Basically, there are three
Equipment (DTE), such as a com- r-;:', 'b;"- typcs 01 instruction: I-byte. z-byte,
puter, The standard is, unfortunately,
abused by many manufacturers. o
v-- 2
I; ~

'-<>::.-. ..~,~,,.~-~===i~
_ recelved dat. 0

0
00-'
and those that requlre the EEDTS to
answer by data.
The Elektor Electronics Digital ~-5 G~D ~
When al-byte or 2-byte com-
Train System is, strictly speaking, a '-.....!.., ~ mand is received, CTS is deactuated
DCE and, like the Märklin system, it _clcoa,to ...nd
for the short time the EEDTS requires
uses three signal paths: 81291 ·1)( 12 to process the instruction. As soon as
the stop bit is received, CTS becomes
TxD: transmitted data - for data Fig. 62. Connexions of a standard RS232 cable using either a 25· active again.
transport from the host computer to way or a g-way D connector at the DTE (computer) end. When an instruction is received
the EEDTS; that reguires a response from the
RxD: received data - for data trans- EEDTS, CTS is deactuated, and be-
port from the EEDTS to the host comes active again only after the
computer; Commodo,e
,e' EEDTS has sent one or more data
CTS: c1ear to send - for advtsing
the host computer that the EEDTS is ..
User 110conneclor

, ,, , ,",OTHER BOARD
bytes to the DTE to indicate that the
next instruction may be transmitred.
ready for the next instruction. This is half-duplex operation: full
duplex working, that is, the simulta-
Apart from these, an earth Une is neous sending and receiving of data,
also required. so that the actual con- is not possible.
nexion cable must have at least fOUT _clO." ... .., The response time 01 the EEDTS
cores. A screen is not necessary. Rec- Nt. ..N3 ","I. ICt = MCI489; S~75189 depends on the type of instruction
ommended is four- or five-core flex- !7Z~"1X _13 and, in the case of calling for moni-
ible telephone cable. The length 01 toring information, on the numer of
the cable is of no consequence. monitors used. The delay lies be-
The cables shown in Fig. 62 will Fig. 63. When the EEDTS is to be connected to a Commodore, tween 2 ms (one monitor) and 80 ms
connect the EEDTS to most current the signals must be inverted. (62 monitors). This will be reverted

ELEKTOR ELECTRONICS JANUARY 1990


. ..~
THE DIGITAL MODEL TRAIN - PART 10: RS232 INTERFACE

to Iater .
I
1 8 data bIts
10 I ;00:01102[03104105106:011 EEDTSvs Märklin
CTS---------------"
r----- All commands defined by Märklin have
u 87291·JX·\4
the same result in the EEDTS. Yet, there are
several differences.

• In the stop mode, the Märklin system


CTS---------,ur------~ can receive only one instruction,
87291·,X·15
whereas the EEDTS RS232 interface re-
mains normally active. Monitor data
can thus still be written. Switching in-
structions for turnouts (points) and sig-
nals may still be given but, since there
is no voltage on the rails. they are re-
tained in a buffer (up to 128 com-
Fig. 64. The protocol for a t-byte instruction (a); a 2-byte instruction (b); and a command that is mands). When the buffer is full, CTS
followed by two answer-bytes (c). becomes inactive. As 500n as the 'go'
command is given, a11 switching in-
struchons are executed in proper order.

• An energizing instruction for turnouts


(points) or signals «33> / <34» rnust be
followed in the Märklin system by a
called on Interrupt baBls
reset instruction «32». This is neces-
sary to prevent the burning out of
solenoids. In EEDTS, the reset instr'uc-
tion is genera ted automatically after a
preset 'time out'.

• The numbering of turnouts (points) is


slightly different between the two sys-
tems (see Table 7 in Part 9).Those that
may be controlled via the RS232 inter-
face are nwnbered 0-255.

• The monitor decoders in the Märklin


system have 16 Inputs. whereas those
in the EEDTS have only eight. When
the state of one monitor is requested, a
program intended for the Märklin sys-
tem expeets a z-byte reply. In the
EEDTS a single byte would suffice, but
there is then the likelihood that the pro-
gram will wait (in vain) for the second
byte. Therefore, the EEDTS provides
Märklin simulation, in which it trans-
mits the data of two units, i.e.. two
bytes, even if that of only one is called
for. In other words, the monitor units
are numbered in sets of two. If required,
instruction <107> resets the system to
the 'byte reply mode' I in which the
monitors are treated as single units
again. After areset or command <106>,
the system is again in the 'ward reply
mode'.

System-status word and reset


The system status ward, available with
command <110>, eontains information on
the most relevant system data. After areset
or power-up, the system status ward is
OOH,which means that:
87291 -IX· 19

• the loe controllers and keyboards will


be active as soon as the 'go' signal is given;
• there are no aetive switehing instruct-
ions (system is in stop mode):
Fig. 65. Simplified !low diagram of the main loop in the system control program with indications • the switching-instruction buffer 1S
where optional system programs may be called ((addressed). empty;

ELEKTOR ELECTRONICS JANUARY 1990


I GENERAL INTEREST

Instruction set turnouts (pcints) is requested


that have not yet been energized,
Locomotive control*

The instruction set 1S given in


Table 8; all Märklin supported
the reply by defirrition is
(straight on). Only after turnouts
° 0--14

15
Iloc address]

lloc eddressl
loc control instruction; additional
function not active
loc reverse inetruction: additional
instructione are marked with an and signals have been energized function not active (only for Märklin
asterisk. All commands smaller at least once can their actual po- decodera)
16-30 lloc addresel loc control instruction; additional
than <80>, except <32>, are 2· sition be ascertained.
function active for Märklin decoders:
byte instructions. The second reverse travel with EEDTS decoders
byte of these consists of a loc ad- Programming loc controllers 31 [loc eddressl switch-over instruction; additional
dress, a turnout (points) number Each locomotive controller may function aetive (cnly with MärkJin
and occasionally a time (the be given an address with in- decoderel
number indicated times 10 ms). structions <48>-<63>, but only TI
Instruction <32>. defined by the eight DIL switches at the rel- Control of turnouts; calling for stete of turnouts/monitors
32 reset last tumout (points) (I-byte command)*
Märklin as the turnout reset evant loc controller are off
33 tno.ofturnoutJ set turnout for straight on*
command, consists of only one An address allocated to a loc 34 [no. öf turnout] set tumout for tum-off"
byte and is active at the turnout controller via the RS232 inter- 35 tno.ofturnoutl request etatue ofsingle tumout;
number for which the latest face will be erased if another reply: 1 byte (0 or 255)
switching command was given. address is set with the DIL 36 no. of contact) request status ofsingle monitcr;
This command 18 not used with switches. reply: 1 byte (0 or 255)
the EEDTS. 37 [loc addreeel loc enable command for one loc
38 [time] set turnout delay (default = 250 me)
Requesting loc controllers
39 [time] set error time (default = 1 second)
Locomotive control The reply consists of a loc data unallocated 2-byte commanda (not defined)
40-47 [..l
Ta actuate the additional fune- byte and a loc address byte - see
tion in Märklin loc decoders, the Fig. 66. The returned loc data Programming of loe controller
loc control instruction must be contain information on speed, di- 48--63 Iaddresel loc controller addresa instructiona
increased by 16. With EEDTS loc rection, whether an additional (no of controlJer = instruction - 46)
decoders the direction of travel is function is active or not, and the
Future loc deooder switehing instr-uctions
then reversed. The change-over type of data format. Bit 4 is 1 if
64--79 Iaddreeel lcc decoder switching instructions reserved by
instruction «15> or, with actu- the function is active (Märklin Märklin; four functions per decoder (not yet
ated additional function, <31» data format) or if the loc is mov- defined)
results in the EEDTS in the loc ing backwards (EEDTS data for-
crawling backwards or forwards. mat). Loc controller request instructions
If a loc that is al ready con- If the controller is set for the 80-95 request status ofloe contröllers
trolled by a loc controller is also Märklin data format, bit 5 will (80 = controller 1)
reply » 2 bytes [loc datallloc addresel
addressed via the RS232 inter- give information on the direction
face, the controller is deactuated, of travel (it is set if the controller System control instructions
since RS232 instructions have is positioned for backward 96 go"
priority over others. Only after a travel). 97 stop (default at pcwer-up)"
loc enable instruction «37» or a Bit 6 is set when the con- 98 reset
system reset 1S the controller re- troller is set for EEDTS data for- 99 stop alllocs (no stop or reset)
mat (loc data increased by 64). If IOD enable keyboards (default)
actuated.
101 disable keyboards
a controller 1S not in use, the re-
102 enable loc controllers (default}
TurnoutJsignal control turned loc data 18 255. 103 disable loc controllers
Reset instruction <32> is not If the requested controller 104 write monitor status; normal mode (default)
necessary. Cornmand <33>, status is to be used for loc control lOS write monitor status; differential mode
turnout straight on (signal information, bits 5 and 6 must be 106 set monitcr units to word-reply mode
green), means that the LED on masked before the loc data is re- (Märklin emulation; default at power-up)
turned to the EEDTS. 107 set monitor units to byte-reply mode
the associated keyboard goes out.
108 request number of monitor units
Instruction <34>, turnout turn- The second reply byte is the
109 request number oflocs in use
off (signal red) causes the LED to loc address, 0-80. Bit 7 of this 110 request aystem status (I-byte reply)
light. address gives information on its 111 set baud rate to 1200
When the status of one turn- origin. For instance, if bit 7 is set 112 baud rate 2400 (defau.Jt)
out is requested, the reply 1S one (Ioc address increased by 128), 113 sei baud rate to 4800
byte. This byte ie false (0) if the the address was set via the 114--117 unallocated instructions
turn out is set for straight on and RS232 interface.
Down-load eommands
true (255) if it 1S set for tum-off 118 set down-load mode for files in binary Format
The standard turn out ener- System control 119 set down-load mode for files in Intellee format
gizing delay after areset or The differences between emer- 120--127 calls to user programs (error ifno code is present at
power-up is 250 ms. This delay gency stop <97>, reset <98> and relevant RAM location)
may be altered to between 10 ms stop all locs <99> are:
and 2.55 s by instruction <38>. • the emergency stop removes Request instructions for status of a number of monitor units*
the voltage from the rails and 128 da not reset monitora after writing
The time is determined by the
129-159 request state of a number of monitors (1-31)
second byte (t = n x 10 ms). will th us immobifize the entire
The position of turnouts and track; if fairly soon afterwards Request instructions for stete of several groups of 8 turnouts/signa1s
signals may be requested in the 'go' command is given, aIllocs 160--191 request status ofturnouts/signals in several groups of8
groups of eight (commands will continue at their previous
160-190 for several groups and speed; Request instruetions for status of a single monitor unit*
224--255 for a single group). Each • areset is followed by a new 192 reset monitor unita after writing
system-iniuial ization; again, the 193-223 request status of single monitor (no. = command - 192)
group of eight gets al-byte reply,
Each bit in this represents a track will be at standstil1; all set- Request instruction for status of turnouts/signals, single group of 8
turnout or aignal. For instance, tings made via the RS232 inter- 224-255 request status of any group of 8 turnouts or aignals
on command <161> Crequesting face will be erased; in contrast to
first two groups), bit 0 of the first the situation after power-up, the Definition of parameters:
reply byte represents the state of actual turn out and signal states [loc eddressl =0-80
turn-out 0, bit 7 that of turn out are retained. [no. of turnout] =0-255
when a11 locs are haI ted, the [no. of monitcr] = 0-255
7, bit 0 of the second reply byte
(time] = 0--255 x 10 ms (0-2.55 s)
the state of turn out 8 and bit 7 of voltage is not removed from the
the second reply byte that of rails, although a11 moving locs
turnout 15. If the position of are stopped; any locs that are Table 8. Definitions of RS232 instructions.

ELEKTOR ELECTRONICS JANUARY 1990


locomotive dala locomoUve address
THE DIGITAL MODEL TRAIN - PART 10: RS232 INTERFACE

a different language, consult the


associated handbooks.
"ASC(LEFT$(A$,l))
440 PRINT "unit"
I
The programming examples (UNITNR-1)*2 +2"
~
, ! are fairly basic and they should
therefore be treated as direction
"ASC(RIGHT$(A$.l))
address (1l.....80)

[
indicators only, In this example it is assumed
"0- set at mo!her boiItd
Before each command, the
"I" prOU.-med 'Iia RS232
that tbe system ia in the ward-
"CI"
-0000" standstil
CTS line should be tested to see reply mode; the monitor units are
0001 (I)}
whether the system is ready to writteo as pairs. Tbe digit '2' in
l ! apeod
reeeive eommands. This check is,
however, often carried out by the
line 420 shows that a reply of 2
, '\0 (;4) bytes is expected. These reply
.,!.111 (t5)dlanll" 01 dnctlon {Märtlin) system and also, for instance, by bytes are separated in lines 430
the GWBASIC interpreter. If in- und 440. In the byte-reply mode,
structions are attempted to be line 420 becomes:
sent while the CTS liue is inac-
L -+ directlon (Mlirtlindala formal) tive, the BASIC interpreter will 420 A$=INPUT$(l.#l)
give an IfO time out error, Gener-
ally, however, the proeessing of and line 440 is omitted.
the commands is so rapid .that no
controlIef not in .... : Iocunollve dala " 255
S7Z91·1X·17
problems should be encountered. REQUESTING STATUS OF A SINGLE
MONlTOR
INITIALIZING THE RS232 INPUT
Fig. 67. Definition of the returned data when a loc controller is requested. 500 INPUT "call monitor unit
10 REM closes all open files (0-255)" CONTACT
20 CLOSE 510 PRINT #1,CHR$(36)
~ monltotifl!lslgnals
30 REM open COM1(RS232) 520 PRINT #1.CHR$
2400 Baud, no parity, 8 data (CONTACT)
bits 530 A$=INPUT$(I,#I)
40 REM 2 stop bits as file 1 540 CONTACT STATE=ASC(A$)
50 OPEN "COM1:2400,N.8,2" 550 IF CONTACT STATE=O,
AS#l B$="not active" OTHERWlSE
B$="(was) active"
LOCOMOTIVE CONTRÜL COMMAND 560 PRINT "monitor"; CONTACT
"is"; B$
100 INPUT "give loc control com- -----
mand (O-31l"COMMAND REQUESTING STATUS OF TURNOUTS
110 INPUT "give loc address
(~80)" ADDRESS The state of turnouts 1S re-
120 PRINT #l,CHR$ quested in the same way as that
(COMMAND) of monitors with the exeeption
130 PRINT #l.CHR$ that only al-byte reply follows a
(ADDRESS) group of eight turn outs.

L-----:::=:~~I"n Note that the PRINT instruct- ALLOCATING ALoe ADDRESS TO A


ions in lines 120 and 130 must be toc CONTROLLER
closed by ":" to indicate that no
earriage return must follow, 600 INPUT "address setting in-
struction for loe controller
L "O" word ,eply mode (Mä'klin)
TURNOUTS CONTROL COM11AND (1-16)",REGNR
"1" byte reply mode 610 INPUT "required loc address
"0" slop
200 INPUT "give DO. of turnout (~80)".ADDRESS
87291·rX·ll1
"I" 90 (0-255)" TURNOUTS 620 PRINT
210 INPUT "position (0 = #1,CHR$(REGNR + 47)
Fig. 68. Construclion of system-status word: at power-up, it is OOH. straight on; 1 = turn off", 630 PRINT #l,CHR$(ADDRESS)
POSITION
230 IF POSITION = 0 PRINT REQUESTING STATUS OF LOC
under the command of a con- again by <192>. #1.CHR$(33); OTHERWISE CONTROLLER
troller will resurne their previous Normally, a monitor contact is PRINT#1,CHR$(34)
speed; thia may be prevented by written as a 1 if it is active. It is, 240 PRINT #l,CHR$ 700 INPUT "request instruction
preceding the stop all locs corn- however, possible with <105> to (TURNOUT) for loc controller (I~16)",
mand by the loc controller dis- switch over to the differential REGNR
able instruction, <103>. mode, in which the contact te read SE'ITlNG TURNOUTS DELAY 710 PRINT
Disabling controllers and key- as 1 only if it has altered. This (default = 0.25 sj 720 PRINT
boards rnay be useful in fully au- makes it easy to see where some- #l,CHR$(REGNR+ 79)
tomatic operation. When the key- thing has happened. 300 INPUT "new turnouts delay 730 A$=INPUT$(2.#I)
boards are disabled, the yellow The number of monitor units in (0-255* 10 ms)" TIME 740PRINT "locdatae"
LED on the mother board lights. use may be requested with in- 310 PRINT #1,CHR$(38) ASC(LEFT$(AS.l))
struction <108>. 320 PRINT #l,CHR$(TIMEj 750 PRINT "loc addreese"
Monitor signals ASC(RIGHT$(A$,I))
Instructions <106> and <107> Examples of programming REQUESTlNG STATE OF MONITORS
enable the requesting of data Since the program occupies some (193-223) In the last example, the reply
from a single unit or from two 200 Kbyte, it ean not be given also consists of two bytes (line
units respectively. After power-up here. To help you on your way, 400 INPUT "required unit/group 730) which are separated in lines
or areset, the EEDTS is in the however, some examples are givei number (1-31)" UNITNR 740 and 750 into the address for
word-reply mode. on how to actuate the basic fune- 410 PRINT #1,CHR$ which the controller 1S set end
Monitor contacts are reset im- tions of the EEDTS from GWBA- (UNITNR + 192) the associated controller st.atus
mediately they are written, un- SIe (as supplied with every pe). 420 A$=INPUT$(2,#1) (Ioc data).
less the reset is disabled by If you use another variant of 430 PRINT "unit"
<128>. The reset may be enabled BASIC, or a different machine, or (UNITNR-1)*2 +1 =

ELEKTOR ELECTRONICS JANUARY 1990


I GENERALINTEREST

, ............. , .............................................
z turnouts and signals preset routine

RAM.ddr••• eall Mise


a
, ...........................................................
." Oe called with command '120 >

s
6 082F WIS_COM, 'OU 082FH ,start address of systero routine foe
4800H system call1 ) 7 :conversion of swi tch commands
numbers, ,nO storage
4900H system call2 ) see Rg. 65 B ;and turnout
;result in buffer
of
9
4AOOH system caU3 ) i o
SOOOH ,RAM-address 5000 r.e called
4BOOH system call 0 ) 5000 0'0

instruction:
"aa
i
i
;with command < 120,

PUSH AE ;save registers


5000H user call 0 <120> 5000
"
5100H user ca! 1 <121>
"
rs 5001
5002
05 PUSH
PUSH
0'
HL
'6 '5
5200H user call2 <122> 17 5003 2' i s 50 LD HL,WIS_TBL
18 5006 NXT_COM: La E, (HL) ;copy turnout number and command
5'
5300H user ca.II3 <123> 19 5007 2' INC HL ;from t atu e to regiater 0'
20 56 LO 0, (HL)
5400H user call4 <124> zi
5008
5009 aa INC HL
5500H user c:a1l5 <125> 22 SOOA 97 SUB A ;A:~O

5800H user ca.US <126> aa 500B BA CP 0 :no switch command


SOOC 2B 07 .ra Z,IJIS_ENO ;" eno of ble
't.e
5700H usercal17 <127> "
25
26
SODE
500F
'5
CO 2F OB
PUSH
CALL
HL
IJIS_COM ;convert turnout number ,nd
27 ;turnout command
28 5012 Ei pop HL
JR NXT_COM
29
30
5013 '8
"
ai 5015 Ei IJIS_END: POP HL ,reatore registers
lable 9. RAM addresses available for down- az 5016 0' POP OE
aa
loading.
"
as
5017
5018 "
C9
POP
"T "
36 ;switching commanda table
; < turnout number, < command>
"
'B :end of table
;max, 12B oommanda
< 0 >< 0 >
0

in tab1e
• the monitor units are in normal mode ,8 ,turnout O. straight on
00 IJIS_TBL: 8YTE 0,33
and will be reset automatically after writ- "
5019
501B "
az BYTE 1.34 ;turnout L divert

ing and the ward reply mode is active; "


«a SOlD
SOlF
0'
02
os
21
22
BYTE 2,33
BYTE 5,34
;turnout 2. 2traight
;turnout s . divert
on

• the srop-status is active (no voltage on " 06 aa BYTE 6,34 ;turnout 6. ddve r-t.

the rails).
"
'6
5021
5023 OB 21 BYTE 8,33 ;turnout
,table
B. straight
0" be extended
00

"
'B
0.0
:to requirement
.c i cees table
" 5025 00 00 BYTE
On areset via S3 or instruction <98>, apart so
51 5027 'NO
from the above default settings, the follow-
ing will happen:
Lines Assembled Assembly Errors

• all loc controllers are enabled, inc1uding


those that are active at loe addresses where lntell.. -file:

previously an RS232 command was active;


• the baud rate is set at 2400 baud:
• the energizing delay for turnouts
(points) is set to 0.25 s;
• the loc addresses set via the RS232 at
the loc controllers become inactive;
• a11down-loaded user programs will be
erased.

The situation after areset is thus almost Fig. 68. Example of a programme in assembler 10 presel a number of turnouts (points) wilh lnstruc-
the same as after power-up; the only dif- lion <120>. Undernealh Ihe assoeialed down-load liIe in Inlellee formal.
ference is that the prevailing postttons of
tumouts (points) and signals are retained.

light permanently: the control program the EEDTS executes


Error LED such a call to a possible user prograrn.
The error LED will light when the EEDTS • when during the auto test an error is Two instructions are available for
receives an incompatible instruction. Ex- detected in the RAM (when IC14 should be down-loading: <118> and <119>.
amples of such commands, which are ig- replaced): lnstruction <118> sets the binary down-
nored by the system, are: • when a non-existent loc address has load rnode, in which the EEDTS expects a
been set in the diode matrix (which thus binary down-load file preceded by two 2-
• a non-existent loc address; should be undone): byte RAM addresses (high-order address
• an attempt at addressing a loc con- • when a transmission error is detected part First). These addresses determine
troller that has already been set to a differ- durtng the down-loading of a file (possi- where the first and last byte will be written
ent address; bly caused by a wrang baud rate - reset and must agree with the number of trans-
• calling for the status of a non-connected and try again). mitted data bytes because each subsequent
monitor; byte will be interpreted as anormal in-
• a non-defined instruction; struction.
Down-load mode Command <119> sets the EEDTS to a
• addressing a non-down-loaded user
program; The down-load mode enables user pro- mode in which it Is possible to down-Ioad
• the start bit on the serial channel is grams to be loaded from the host com- files in lntel"s Intellec-8 format. Most as-
shorter than expected for the set baud rate puter into the RAM of the EEDTS in Z80 semblers are able to create an output file in
(rnay also be a spurious pulse), machine language. this format. Such a (strictly speaktng
Basica11y there are programs that are ASCU) file contains apart frorn data also all
The diode will light for one secend. unless addressed by separate commands and pro- necessary address information and a
this duration has been altered via com- grams that are addressed (calIed) cyclically checksum for each block 01 256 bytes. If
mand <39>, but in three situations it will by the EEDTS. Figure 65 shows where in through this checksum a transmission

ELEKTOR ELECTRONICS JANUARY 1990


,
THE DIGITAL MODEL TRAIN - PART 10, RS232 INTERFACE
I
EVENTS
••••••••••••••••••••••••••••••••••••••••••••••••••••• T ••••••

2 :this routine allows one controller to be used for two Ioeos


a
, .••• t •••••••••••••••••••••••

5 0001 REGNR;
W" «c, ;number of Ioeo controller
,
& 0028
4800
lOl<ADRES,
RAMTRAPL:
W"
EO" 4BOOH
;addres
;s"t<trt
of eeccoc rcco
..ddres .. or this routine,
lEE Meetings
,
e ;Tuns e r r er- reading
;loco controllers
data from 3 Jan - Ernerging CCIR standards for
i o 4000 LOKBUF, EO" "QOOH ;system program place,.; data digital television transmission.
U ;f,OIll rccc controllers in this
i a ;buffeT ecc r-eee are .. 4 Jan ~ Solid-stare transmitters.
"
4100 OUTBUF,
W" "IOOH ;base address foc r occ contral
12 Jan - Optieal intersatellite links
" ;commands

,.2.
"
>6

"
"
4800

4BOO
4801
/,,802
.5"
ss
ORG

PUSH
PUSH
PUSH
RAMTRAPI

AF
OE
HL
and on-board teehniques.
15 Jan - Design and test of mixed
analogue and digital circuits.
ar 4803 16 40 LO D, >LOKBUF 16 Jan - Realistic 3·0 image synthe-
22 4805 1E 01 LD E,(REGNR'2)_1
za 4807 26 41 LD H.,OUTBUF ;load output buffer base address sis.
4809 2E 28
" LD L.LOKAORES
18 Jan - Intelligent buildings.
.,
480B
"
2.
-rr
4Boe
4800
"
77
ar
LO
LD
pop
A. (OE)
(HL1,A
;read
:capy
Ieee dac a into
to output buffer
input buffer
18 Jan - Liehtsignalsteuering in
2.
29
4SCE
"80F n
POP
HL
OE
Grossbritannien und der Bundesre-
POP AF
ao 4810 C, RET publik.
ar
32 4811 24 Jan - Calibration of antennas for
elose range measurements.
Lines. A5sembled az Assembly Errora 0 25 Jan ~ The car and its environment:
what ORlVEand PROMETHEUS have
to offer.
Fig. 69. Assembler program to be down-loaded to enable two locomolives to be controlled via one 26 Jan - Methods of eombatting
controller. multipaths.
29 Jan ~ In-hause systems engineer-
ing practice.
error is detected, the EEDTS goes into the Each switching command consists of 30 Jan ~ Microwave video distribu-
stop mode and the errar LED lights perma- two bytes: the number of the turnout or tion systems.
nently. The system must then be reset by signal followed by the switching com- 31 Jan - PC·based instrurnentation.
53, after whieh the down-Ioading may be mand: <33> for straight on and <34> for
restarted. turning off. After command <34> the row
Table 9 shows where in the RAM da ta must be closed by OOOOH. Inforrnation on these, and many other,
may be down-loaded. However, the sys- The second example (see Fig. 69) is a events may be obtained from the TEE •
tem does not verify whether the down- routine that is addressed cyclically every Savoy Plaee • LONDON WC2R OBL
loading really takes plaee at these ad- time the state of the loc controllers is wrlt- TELEPHONE 01·240 1871
dresses: in principle, writing may take ten. In this program, the data that was
plaee anywhere in the RAM, even in those written by the loe controller is copied to
parts that are used by the system. the Iocation for loe address 40 in the out- ERA Teehnology IS orgaruzing a
During down-Ioading, the main program put buffer. This means that loc controller 1 third seminar in its successful series
is interrupted and the system is in the stop will be active on the Iocomotive fOT which on Defenee Standard 59·41 (eovering
mode to prevent the addressing of a rou- controller 1 has been set as weIl as on the
tine that is to be called eyelieally before its eleetromagnetie cornpatibility). The
locomotive with address 40. These locomo-
down-loading has been eompleted. In the tives are then coupled via software and event will take plaee on 11 January at
down- load mode, the yellow LED flashes may be controlIed via one controller. This the Cavendish Conference Centre,
in a 2 Hz rhythm is, for instance, useful when a heavy goods London, Further information from
The down-Ioading is initiated by the train can not be pulled by one locomotive. ERA Teehnology • Cleev Road •
eommand eopy <file name> eom1:. After The coupled control Is undone by send- LEATHERHEAD KT22 7SA • Tele·
the down-loading has been eompleted, the ing a single byte (Cs, the 280 return com- phone (0372) 374151.
LED will stop flashing; the 'go' command mand) to the start address in the RAM of
must then be given to reaetuate the system. the present routine. It may also be done by
resetting the system.
A number of seminars on Informa-
In general, the original contents of a11
Some examples registers used in a user program should be
tion Teehnology; Telecommunica-
Two examples will be given to illustrate stored in the stack from the beginning. At tions & Data Communications; and
what has been said so far, the end of the user routine, the contents of Eleetronie Engineering has been or-
The first Is a routine (see Hg. 68) to set a these registers must, of course, be reccv- ganized for this month by Frost & Sul-
number of turnouts (points) or signals ered. livan. Details from Frost & Sullivan •
(max. 128) to a given position. Sullivan House • 4 Grosvenor Gar-
Since this routine starts at address dens- LONDON SWIW ODH·
SOOOH,it is actuated by command <120>.
Listing on floppy
Phone 01·730 3438.
In the routine, the switehing eommands In the development of user programs a
for the relevant turnouts and signals are good knowledge of the EEDTS control pro-
first copied to register set DE and then, in gram is indispensable. Unfortunately, this
program can not be given in this article, Electrama '90, the Indian Interna-
system routine WIS COM, to the switching
command buffer. The main pragram of the since, together with the HEX codes, an ex- tional Eleetrieal and Power Elec-
system will ensure that these switching tensive commentary, and cross-references, tronies Exhibition will be held in
eommands are executed in due course. By it occupies some 200 Kbyte. It is. however, Bombay from 20 to 28 January. De-
adapting the data lines at the end of the available through the Readers' Services on tails from BEAMA • 8 Leieester St. •
routine, anyone IS able to define his own a 5.25·inch, 360 Kbyte floppy under refer- LONDON WC2H 7BN • Telephone
presets for turnouts (pcints). ence ESS·109. 01·437 0678.

ELEKTOR ELECTRON1CS JANUARY 1990

Вам также может понравиться