EM38A / EM38A-R / EM38A-X User’s Manual
Page 5 of 8
Serial Interface
When the serial interface is enabled, all parallel inputs T1 ~ T8 are
disabled and all Parallel Modes are no longer available.
The serial interface consists of a female DB9 serial port supporting
both RS-232 (default setting) and RS-485. To support RS-485, you
must move the internal jumper JP1 to the “485” setting.
On the DB9 connector, three pins are used for RS-232: pin 2 for
RX, pin 3 for TX, pin 5 for ground. Two pins on the same connector
are used for RS-485: pin 1 for negative, pin 9 for positive.
The hardware protocol is fixed at 9600 baud, eight data bits, no
parity and one stop bit (9600, 8N1). Other protocols may be sup-
ported by special request.
For RS-232 applications, the system (a DCE device) is connected
to a DTE device (such as a PC) with a regular serial cable (not a
null modem cable). For RS-485 applications, up to 32 systems,
each assigned with a unique address, can be daisy chained on the
same bus with a 2-wire cable.
To enable the Serial Mode on the system, the configuration file
must contain a two-digit code ranging from 00 to 99. These two
digits are the only text required for the configuration file. If the code
is 00, the system enters the RS-232 mode. If the code is within 01
to 99, the system enters the RS-485 mode and uses the code as
its address on the RS-485 bus.
Both the RS-232 mode and the RS-485 mode use the same soft-
ware protocol except that in the RS-232 mode, the address byte is
not used (see below).
The communication protocol uses software handshake on a per-
byte basis. That is, for every byte it receives, the system sends an
confirmation byte to the DTE. The DTE must not send the next byte
until it receives the confirmation, otherwise commands may not be
received properly.
A communication session always starts with an initial process. The
DTE always initiates the communication by sending an ASCII ‘A’
followed immediately by the binary code for the RS-485 address.
For the RS-232 mode the address code is not used/sent. The de-
vice should respond by sending back an ASCII “a” within 100 ms.
Otherwise the initial process has failed and should be restarted.
After the initial process the DTE can issue the command one byte
at a time. For each byte sent, the DTE should wait to receive a
proper confirmation within 100 ms. If the confirmation is missing or
invalid, the whole session must be aborted.
The initial process must precede each and every command.
Testing the Serial Port
The serial port can be easily tested by using a Windows utility pro-
gram called “HyperTerminal”. HyperTerminal allows you to send
and receive data through the PC’s serial port. All you need to do is
type the letters on the keyboard to send them, and watch the screen
for received data.
The first step is to create a text file called “MODE.TXT” on the flash
card. Put only two letters in the file: 66. This will put the player into
the RS-485 mode with an address of 66. You may use Windows
Notepad or Wordpad to create the file, just be sure to save the file
as “text only”.
In addition to the MODE.TXT file, you also need to put a test sound
file on the flash card. For testing purpose, this sound file should be
called “001.mp3”.
The next step is to connect the player to the PC using a “straight
through” serial cable, not a “null modem” one. A straight through
cable has pin 2 connected to pin 2, pin 3 connected to pin 3, and
pin 5 connected to pin 5. Those are the only three pins we use.
Other pins, whether connected or not, do not matter.
Power up the player and run HyperTerminal on the PC. On Win-
dows XP this program is found under
Start>All Programs>Accessories>Communications
Create a new connection on the COM port to which the player is
connected, with the following parameters:
Bits per second = 9600
Data bits = 8
Parity = None
Stop bits = 1
Flow control = None
Now we are ready to send the following commands to the player.
We Type
Player Responds
------------------------------------------------------
A
-
B
a
(see notes below)
F
f
0
0
0
0
1
1
At this point the player should start playing the test sound file, and
the test is considered successful.
Note that we typed ‘B’ as the RS-485 address code because the
binary value of ASCII ‘B’ is 66 - the number we put in the MODE.TXT
file earlier. If we had used 00 in the MODE.TXT file earlier to put
the system into the RS-232 mode, then this ‘B’ should not be typed.
If you made a mistake and typed a wrong letter during the test, the
player will either respond with a letter ‘e’ (for error) or not respond
at all, depending on the situation. In this case, you need to re-type
the command from the very beginning.