
EM38A-M / EM38AR-M / EM38AX-M User’s Manual Page 2 of 3
Modbus Interface
EM38A-M is a Modbus slave and supports both RS232-MODBUS
(default) and 2W-MODBUS interfaces. To select 2W-MODBUS, the
internal jumper JP1 must be moved to the “485” setting.
The pin assignment on the female DB9 connector is:
RS232-MODBUS Pin Assignment
Pin 2 = RX
Pin 3 = TX
Pin 5 = Ground
2W-MODBUS Pin Assignment
Pin 1 = D1 (D-)
Pin 9 = D0 (D+)
Pin 5 = Ground
Note that the 2W-MODBUS pin assignment is not Modbus compli-
ant. This can be remedied, if necessary, by using the optional DB9
Breakout Board that converts DB9 to screw terminals.
Communication Protocol & Parameters
Protocol = RTU, TCP (if equipped with Ethernet converter)
Baud Rate = 19200 (default) or 9600/14400/28800/38400/57600
Data Bit = 8
Parity = None
Stop Bit = 1
Flow Control = None
Supported Commands
Read Holding Registers (0x03)
* Only single register read is supported.
Write Single Register (0x06)
Device Address Assignment
Each device must be assigned with a unique adress ranging from
1 to 247. To make the assignment, simply create a text file named
MODE on the SD card and put in it the 3-digit decimal address
such as 007 or 168. The device reads this information every time it
powers up. If MODE is missing or contains invalid data, the default
address (1) will be used.
Baud Rate Configuration
Add the baud rate to the MODE file in the following manner:
device_id,baud_rate
For example: 007,57600
Baud rate configuration is optional. The default value is 19200.
Sound Files & Playlist
For identification purposes, each sound file must be assigned with
a unique 3-digit decimal number ranging from 000 to 999. To make
the assignment, simply add the file number at the beginning of the
filename such as “001 original_filename”.
In order to maximize the number of files that can be stored on the
SD card, the filename should contain:
- 8 characters or less (including the file number)
- only numbers and capital letters
The audio playback is playlist-based instead of file-based. A playlist,
containing one or more consecutively numbered files, is defined
by the first file number and the last file number. The first file num-
ber should always be equal to or smaller than the last file number.
These two file numbers should be the same if there is only one file
in the playlist.
Holding Registers
Register R1 - Playback Control (R/W)
Write to issue a command. Read 0 after command execution. Be
sure to load registers R2 & R3 before issuing Start Play command.
Bit 15 ~ 8: Unused
Bit 7 ~ 4: Play Count (for Start Play only)
0 = Forever
1 = 1 time
........
15 = 15 times
Bit 3 ~ 0: Command
0 = None
1 = Start Play
2 = Stop Play
3 = Pause Play
4 = Resume Play
5 ~ 15 = unused
Register R2 - First File Number (R/W)
Read/write to get/set the playlist’s first file number. Can also be
used to play a single file (instead of a playlist) immediately.
Bit 15 ~ 12: Play Count
0 = load R2 without playing
1 = start playing file 1 time
........
9 = start playing file 9 times
10 = start playing file forever
11 ~ 15 = Unused
Bit 11 ~ 0 = file number (0 ~ 999)
* R3 will also be written with this value autmatically if Play Count is
1 ~ 10. R3 will not be affected if Play Count is 0.
Register R3 - Last File Number (R/W)
Read/write to get/set the playlist’s last file number.
Bit 15 ~ 0 = file number in binary form (0 ~ 999)
Register R4 - Volume (R/W)
Read/write to get/set the software output volume.
Bit 15 ~ 8: Right Channel, 0 (silent) ~ 255 (loudest)
Bit 7 ~ 0: Left Channel, 0 (silent) ~ 255 (loudest)
The actual output volume is a combination of this value and the
physical volume knob.
Register R5 - Relay (R/W)
Read/write to get/set relay states.
Bit 15 ~ 8: Unused
Bit 7 ~ 0: Relay State
Bit 0 = relay #1 (0: OFF, 1: ON)
........
Bit 7 = relay #8 (0: OFF, 1: ON)
Register R6 - Playback Status (R/O)
Read to get the playback status.
Bit 15 ~ 8: Unused
Bit 7 ~ 0: Playback Status
0 = idle
1 = playing
2 = paused
Register R7 - Current File Number (R/O)
Read to get the file number of the file currently playing or pausing.
Bit 15 ~ 0 = file number (0 ~ 999)